Test Overview
This test checks if a web application meets non-functional quality standards like loading speed and responsiveness, which directly impact user experience.
This test checks if a web application meets non-functional quality standards like loading speed and responsiveness, which directly impact user experience.
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 TestNonFunctionalQuality(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.implicitly_wait(5) def test_page_load_time_and_responsiveness(self): driver = self.driver driver.get('https://example.com') # Measure page load by waiting for main content WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.ID, 'main-content')) ) # Check if button is clickable quickly button = WebDriverWait(driver, 5).until( EC.element_to_be_clickable((By.ID, 'submit-btn')) ) button.click() # Verify response message appears response = WebDriverWait(driver, 5).until( EC.visibility_of_element_located((By.ID, 'response-msg')) ) self.assertEqual(response.text, 'Submission successful') def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and Chrome browser opens | Browser window is open and ready | - | PASS |
| 2 | Navigates to https://example.com | Page begins loading | - | PASS |
| 3 | Waits up to 10 seconds for element with ID 'main-content' to appear | Page main content is visible | Presence of main content element | PASS |
| 4 | Waits up to 5 seconds for 'submit-btn' button to be clickable | Button is clickable and ready for interaction | Button is enabled and clickable | PASS |
| 5 | Clicks the 'submit-btn' button | Button click triggers response | - | PASS |
| 6 | Waits up to 5 seconds for 'response-msg' element to be visible | Response message is displayed | Response text equals 'Submission successful' | PASS |
| 7 | Test ends and browser closes | Browser window closed | - | PASS |