Test Overview
This test checks if two parts of a simple calculator app work well together. It verifies that adding two numbers through the combined modules returns the correct result.
This test checks if two parts of a simple calculator app work well together. It verifies that adding two numbers through the combined modules returns the correct result.
import unittest # Module A: simple adder function def add(a, b): return a + b # Module B: calculator uses add function def calculate_sum(x, y): return add(x, y) class TestIntegrationCalculator(unittest.TestCase): def test_addition_integration(self): result = calculate_sum(3, 4) self.assertEqual(result, 7, "Sum should be 7") if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test runner initialized, test class loaded | - | PASS |
| 2 | Calls calculate_sum(3, 4) | Calculator module ready to use add function | - | PASS |
| 3 | calculate_sum calls add(3, 4) | Adder module receives inputs 3 and 4 | - | PASS |
| 4 | add returns 7 | Adder module returns result 7 | - | PASS |
| 5 | calculate_sum returns 7 to test | Calculator module returns final result | - | PASS |
| 6 | Test asserts result == 7 | Test compares actual result with expected 7 | assertEqual(7, 7) | PASS |
| 7 | Test ends successfully | Test runner reports test passed | - | PASS |