Bird
0
0

Given the code below, how many tests will run and what will be their names?

medium📝 Predict Output Q13 of 15
Cypress - Writing Tests
Given the code below, how many tests will run and what will be their names?
describe('Login Tests', () => {
  it('should open login page', () => {});
  it('should submit login form', () => {});
});
A2 tests: 'should open login page' and 'should submit login form'
B2 tests: 'Login Tests should open login page' and 'Login Tests should submit login form'
C1 test: 'Login Tests'
DNo tests will run because describe has no assertions
Step-by-Step Solution
Solution:
  1. Step 1: Count the number of it blocks inside describe

    There are 2 it blocks, so 2 tests will run.
  2. Step 2: Understand how test names are formed

    Test names combine the describe name and it name, joined by a space.
  3. Final Answer:

    2 tests: 'Login Tests should open login page' and 'Login Tests should submit login form' -> Option B
  4. Quick Check:

    describe + it names combined = C [OK]
Quick Trick: Test names = describe name + it name combined [OK]
Common Mistakes:
  • Counting describe as a test
  • Ignoring describe name prefix in test names
  • Assuming tests won't run without assertions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes