1. Unit Tests: In this type of testing, you need to test individual functions or classes by supplying input and you make sure that output is as expected. A unit test should cover all small pure units of the application- utils, services and helpers. Unit tests are one of the reasons to use functional programming and pure functions.
2. Integration tests: Integration tests can detect many unexpected failures where you can fix one thing and can break the other. Integration tests should cover important cross-module processes. Component snapshot tests also fall into this category. They provide the developers with a way to test how processes affect selected components without actually render them or using a browser or browser-like environment.
3. UI tests or functional tests: UI tests are always running inside a browser or browser-like environment. They simulate user behaviour on certain environments (clicking, typing, scrolling etc…) and make sure these scenarios actually work from the point view of a user.
Test tool types
1. Provide a testing structure (Mocha, Jasmine, Jest, and Cucumber)
2. Give assertion functions (Chai, Jasmine, Jest, and Unexpected)
3. Generate display and watch results (Mocha, Jasmine, Jest, and Karma)
4. Generate and compare snapshots of components (Jest and AVA)
5. Provide mock, stub, and spies (Sinon, Jasmine, Enzyme, Jest, and testdouble)
6. Generate and give code coverage reports (Istanbul, Jest, and blanket)
7. Provide a browser or browser-like environment (Protractor, Casper, Nightwatch, and Phantom)
3. Protractor: Protractor is an automated testing framework which tests only AngularJS applications in the browser. This is a framework which falls in between unit testing and end-to-end testing tool. The protractor is a layer which sits on top of Selenium. In this framework, Selenium runs in the background, and that’s why you will get all sorts of really cool hooks into your angular application. This enables you to start grabbing your data bindings and using some of the Angular goodness like ng-repeats, etc. You can easily grab those elements by the Angular semantics and even, can add to them, read from them and verify them whether your page has the right data or not.
6. Mocha: Mocha is a flexible library which provides the developers with just the base test structure. You can add functionality for assertions, spies, mocks, and the like via other libraries. If you want a flexible configuration, then the additional set up and configuration required for Mocha is something you definitely need to check out. Mocha includes the test structure as globals and thus, you can save a chunk of time because you don’t need to include or require it in every file.
7. Jest: Jest is recommended and used by Facebook and it has a good supporter base. Jest also reports a very fast testing library due to its clever parallel testing. Though the developers commonly use Jest to test React applications, Jest can easily integrate into other applications. Jest usually comes with a wide API which means you don’t need to include additional libraries unless you feel necessary to add this. Jest improves continuously with every update that they have made.
8. NemoJS: NemoJS is an open-source and Node.js automation framework which was invented and developed by PayPal. Nemo.js gives a simple way to add Selenium automation to your Node.js web projects. This also provides the developers with plugin architecture to incorporate custom features into their tests. NemoJs has grabbed 165 in GitHub Stars and NPN downloads are 31,387.