Why defect tracking improves quality in Testing Fundamentals - Automation Benefits in Action
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 DefectTrackingPage: def __init__(self, driver): self.driver = driver self.wait = WebDriverWait(driver, 10) def login(self, username, password): self.driver.get('https://defecttracker.example.com/login') self.wait.until(EC.visibility_of_element_located((By.ID, 'username'))).send_keys(username) self.driver.find_element(By.ID, 'password').send_keys(password) self.driver.find_element(By.ID, 'loginBtn').click() self.wait.until(EC.url_contains('/dashboard')) def open_defect(self, defect_id): self.wait.until(EC.visibility_of_element_located((By.ID, 'searchBox'))).send_keys(defect_id) self.driver.find_element(By.ID, 'searchBtn').click() self.wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, f'div.defect-item[data-id="{defect_id}"]'))).click() def get_defect_details(self): details = self.wait.until(EC.visibility_of_element_located((By.ID, 'defectDetails'))) return details.text def update_status(self, new_status, comment): status_dropdown = self.wait.until(EC.element_to_be_clickable((By.ID, 'statusDropdown'))) status_dropdown.click() option = self.wait.until(EC.element_to_be_clickable((By.XPATH, f"//option[text()='{new_status}']"))) option.click() comment_box = self.driver.find_element(By.ID, 'commentBox') comment_box.clear() comment_box.send_keys(comment) self.driver.find_element(By.ID, 'updateBtn').click() self.wait.until(EC.text_to_be_present_in_element((By.ID, 'currentStatus'), new_status)) def get_current_status(self): status = self.wait.until(EC.visibility_of_element_located((By.ID, 'currentStatus'))) return status.text def verify_defect_in_list(self, status_list_id, defect_id): self.driver.find_element(By.ID, status_list_id).click() self.wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, f'div.defect-item[data-id="{defect_id}"]'))) def test_defect_tracking(): driver = webdriver.Chrome() page = DefectTrackingPage(driver) try: page.login('tester@example.com', 'TestPass123') defect_id = 'DEF-101' page.open_defect(defect_id) details = page.get_defect_details() assert 'Steps to reproduce' in details, 'Defect details missing steps to reproduce' page.update_status('In Progress', 'Started working on defect') status = page.get_current_status() assert status == 'In Progress', 'Status did not update to In Progress' page.update_status('Resolved', 'Fixed the defect') status = page.get_current_status() assert status == 'Resolved', 'Status did not update to Resolved' page.verify_defect_in_list('resolvedDefectsTab', defect_id) finally: driver.quit() if __name__ == '__main__': test_defect_tracking()
This script uses Selenium WebDriver with Python to automate defect tracking verification.
The DefectTrackingPage class follows the Page Object Model to keep page actions organized.
We use explicit waits to wait for elements to load before interacting, avoiding timing issues.
The test logs in, opens a defect by ID, checks defect details, updates status twice, and verifies the status changes correctly.
Assertions confirm that defect details contain expected text and that status updates reflect properly.
Finally, it verifies the defect appears in the resolved defects list after status update.
This approach ensures the defect tracking tool works as expected, which helps improve software quality by managing defects effectively.
Now add data-driven testing with 3 different defect IDs and statuses to update
Practice
Solution
Step 1: Understand the purpose of defect tracking
Defect tracking is used to record and manage bugs found during testing.Step 2: Identify the benefit of defect tracking
By tracking defects, teams can fix bugs faster and improve software quality.Final Answer:
It helps find and fix bugs faster -> Option AQuick Check:
Defect tracking = faster bug fixing [OK]
- Thinking defect tracking creates more bugs
- Believing it hides problems
- Assuming it slows development
Solution
Step 1: Identify key information for defect logging
A good defect log includes description, reproduction steps, and severity to help fix it.Step 2: Evaluate options for completeness
Only Record the bug description, steps to reproduce, and severity includes all necessary details for effective defect tracking.Final Answer:
Record the bug description, steps to reproduce, and severity -> Option AQuick Check:
Complete defect info = correct logging [OK]
- Logging only the title without details
- Ignoring minor bugs completely
- Deleting bugs to reduce list size
Bug ID: 101
Status: Open
Severity: High
Assigned To: Dev TeamWhat is the likely outcome if the defect is tracked properly?
Solution
Step 1: Analyze the defect tracking details
The bug has a clear status, severity, and assigned team, which helps prioritize fixing.Step 2: Understand the effect of proper tracking
Proper tracking ensures the bug is noticed and fixed faster by the responsible team.Final Answer:
The bug will be fixed faster due to clear tracking -> Option CQuick Check:
Clear tracking = faster fix [OK]
- Assuming bugs get ignored if tracked
- Thinking severity changes automatically
- Believing bugs get deleted without fixing
Solution
Step 1: Identify the role of assignment in defect tracking
Assigning defects ensures someone is responsible for fixing them.Step 2: Understand consequences of missing assignment
Without assignment, defects may be overlooked and remain unfixed longer.Final Answer:
The defect may be ignored and not fixed on time -> Option DQuick Check:
Missing assignment = delayed fix [OK]
- Thinking defects fix themselves
- Believing status changes without action
- Assuming defects get deleted automatically
Solution
Step 1: Understand the broader benefits of defect tracking
Defect tracking collects data on bugs, helping teams find patterns and improve development.Step 2: Identify how this data improves quality
Using defect data, teams can fix root causes and improve processes, leading to better software.Final Answer:
By providing data to identify common problem areas and improve processes -> Option BQuick Check:
Defect data = process improvement = better quality [OK]
- Thinking defect tracking hides bugs
- Believing it delays release intentionally
- Assuming it removes testing steps
Ready to prove it?
Pass the test and this pattern moves unknown
