Difference between revisions of "7CC005 Workshop w6"
(12 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | [[Main Page]] >> [[7CC005|Web Technologies]] >> [[7CC005_-_Workbook|Workbook]] >> Week | + | [[Main Page]] >> [[7CC005|Web Technologies]] >> [[7CC005_-_Workbook|Workbook]] >> Week 06 - Automated Web Testing |
− | == | + | == Testing with React.js == |
+ | You can test React components similar to testing other JavaScript code. | ||
+ | * [https://reactjs.org/docs/testing.html Testing Overview] | ||
− | + | ===Recommended Tools=== | |
− | + | Jest is a JavaScript test runner that lets you access the DOM via jsdom. While jsdom is only an approximation of how the browser works, it is often good enough for testing React components. Jest provides a great iteration speed combined with powerful features like mocking modules and timers so you can have more control over how the code executes. | |
− | + | React Testing Library is a set of helpers that let you test React components without relying on their implementation details. This approach makes refactoring a breeze and also nudges you towards best practices for accessibility. Although it doesn’t provide a way to “shallowly” render a component without its children, a test runner like Jest lets you do this by mocking. | |
− | == | + | == Testing your REST API with Postman == |
− | + | You can send requests in Postman to connect to APIs you are working with. Your requests can retrieve, add, delete, and update data. Whether you are building or testing your own API, or integrating with a third-party API, you can try out your requests in Postman. Your requests can send parameters, authorization details, and any body data you require. | |
+ | * [https://www.postman.com/ https://www.postman.com/] | ||
+ | * [https://learning.postman.com/docs/sending-requests/requests/ Building requests] | ||
+ | * [https://learning.postman.com/docs/writing-scripts/test-scripts/ Write API test scripts in Postman] | ||
− | == | + | == Going further == |
− | + | In this tutorial, we will set up a small project with automated visual tests using Puppeteer, Jest and VisWiz.io. 💡 | |
− | + | * [https://www.viswiz.io/help/tutorials/puppeteer Visual Regression Testing with Puppeteer & Jest] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | // | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 11:36, 17 January 2024
Main Page >> Web Technologies >> Workbook >> Week 06 - Automated Web Testing
Testing with React.js
You can test React components similar to testing other JavaScript code.
Recommended Tools
Jest is a JavaScript test runner that lets you access the DOM via jsdom. While jsdom is only an approximation of how the browser works, it is often good enough for testing React components. Jest provides a great iteration speed combined with powerful features like mocking modules and timers so you can have more control over how the code executes.
React Testing Library is a set of helpers that let you test React components without relying on their implementation details. This approach makes refactoring a breeze and also nudges you towards best practices for accessibility. Although it doesn’t provide a way to “shallowly” render a component without its children, a test runner like Jest lets you do this by mocking.
Testing your REST API with Postman
You can send requests in Postman to connect to APIs you are working with. Your requests can retrieve, add, delete, and update data. Whether you are building or testing your own API, or integrating with a third-party API, you can try out your requests in Postman. Your requests can send parameters, authorization details, and any body data you require.
Going further
In this tutorial, we will set up a small project with automated visual tests using Puppeteer, Jest and VisWiz.io. 💡