Recall & Review
beginner
What is test isolation in software testing?
Test isolation means running each test independently so that tests do not affect each other. This helps find bugs more easily and keeps tests reliable.
Click to reveal answer
beginner
Why should tests be isolated when using Cypress?
Isolated tests prevent shared state or data from causing false results. Cypress runs tests in the same browser session, so isolation avoids interference between tests.
Click to reveal answer
intermediate
Name two common strategies to isolate tests in Cypress.
1. Reset application state before each test (e.g., clear database or local storage). 2. Use Cypress commands like cy.visit() to reload the page fresh for each test.
Click to reveal answer
beginner
How does using cy.visit() help with test isolation?
cy.visit() reloads the web page, clearing any temporary data or UI changes from previous tests. This ensures each test starts with a clean page.
Click to reveal answer
beginner
What is a downside of poor test isolation?
Tests can pass or fail unpredictably because they depend on leftover data or state from other tests. This makes debugging harder and reduces trust in test results.
Click to reveal answer
What does test isolation ensure in Cypress tests?
✗ Incorrect
Test isolation means each test runs independently so they don't affect each other.
Which Cypress command helps reset the page state between tests?
✗ Incorrect
cy.visit() loads a fresh page, helping isolate tests by resetting the UI state.
Why is clearing local storage important for test isolation?
✗ Incorrect
Clearing local storage removes leftover data that could cause tests to interfere with each other.
What can happen if tests are not isolated?
✗ Incorrect
Without isolation, tests can fail unpredictably because they depend on leftover data or state.
Which is NOT a good practice for test isolation in Cypress?
✗ Incorrect
Sharing login state across tests can cause tests to depend on each other, breaking isolation.
Explain why test isolation is important in Cypress and describe two ways to achieve it.
Think about how leftover data or UI changes can affect other tests.
You got /4 concepts.
Describe the risks of not isolating tests and how it affects test reliability.
Consider what happens if one test changes something another test depends on.
You got /4 concepts.