20 people attended this evenings meeting! We had folks from Owosso, Southfield, Farmington Hills, Bowling Green Ohio, and of course Ann Arbor.
People are interested in writing tests for legacy code. Ideas shared among the group were:
1. Working with legacy code book by Michael Feathers
2. begin with some tests, minimize total costs and work to maximize the amount of code to be tested
3. Setting up the testing environment is very time consuming. The testing environment should have a set up and tear down structure. Sometimes this is hard to sell to management.
4. Getting real data for testing - think of CRUD - create, read, update, delete - create the data you need for testing, start with that.
5. Test boundary conditions in range situations. Often most errors occur within -1 and +1 of the ranges.
6. Only test what you write
7. Only deal with what you have to do to get it done (do the simplest thing that will work). Refactoring should be an integral component of your overall coding.
8. Separate your test code from the development code discussed - because the run time test code need to be deployed along with the code (do you expect your users to be changing prod code? Why else would they need the unit tests?)
9. A unit test never touches the production database
10. A test case is the precursor to writing the code. The test defines what code to write.
11. TDD forces you to focus on writing tests to validate the requirements with the minimal amount of code written to deliver value.
Joe Hershey and Jay Wren paired up to code. The benefits of pairing discussed:
constant design feedback, keeping you focused, ensuring you're completing what you expected.
Visual Studio used, coding in .net
Why TDD?
Example: Code built, last minute change needed, team that didn't have TDD spent all night checking the code - team that had TDD ran their tests and shipped in hours.
TDD is more about design not tests. TDD forces better design in order to create the tests.
Comment made that even TDD code can be spaghetti code. Focus is to improve design of the code.
Refactoring an important component.
Using TDD, you catch requirement gaps as you code, rather than beginning to code and guessing on what is needed.
Resharper, Eclipse, Code Rush, all provide usability tools for testing.
Pattern for test creation: range, act, assert
What specifically should I test - what values?
Suggestion to involve customer/product owner involved all the way through on the development to help define the requirements and functional specifications. Goal is to have them own the code as much as the development team does rather than just throwing it over the wall.
Identifying a user story requires defining done. This is the criteria for the test.
Mentioned: Cucumber = acceptance test framework for Ruby
Tags:
Share
-
▶ Reply to This