From the course: Vue.js: Testing and Debugging
What makes up a testing toolkit?
From the course: Vue.js: Testing and Debugging
What makes up a testing toolkit?
- [Instructor] In order to test Vue.js applications there are a couple of tools required. These tools will be set up as development dependencies in your application. The first set of these tools is a testing library. A testing library is used to scaffold and structure test cases. One of the most popular JavaScript testing libraries is Mocha. The Jest testing framework also contains a testing library, built-in. The second tool required in your testing toolkit is an assertion library. An assertion library allows you to test a piece of code or component in your application by passing an input value and checking for an expected result. An assertion library is used within the structure created by a testing library in a test case. An example of an assertion library is chai.js. Chai.js can be easily combined with Mocha to write test cases. The Jest testing framework also consists of an assertion library, built-in. The third tool required in your testing toolkit is a test runner. This is the tool that takes the code written in your test cases and runs them to give a success or failure report. Examples of test runners are Karma and the Jest testing framework. The three tools we have discussed so far are compulsory in a testing setup. However, the next two are based on your testing needs. The first set of these optional tools is actually a set of functions known as mocks, stubs and spies. This set of functions are used to imitate collaborative code. If the unit of code you're testing depends on an external model or a piece of code, these functions can be used to imitate external functionality that your code depends on. The second optional and final tool in your toolkit is a test coverage tool. Developers and testers often ask the question, how much test is enough test? This tool helps you get close to the answer to that question by reporting the amount of your code that is currently being covered in your test cases. An example of a test coverage tool is istanbul.js. The Jest testing framework also has a test coverage functionality that is built on istanbul.js. In this course, we are going to be using the Jest testing framework. The Jest testing framework is a perfect choice because it consists of all the tools that we have just mentioned. So, in the next video we are going to be setting up the Jest testing framework to use in testing our vue.js applications.