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 the process will cause errors, and also check if the process can handle exceptions. Using unit testing, we can catch code problems and trace them easily. There are more benefits of using unit testing, and it is probably one of the necessities in programming. To learn more about unit testing, visit the following URL:

https://en.wikipedia.org/wiki/Unit_testing

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.90.172