0
0
Testing Fundamentalstesting~10 mins

Test case components (steps, expected, actual) in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test case checks the login functionality of a website. It verifies that when a user enters valid credentials, they successfully log in and see a welcome message.

Test Code - Selenium
Testing Fundamentals
def test_login_success():
    # Step 1: Open login page
    driver.get('https://example.com/login')

    # Step 2: Enter username
    username_field = driver.find_element(By.ID, 'username')
    username_field.send_keys('validUser')

    # Step 3: Enter password
    password_field = driver.find_element(By.ID, 'password')
    password_field.send_keys('validPass123')

    # Step 4: Click login button
    login_button = driver.find_element(By.ID, 'loginBtn')
    login_button.click()

    # Step 5: Verify welcome message
    welcome_message = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.ID, 'welcomeMsg'))
    )
    assert welcome_message.text == 'Welcome, validUser!', 'Welcome message did not match expected text'
Execution Trace - 5 Steps
StepActionSystem StateAssertionResult
1Open the login page URLBrowser navigates to https://example.com/login showing the login form-PASS
2Find username input field and enter 'validUser'Username field is filled with 'validUser'-PASS
3Find password input field and enter 'validPass123'Password field is filled with 'validPass123'-PASS
4Find and click the login buttonLogin button clicked, page starts loading user dashboard-PASS
5Wait for welcome message element and verify its textWelcome message 'Welcome, validUser!' is displayed on the dashboardCheck that welcome message text equals 'Welcome, validUser!'PASS
Failure Scenario
Failing Condition: Welcome message element does not appear or text is different
Execution Trace Quiz - 3 Questions
Test your understanding
What is the expected result after clicking the login button?
AAn error message about invalid credentials appears
BUser is redirected to the login page again
CUser sees a welcome message with their username
DThe browser closes automatically
Key Result
Always clearly define test steps, expected results, and actual results to make debugging easier and ensure test reliability.