Skip to content

Testing with Python

Resources

Tavern

Notes

  1. pipenv install --dev tavern[pytest]
  2. Create YAML test file in tests directory.
    • test_server.tavern.yaml - all test should be test_{name}.tavern.yaml
  3. Pytest
  4. Run pytest in top directory - will find tests/ directory
  5. Run selected tests - pytest -k fake to run all tests with fake in the name.
  6. Minimize debug info - pytest --tb=short
  7. Run one test - pytest tests\test_register_service.py::test_random_code_generator
  8. Show print output in pytest - pytest -s tests\test
  9. Continuous watching changes
  10. Tavern
  11. Uses a YAML file for test setup.
  12. Talks directly to the API
  13. Can use pytest to run the test.
  14. Can create common.yaml file with shared parameters
    • Be sure to include it in every individual test - every test is individual
  15. Robot Framework

Last update: April 13, 2020 15:25:03