Applying TDD when the application is 100% CRUD

后端 未结 9 1768
梦谈多话
梦谈多话 2021-01-30 04:23

I routinely run into this problem, and I\'m not sure how to get past this hurdle. I really want to start learning and applying Test-Driven-Development (or BDD, or whatever) but

相关标签:
9条回答
  • 2021-01-30 04:45

    These days you should not need much hand written code for a CRUD app apart from the UI, as there are a 101 frameworks that will generate the database and data access code.

    So I would look at reducing the amount of hand written code, and automating the testing of the UI. Then I would use TDD of the odd bits of logic that need to be written by hand.

    0 讨论(0)
  • 2021-01-30 04:54

    I feel like we are confusing TDD with Unit Testing.

    Unit Testing are specific tests which tests units of behaviors. These tests are often included in the integration build. S.Lott described some excellent candidates for just those types of tests.

    TDD is for design. I find more often then not that my tests I write when using TDD will either be discarded or evolve into a Unit Test. Reason behind this is when I'm doing TDD I'm testing my design while I'm designing my application, class, method, domain, etc...

    In response to your scenario I agree with what S.Lott implied is that what you are needing is a suite of Unit tests to test specific behaviors in your application.

    0 讨论(0)
  • 2021-01-30 04:54

    Just an idea...

    Take the requirements for the CRUD, use tools like watij or watir or AutoIt to create test cases. Start creating the UI to pass the test cases. Once you have the UI up and passing maybe just one test, start writing the logic layer for that test, and then the db layer.

    For most users, the UI is the system. Remember to write test cases for each new layer that you are building. So instead of starting from the db to app to ui layer, start in the reverse direction.

    At the end of the day, you would probably have a accumulated a powerful set of regression test set, to give you some confidence in doing refactoring safely.

    this is just an idea...

    0 讨论(0)
提交回复
热议问题