Recall & Review
beginner
What is a JSON fixture file in Cypress?
A JSON fixture file is a simple file that stores test data in JSON format. Cypress uses it to load data during tests, making tests cleaner and easier to maintain.
Click to reveal answer
beginner
How do you load a JSON fixture file in a Cypress test?
Use
cy.fixture('filename').then((data) => { ... }) to load the JSON data from the fixture file named filename.json.Click to reveal answer
beginner
Why use JSON fixture files instead of hardcoding test data?
Using JSON fixture files keeps test data separate from test code. This makes tests easier to read, update, and reuse, just like keeping your recipe separate from your cooking steps.
Click to reveal answer
beginner
Where should JSON fixture files be placed in a Cypress project?
They should be placed inside the
cypress/fixtures folder. Cypress automatically looks here when you use cy.fixture().Click to reveal answer
beginner
What is the correct format for a JSON fixture file?
A JSON fixture file must be valid JSON: key-value pairs inside curly braces, with keys and string values in double quotes, and no trailing commas.
Click to reveal answer
Where do you place JSON fixture files in a Cypress project?
✗ Incorrect
JSON fixture files belong in the cypress/fixtures folder so Cypress can find them with cy.fixture().
How do you access data from a JSON fixture file in a test?
✗ Incorrect
Use cy.fixture('filename').then(...) to load and use JSON fixture data in Cypress tests.
Why is it better to use JSON fixture files instead of hardcoding data?
✗ Incorrect
Separating data from test code makes tests easier to read, update, and reuse.
Which of these is a valid JSON fixture file content?
✗ Incorrect
Valid JSON requires double quotes around keys and string values.
What happens if you try to load a fixture file that does not exist?
✗ Incorrect
Cypress throws an error if the fixture file is missing, causing the test to fail.
Explain how to use JSON fixture files in Cypress tests.
Think about where the file goes and how to load it in your test.
You got /4 concepts.
Describe the benefits of using JSON fixture files for test data.
Consider how separating data helps in real life, like keeping ingredients separate from cooking steps.
You got /4 concepts.