0
0
Cypresstesting~10 mins

Test naming conventions in Cypress - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test checks that the test name clearly describes what the test does. It verifies that the test name follows good naming conventions for easy understanding.

Test Code - Cypress
Cypress
describe('Login Page Tests', () => {
  it('should display error message when login fails with invalid credentials', () => {
    cy.visit('/login');
    cy.get('#username').type('wrongUser');
    cy.get('#password').type('wrongPass');
    cy.get('#login-button').click();
    cy.get('.error-message').should('be.visible').and('contain', 'Invalid username or password');
  });
});
Execution Trace - 6 Steps
StepActionSystem StateAssertionResult
1Test starts with the name 'should display error message when login fails with invalid credentials'Test framework ready to run the test-PASS
2Browser opens and navigates to '/login' pageLogin page is loaded in the browser-PASS
3Finds username input field with id '#username' and types 'wrongUser'Username field contains 'wrongUser'-PASS
4Finds password input field with id '#password' and types 'wrongPass'Password field contains 'wrongPass'-PASS
5Finds login button with id '#login-button' and clicks itLogin form submitted-PASS
6Finds element with class '.error-message' and checks it is visible and contains text 'Invalid username or password'Error message displayed on the pageError message is visible and text matches expectedPASS
Failure Scenario
Failing Condition: The error message element is not found or text does not match expected
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test name 'should display error message when login fails with invalid credentials' tell us?
AIt describes exactly what the test checks
BIt is too short and unclear
CIt only mentions the login button
DIt is unrelated to the test steps
Key Result
Use descriptive test names that clearly explain what the test does and what it verifies. This helps anyone reading the test understand its purpose quickly.