Test Overview
This test checks if a bug tracking system correctly assigns and displays bug severity and priority levels. It verifies that severity and priority labels appear as expected when a bug is created.
This test checks if a bug tracking system correctly assigns and displays bug severity and priority levels. It verifies that severity and priority labels appear as expected when a bug is created.
import unittest from bug_tracker import Bug, BugTracker class TestBugSeverityPriority(unittest.TestCase): def setUp(self): self.tracker = BugTracker() def test_bug_severity_and_priority_display(self): # Create a bug with severity 'Critical' and priority 'High' bug = Bug(title='App crash on login', severity='Critical', priority='High') self.tracker.add_bug(bug) # Retrieve the bug from tracker retrieved_bug = self.tracker.get_bug_by_title('App crash on login') # Assert severity is 'Critical' self.assertEqual(retrieved_bug.severity, 'Critical') # Assert priority is 'High' self.assertEqual(retrieved_bug.priority, 'High') if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test framework initialized, no bugs in tracker | - | PASS |
| 2 | Create a bug with severity 'Critical' and priority 'High' | Bug object created with given severity and priority | - | PASS |
| 3 | Add the bug to the bug tracker | Bug tracker contains one bug with title 'App crash on login' | - | PASS |
| 4 | Retrieve the bug by title from the tracker | Bug object retrieved with severity 'Critical' and priority 'High' | - | PASS |
| 5 | Assert the bug severity is 'Critical' | Bug severity is 'Critical' | Check if retrieved_bug.severity == 'Critical' | PASS |
| 6 | Assert the bug priority is 'High' | Bug priority is 'High' | Check if retrieved_bug.priority == 'High' | PASS |
| 7 | Test ends successfully | Bug severity and priority verified correctly | - | PASS |