Testing with Python¶
Resources¶
- Python Testing
- PyTest
- Tavern - API testing
Tavern¶
Notes¶
pipenv install --dev tavern[pytest]- Create YAML test file in tests directory.
- test_server.tavern.yaml - all test should be test_{name}.tavern.yaml
- Pytest
- Run
pytestin top directory - will find tests/ directory - Run selected tests -
pytest -k faketo run all tests with fake in the name. - Minimize debug info -
pytest --tb=short - Run one test -
pytest tests\test_register_service.py::test_random_code_generator - Show print output in pytest -
pytest -s tests\test - Continuous watching changes
pipenv install --dev pytest-testmon pytest-watch- Pytest Watch
- Pytest Testmon
- Tavern
- Uses a YAML file for test setup.
- Talks directly to the API
- Can use pytest to run the test.
- Can create common.yaml file with shared parameters
- Be sure to include it in every individual test - every test is individual
- Robot Framework
Last update: April 13, 2020 15:25:03