Test Overview
This test runs a simple function check and generates an HTML report using pytest-html plugin. It verifies that the test passes and the report is created.
This test runs a simple function check and generates an HTML report using pytest-html plugin. It verifies that the test passes and the report is created.
import pytest def add(a, b): return a + b def test_add(): assert add(2, 3) == 5 # To run this test and generate HTML report, use: # pytest --html=report.html --self-contained-html
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test runner starts pytest with HTML report option | Terminal ready to run pytest command | - | PASS |
| 2 | Pytest discovers test_add function | Test function test_add found in test file | - | PASS |
| 3 | Pytest executes test_add | Running test_add which calls add(2, 3) | Check if add(2, 3) == 5 | PASS |
| 4 | Test passes as assertion is true | Test completed successfully | assert 5 == 5 | PASS |
| 5 | pytest-html plugin generates report.html file | HTML report file created with test results summary | Report file exists and contains test summary | PASS |