Introduction

The asynchronous nature of JavaScript has made testing a challenge for many application developers. However, the basic principles of why you should test software remain the same. Testing your code helps prevent unintended mistakes stemming from changes you introduce to your code. By providing test coverage to your application, it is much easier to feel confident that changes in features or functionalities won't result in undermining the existing applications' behavior.

As with most applications, testing for a MEAN stack web application can generally be thought of as a pyramid of three different levels of test abstraction: Unit tests, Integration tests, and E2E tests:

While there are many schools of thought when it comes to testing strategy, we will stick to some of the most common types of testing you may want to do in a MEAN stack web application. We'll be simplifying our focus to unit and integration tests.

End-to-end testing for web applications requires considerable configuration and setup of specialized tooling, such as Selenium and WebDriver, to be accomplished. While this sort of testing can be incredibly powerful, it can also be much more brittle and temperamental to maintain. This is why you should have fewer end-to-end tests proportionally to the quantity of integration and unit tests for your application. For this reason, instead of spending considerable time covering all the intricacies of end-to-end testing with JavaScript, we'll focus on the much more plentiful unit and integration testing levels of abstraction.

If you are especially interested in using end-to-end testing for your JavaScript application, I recommend checking out WebDriver.io, and learning about how to use WebDriver and Selenium together for testing Node.js applications.
http://webdriver.io/
..................Content has been hidden....................

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