Test Overview
This test checks if the software testing process correctly identifies a simple bug in a calculator app by verifying the addition function works as expected.
This test checks if the software testing process correctly identifies a simple bug in a calculator app by verifying the addition function works as expected.
import unittest class Calculator: def add(self, a, b): return a + b class TestCalculator(unittest.TestCase): def test_addition(self): calc = Calculator() result = calc.add(2, 3) self.assertEqual(result, 5, "Addition result should be 5") if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Testing framework initializes the test runner | - | PASS |
| 2 | Creates Calculator instance | Calculator object ready for use | - | PASS |
| 3 | Calls add method with inputs 2 and 3 | Calculator processes addition | - | PASS |
| 4 | Checks if result equals 5 | Result is 5 | self.assertEqual(result, 5) | PASS |
| 5 | Test ends | Test runner reports success | - | PASS |