0
0
Testing Fundamentalstesting~10 mins

Acceptance testing in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This acceptance test checks if the login feature works as expected for a user. It verifies that a user can successfully log in with valid credentials and reach the dashboard page.

Test Code - Selenium with Python unittest
Testing Fundamentals
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
import unittest

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

    def test_valid_login(self):
        driver = self.driver
        # Find username field and enter username
        username_field = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.ID, 'username'))
        )
        username_field.send_keys('validUser')

        # Find password field and enter password
        password_field = driver.find_element(By.ID, 'password')
        password_field.send_keys('validPass123')

        # Find and click login button
        login_button = driver.find_element(By.ID, 'login-btn')
        login_button.click()

        # Wait for dashboard page to load by checking dashboard header
        dashboard_header = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.ID, 'dashboard-header'))
        )

        # Assert dashboard header text is correct
        self.assertEqual(dashboard_header.text, 'Welcome to Your Dashboard')

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

if __name__ == '__main__':
    unittest.main()
Execution Trace - 6 Steps
StepActionSystem StateAssertionResult
1Test starts and opens Chrome browserBrowser window opens at 'https://example.com/login' page-PASS
2Waits for username field to be present and enters 'validUser'Login page shows username and password fields and login buttonUsername field is present and enabledPASS
3Finds password field and enters 'validPass123'Password field is visible and ready for inputPassword field is present and enabledPASS
4Finds and clicks the login buttonLogin button is clickableLogin button is present and clickablePASS
5Waits for dashboard header to appear after loginDashboard page loads with header elementDashboard header text equals 'Welcome to Your Dashboard'PASS
6Test ends and browser closesBrowser window closes-PASS
Failure Scenario
Failing Condition: Dashboard header does not appear or text is incorrect after login
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify after clicking the login button?
AThat the login button changes color
BThat the username field is cleared
CThat the dashboard header with text 'Welcome to Your Dashboard' appears
DThat the password field becomes hidden
Key Result
Acceptance tests should simulate real user actions and verify key outcomes to confirm the software meets user needs.