0
0
Testing Fundamentalstesting~10 mins

Acceptance criteria verification in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test checks if the login page meets the acceptance criteria by verifying the presence of username and password fields, and the login button. It then verifies that a successful login message appears after submitting valid credentials.

Test Code - Selenium
Testing Fundamentals
import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class TestLoginAcceptance(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.get('https://example.com/login')

    def test_login_acceptance_criteria(self):
        driver = self.driver
        wait = WebDriverWait(driver, 10)

        # Verify username field is present
        username = wait.until(EC.presence_of_element_located((By.ID, 'username')))
        self.assertTrue(username.is_displayed())

        # Verify password field is present
        password = wait.until(EC.presence_of_element_located((By.ID, 'password')))
        self.assertTrue(password.is_displayed())

        # Verify login button is present
        login_button = wait.until(EC.presence_of_element_located((By.ID, 'loginBtn')))
        self.assertTrue(login_button.is_displayed())

        # Enter valid credentials
        username.send_keys('validUser')
        password.send_keys('validPass123')

        # Click login button
        login_button.click()

        # Verify successful login message
        success_msg = wait.until(EC.presence_of_element_located((By.ID, 'successMessage')))
        self.assertEqual(success_msg.text, 'Login successful')

    def tearDown(self):
        self.driver.quit()

if __name__ == '__main__':
    unittest.main()
Execution Trace - 8 Steps
StepActionSystem StateAssertionResult
1Test starts and Chrome browser opensBrowser opened at https://example.com/login showing login page-PASS
2Waits for username field to be present and visibleUsername input field is visible on the pageAssert username field is displayedPASS
3Waits for password field to be present and visiblePassword input field is visible on the pageAssert password field is displayedPASS
4Waits for login button to be present and visibleLogin button is visible on the pageAssert login button is displayedPASS
5Enters 'validUser' into username fieldUsername field contains 'validUser'-PASS
6Enters 'validPass123' into password fieldPassword field contains 'validPass123'-PASS
7Clicks the login buttonLogin form submitted, page processing login-PASS
8Waits for success message to appearSuccess message 'Login successful' is visible on the pageAssert success message text equals 'Login successful'PASS
Failure Scenario
Failing Condition: If any of the required elements (username, password, login button) are missing or the success message text is incorrect
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify first on the login page?
APassword strength
BSuccessful login message
CPresence of username field
DPage title
Key Result
Always verify all acceptance criteria elements are present and functional before asserting final success conditions to ensure comprehensive test coverage.