O'Reilly logo

Professional Test-Driven Development with C#: Developing Real World Applications with TDD by Jeff McWherter, James Bender

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

SUMMARY

The first user story or feature you develop for an application is important. The success of this first unit of work can set the tone and define the project's values. When planning your work, order your features in a logical manner that starts toward the core of your application and builds out. When breaking your user stories into features, be sure to keep them small, isolated, and testable.

When creating your unit tests, use a consistent standard for naming classes, methods, and variables. The names you give them should be meaningful — not only to developers but also to nontechnical business users who may be asked to validate your tests. Investigate BDD naming styles and conventions, and apply this knowledge to naming your classes, methods, and variables.

See your test fail before you write any code. This is important to ensure that your test is testing functionality that does not exist. If your test passes without any code being written, this could mean many things. Perhaps this is a duplicate feature. It could be that the functionality needed was created as a side effect of a previous feature. Another possibility is that your test is not testing the correct functionality. Find the reason; don't just assume that a test that passes in this manner means it's OK to proceed with development.

Write just enough code to make your test pass — no more. When implementing the business code to make your test pass, always try to do the simplest thing that might work. When the test ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required