Recall & Review
beginner
What is the main purpose of assertions in testing?
Assertions check if the actual result matches the expected result, confirming the software works correctly.
Click to reveal answer
beginner
How do assertions help catch bugs early?
By verifying expected behavior during tests, assertions quickly show when something is wrong, so bugs can be fixed sooner.
Click to reveal answer
beginner
In Cypress, what happens if an assertion fails?
The test stops and reports a failure, showing which expected behavior was not met.
Click to reveal answer
intermediate
Why is it important to write clear expected values in assertions?
Clear expected values make it easy to understand what the test checks and quickly spot when behavior changes unexpectedly.
Click to reveal answer
beginner
Give an example of a simple Cypress assertion verifying a button is visible.
cy.get('button#submit').should('be.visible') checks that the submit button is shown on the page.
Click to reveal answer
What does an assertion in testing do?
✗ Incorrect
Assertions verify that the actual result matches what we expect, confirming correct behavior.
In Cypress, what happens when an assertion fails?
✗ Incorrect
Cypress stops the test and shows a failure message when an assertion does not pass.
Why should expected values in assertions be clear?
✗ Incorrect
Clear expected values help quickly see what behavior is checked and detect unexpected changes.
Which of these is a valid Cypress assertion to check if a text contains 'Hello'?
✗ Incorrect
The 'should contain' assertion checks if the element's text includes the expected string.
What is the benefit of assertions in automated tests?
✗ Incorrect
Assertions confirm that the software works as expected, helping catch errors automatically.
Explain why assertions are important in verifying expected behavior during testing.
Think about how you check if something you built works as you planned.
You got /4 concepts.
Describe how Cypress uses assertions to ensure web elements behave as expected.
Imagine testing if a button is visible or a message appears on a webpage.
You got /4 concepts.