Software Testing
The 3 A's (from Dr. Nile Wilson)
- Arrange / Assign - Build up the necessarily arguments that go the function like some mock data etc.
- Act - Use the functions on the arguments.
- Assert - Check if the results are as expected.
In Python's pytest
package, @pytest.mark.parametrize
can be used to test the same function multiple times. Also see =mocker.
To run the PDB to check test failures do the following - use u
to go up the stack trace, at which point you can see the variables in the current scope at that point.
pytest test_script.py --pdb
Or using IPython
.
ipython --pdb test_script.py