You are previewing Test-Driven JavaScript Development.

Test-Driven JavaScript Development

Cover of Test-Driven JavaScript Development by Christian Johansen Published by Addison-Wesley Professional

Chapter 17. Writing Good Unit Tests

Unit 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 ...

The best content for your career. Discover unlimited learning on demand for around $1/day.