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
O'Reilly logo

Chapter 4. Test to Learn

In the previous three chapters we have seen how automated tests can help improve quality of code, guide design and drive development. In this chapter we will use automated tests to learn. As small executable code examples, unit tests make a perfect learning resource. Isolating a specific aspect of an interface in a unit test is a great way to learn more about how it behaves. Other types of automated tests can help our understanding of both the language and specific problems. Benchmarks are a valuable tool to measure relative performance, and can guide decisions about how to solve a specific problem.

4.1 Exploring JavaScript with Unit Tests

Quickly executing JavaScript, as in executing a few lines of script to explore ...

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