HTML and CSS Reference
In-Depth Information
Writing Good Unit Tests
U nit tests can be an incredible asset. When writing tests as part of the test-driven
development cycle, tests help form the design of production code, provide us with
an indication of progress, and help us scope down and only implement what we
really need. When writing tests after the fact, they help form a suite of regression
tests and a security net in which we can comfortably refactor code. However, simply
adding unit tests to a project will not magically fix it. Bad tests not only provide
little value, they can do actual damage to productivity and the ability to evolve the
code base.
Writing good tests is a craft. Even if you already are a skilled programmer, you
will find that getting good at writing tests takes time and practice. Throughout the
example projects in Part III, Real-World Test-Driven Development in JavaScript, we
have written a lot of tests, done a fair amount of refactoring, and gotten comfortable
with test-driven development. In this final chapter we will identify some guidelines
for writing quality tests. As you practice and improve your tests, you can build on
this list, adding your own insights.
By the end of this chapter you will be able to better understand some of
the choices we made throughout Part III, Real-World Test-Driven Development
in JavaScript, as well as pinpoint problems that could have been solved in a better
Search WWH ::

Custom Search