Test Overview
This test runs a simple PyTest test case inside Jenkins. It verifies that Jenkins can execute the PyTest command and that the test passes successfully.
This test runs a simple PyTest test case inside Jenkins. It verifies that Jenkins can execute the PyTest command and that the test passes successfully.
import pytest def test_addition(): assert 2 + 3 == 5 if __name__ == '__main__': pytest.main(['-v'])
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Jenkins job starts and runs the shell command 'pytest -v' | Jenkins agent environment is ready with Python and PyTest installed | - | PASS |
| 2 | PyTest discovers the test_addition function | PyTest test runner lists test_addition as a test to run | - | PASS |
| 3 | PyTest executes test_addition | Test function runs and performs assertion 2 + 3 == 5 | Assert that 2 + 3 equals 5 | PASS |
| 4 | PyTest reports test_addition PASSED | Test report shows 1 passed test | Verify test result is PASS | PASS |
| 5 | Jenkins captures PyTest output and marks build as SUCCESS | Jenkins console log shows PyTest output with PASS status | Jenkins build status is SUCCESS | PASS |