0
0
Testing Fundamentalstesting~10 mins

Regression testing in Testing Fundamentals - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test checks that a previously fixed bug does not appear again after new changes. It verifies that the login feature still works correctly after updates.

Test Code - Selenium with unittest
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 TestLoginRegression(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.get('https://example.com/login')

    def test_login_functionality(self):
        driver = self.driver
        # Wait for username field
        WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, 'username')))
        username_input = driver.find_element(By.ID, 'username')
        password_input = driver.find_element(By.ID, 'password')
        login_button = driver.find_element(By.ID, 'login-btn')

        username_input.send_keys('testuser')
        password_input.send_keys('correctpassword')
        login_button.click()

        # Wait for dashboard to load
        WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, 'dashboard')))
        dashboard = driver.find_element(By.ID, 'dashboard')

        self.assertTrue(dashboard.is_displayed(), 'Dashboard should be visible after login')

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

if __name__ == '__main__':
    unittest.main()
Execution Trace - 8 Steps
StepActionSystem StateAssertionResult
1Test starts and opens Chrome browserBrowser opened at https://example.com/login page-PASS
2Waits up to 10 seconds for username input field to appearLogin page loaded with username, password fields and login button visibleUsername input field is presentPASS
3Finds username, password inputs and login button elementsAll login form elements located-PASS
4Enters 'testuser' in username and 'correctpassword' in password fieldsLogin form filled with credentials-PASS
5Clicks the login buttonLogin form submitted, waiting for dashboard page-PASS
6Waits up to 10 seconds for dashboard element to appearDashboard page loaded with dashboard element visibleDashboard element is presentPASS
7Checks if dashboard element is displayedDashboard visible on screenAssert dashboard.is_displayed() is TruePASS
8Test ends and browser closesBrowser closed-PASS
Failure Scenario
Failing Condition: Dashboard element does not appear after login, indicating login failed or page did not load
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify after clicking the login button?
AThat the dashboard page appears
BThat the login button is disabled
CThat the username field is cleared
DThat the password is visible
Key Result
Always include checks for key page elements after a change to confirm old features still work, which is the core of regression testing.