Test Overview
This test checks if the sum of two numbers is correct. It uses an assertion with a message to explain the failure if the sum is wrong.
This test checks if the sum of two numbers is correct. It uses an assertion with a message to explain the failure if the sum is wrong.
import pytest def test_sum(): a = 5 b = 7 result = a + b assert result == 12, f"Expected sum to be 12 but got {result}"
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | pytest test runner initialized | - | PASS |
| 2 | Assign values a=5 and b=7 | Variables a and b set in memory | - | PASS |
| 3 | Calculate result = a + b | result variable holds value 12 | - | PASS |
| 4 | Assert that result == 12 with message | Check if result equals 12 | Assert result == 12 | PASS |
| 5 | Test ends successfully | Test passed with no errors | - | PASS |