Recall & Review
beginner
What is a fixture in Cypress testing?
A fixture is a fixed set of data stored in a file that Cypress can load and use in tests to simulate real data or responses.
Click to reveal answer
beginner
How do you load a fixture file in a Cypress test?
Use
cy.fixture('filename').then((data) => { ... }) to load the fixture data asynchronously inside your test.Click to reveal answer
beginner
Why use fixtures instead of hardcoding test data in Cypress tests?
Fixtures keep test data separate from test code, making tests cleaner, easier to maintain, and allowing reuse of data across multiple tests.
Click to reveal answer
intermediate
How can you use fixture data to stub a network request in Cypress?
Load the fixture with
cy.fixture() and then use cy.intercept() to stub the request, returning the fixture data as the response.Click to reveal answer
beginner
Where should fixture files be stored in a Cypress project?
Fixture files should be placed in the
cypress/fixtures folder, typically as JSON files.Click to reveal answer
Which command loads fixture data in Cypress?
✗ Incorrect
The correct command to load fixture data is cy.fixture('file.json').
Where are fixture files stored by default in a Cypress project?
✗ Incorrect
Fixture files are stored in the cypress/fixtures folder by default.
What is a main benefit of using fixtures in tests?
✗ Incorrect
Fixtures separate test data from test code, improving clarity and reusability.
How can fixture data be used with cy.intercept()?
✗ Incorrect
Fixture data can be used with cy.intercept() to stub network responses.
Which file format is commonly used for fixtures?
✗ Incorrect
JSON is the common format for fixture files because it is easy to read and parse.
Explain how to use a fixture file to stub a network request in a Cypress test.
Think about loading data first, then intercepting the request.
You got /3 concepts.
Describe the advantages of using fixtures in your Cypress tests.
Consider how fixtures help organize and reuse test data.
You got /4 concepts.