Test Overview
This test checks if a tester can successfully create a new test case in a test management tool (like Jira or TestRail) and verify that it appears in the test case list.
This test checks if a tester can successfully create a new test case in a test management tool (like Jira or TestRail) and verify that it appears in the test case list.
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 TestCreateTestCase(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.get('https://example-testmanagement.com/login') self.wait = WebDriverWait(self.driver, 10) def test_create_test_case(self): driver = self.driver wait = self.wait # Login username = wait.until(EC.presence_of_element_located((By.ID, 'username'))) username.send_keys('tester') password = driver.find_element(By.ID, 'password') password.send_keys('password123') login_button = driver.find_element(By.ID, 'login-btn') login_button.click() # Wait for dashboard wait.until(EC.presence_of_element_located((By.ID, 'dashboard'))) # Navigate to Test Cases section test_cases_tab = driver.find_element(By.ID, 'test-cases-tab') test_cases_tab.click() # Click 'Add Test Case' add_button = wait.until(EC.element_to_be_clickable((By.ID, 'add-test-case-btn'))) add_button.click() # Fill test case form title_input = wait.until(EC.presence_of_element_located((By.ID, 'test-case-title'))) title_input.send_keys('Verify login functionality') description_input = driver.find_element(By.ID, 'test-case-description') description_input.send_keys('Test that user can login with valid credentials') # Save test case save_button = driver.find_element(By.ID, 'save-test-case-btn') save_button.click() # Verify test case appears in list test_case_list = wait.until(EC.presence_of_element_located((By.ID, 'test-case-list'))) test_case_titles = test_case_list.find_elements(By.CLASS_NAME, 'test-case-title') titles = [t.text for t in test_case_titles] self.assertIn('Verify login functionality', titles) def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and opens browser | Browser window opens at login page https://example-testmanagement.com/login | - | PASS |
| 2 | Finds username and password fields, enters credentials, clicks login | Login form filled with username 'tester' and password, login button clicked | - | PASS |
| 3 | Waits for dashboard page to load | Dashboard page visible with element ID 'dashboard' | Check presence of dashboard element | PASS |
| 4 | Clicks on 'Test Cases' tab | Test Cases section displayed | - | PASS |
| 5 | Clicks 'Add Test Case' button | Test case creation form appears | Check 'Add Test Case' button is clickable | PASS |
| 6 | Fills in test case title and description | Form fields filled with title 'Verify login functionality' and description | - | PASS |
| 7 | Clicks 'Save' button to create test case | Test case saved and form closes | - | PASS |
| 8 | Verifies new test case appears in test case list | Test case list shows 'Verify login functionality' among titles | Assert 'Verify login functionality' is in test case titles list | PASS |
| 9 | Test ends and browser closes | Browser window closed | - | PASS |