Chapter 10. Testing with PhantomJS

Writing unit and automated tests is a critical part of the development process. Unit tests will save us a lot of time when making big changes to our code. They will also prevent regression and catch bugs earlier on. Using PhantomJS, we will discuss unit testing in this chapter and learn how we can maximize the use of PhantomJS for creating these tests.

What is unit testing?

Unit testing is the practice of testing a smaller unit of code, which can be a function or area of code that we can isolate. This gives us the ability to determine if the function behaves as expected. These tests are independent of each other and can be executed individually. Each can verify for outputs based on the given inputs, determine if ...

Get Getting Started with PhantomJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.