Test Overview
This test checks if a defect is correctly classified by severity and priority in a bug tracking system. It verifies that the defect's severity and priority labels match the expected values after classification.
This test checks if a defect is correctly classified by severity and priority in a bug tracking system. It verifies that the defect's severity and priority labels match the expected values after classification.
import unittest class Defect: def __init__(self, description): self.description = description self.severity = None self.priority = None def classify(self, severity, priority): self.severity = severity self.priority = priority class TestDefectClassification(unittest.TestCase): def test_defect_classification(self): # Create a defect defect = Defect('Login button not working') # Classify defect defect.classify(severity='High', priority='Urgent') # Verify classification self.assertEqual(defect.severity, 'High') self.assertEqual(defect.priority, 'Urgent') if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test framework initialized, no defects created yet | - | PASS |
| 2 | Create a defect instance with description 'Login button not working' | Defect object created with description set, severity and priority are None | - | PASS |
| 3 | Classify defect with severity='High' and priority='Urgent' | Defect object updated: severity='High', priority='Urgent' | - | PASS |
| 4 | Assert defect.severity equals 'High' | Defect severity is 'High' | defect.severity == 'High' | PASS |
| 5 | Assert defect.priority equals 'Urgent' | Defect priority is 'Urgent' | defect.priority == 'Urgent' | PASS |
| 6 | Test ends successfully | All assertions passed, defect classification verified | - | PASS |