After this course, you will:
- provide robust features that work for users as expected
- choose the best tools for the job
- communicate more effectively with colleagues
7 modules with solid testing experience
Do you know what a testing framework does? Do you know what makes a testing framework different from a testing library? The best way to use a tool effectively is to understand how it works. And the best way to understand how the tool works is to do it yourself!
In this short course, we will learn how frameworks and libraries work by creating our own, simpler version of each.
There are many ways your application can break. One of the most common sources of errors is associated with typos and incorrect types. Passing a string to a function that expects a number or ends up in a common typo in a boolean expression are silly mistakes that should never be made, but it happens all the time.
We could write a complete suite of automated tests for our entire codebase so that such bugs never occur, but that would probably be too much work and slow development. Luckily for us, there are tools we can use to cater to a whole category of testing with great developer experience.
Jest is a fully featured testing framework that is second to none. It is surprisingly simple and flexible at the same time. For simple use cases, you often don’t need to configure, install, and use built-in coverage and view support.
However, in a real application, you will often need specific needs for your application, especially when testing browser based applications. You will need to handle Webpack loaders, dynamic imports and custom module resolution, which Node.js does not support.
Cypress is an incredibly powerful web testing tool. It is capable of testing any web application. Its architecture places it in a cut above similar end-to-end testing tools. His experience is best in class. And because Cypress runs your tests in the same context as the rest of your application, you can get the speed, reliability, and debuggability that are just a distant dream with similar tools. Trick? no. Cypress is exceptional.
6. Test React components with Jest and react-testing-library
If you want to deliver your applications with confidence, you need a great suite of automated tests to absolutely make sure that nothing breaks when the changes reach your users. To gain this confidence, your tests must realistically simulate how users actually use your React components.
In this course, we’ll write a series of rendering techniques and run a series of tests to see how we can get the confidence we’re looking for without giving up on maintainability or test speed.
7. Use dom-testing library to test any JS framework
The person using your application components need not know or care what frameworks you used to write your application. Guess what: Same as your tests.
8. NEW Testing Node.js Backends (lesson 115-154)
The backend contains so much of our application’s business logic, which is often used to support multiple clients (web, mobile and other native platforms). This logic is critical to getting it right, and rolling out a revolutionary change can have devastating consequences for your company’s goals (not to mention the results). Increasing your “deployment confidence” is critical, and automated testing is the best way to do this.
As Node.js continues to grow in use around the world, it becomes increasingly important to learn how to test this critical code in a way that improves developer speed and confidence. In this workshop, we use the Express.js example and focus on the patterns and techniques you need to learn so that you can apply what you have learned to test your code written in any Node.js web environment.
- Testing pure functions
- Middleware testing
- Testing controllers
- Testing API routes
- Mocking third party dependencies