Test Overview
This test script uses pytest markers to categorize tests. It runs only tests marked with smoke and verifies their output.
This test script uses pytest markers to categorize tests. It runs only tests marked with smoke and verifies their output.
import pytest @pytest.mark.smoke def test_addition(): assert 1 + 1 == 2 @pytest.mark.regression def test_subtraction(): assert 5 - 3 == 2 @pytest.mark.smoke def test_multiplication(): assert 2 * 3 == 6 # Command to run: pytest -m smoke
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test runner starts pytest with marker filter '-m smoke' | pytest collects tests from the file, filtering only those marked with 'smoke' | - | PASS |
| 2 | pytest runs test_addition() marked with 'smoke' | Test environment ready, test_addition executes | assert 1 + 1 == 2 | PASS |
| 3 | pytest runs test_multiplication() marked with 'smoke' | Test environment ready, test_multiplication executes | assert 2 * 3 == 6 | PASS |
| 4 | pytest does not collect test_subtraction() because it is marked 'regression', not 'smoke' | test_subtraction is not collected or executed | - | PASS |
| 5 | pytest finishes test run and reports results | Only tests with 'smoke' marker ran and passed | 2 tests passed, 0 tests skipped | PASS |