Organizing Your Tests
Find out how to write more readable, reusable, and manageable test cases.
We'll cover the following
In the “Fixtures and Integration” lesson, we briefly talked about different ways to organize our test files:
- Organizing by functionality
- Organizing by components
- Organizing by different pages (the approach we will follow in this course)
- Organizing until we feel comfortable with the setup
In this lesson, we will look at organizing individual spec files using an easy to implement, yet powerful approach.
It massively improves the readability of our test cases while making them easily reusable throughout the application.
This approach organizes test cases into different steps.
Organizing tests into different steps
As discussed earlier, we will demonstrate the power of Cypress through testing its own website, cypress.io. Let’s say we want to start with the home page and verify the following things:
- The cookie policy banner appears as expected.
- The video and the features section are available on the page.
- The carousels are working as expected.
For this, we have a file in the “integration” folder called home.js
that has the following test cases:
Get hands-on with 1400+ tech skills courses.