Pytest code along practice
Tutorial video: Learn pytest in 6 Hours⏰ | Complete pytest framework Tutorial
pytest -rA --verbose
- best way to run tests because it is informative
pytest -k lambdatest -rA -v
- will run all tests that contain string "lambdatest"
pytest -k [fileName.py]::[test_nameInTheFile] -rA -v
- will run a specific test from a specific file
pytest -m smoke
- will run tests marked by @pytest.mark.smoke
pytest --disable-warnings
- disables warnings
pytest -m "smoke and integration"
- will run tests marked as smoke and integration
pytest -m "smoke and not integration"
- will run tests marked as smoke but will not run integration
pytest -m "smoke or integration"
- will run tests marked as smoke or integration
pytest --collectonly test_parameters.py
- will collect and check files classes and functions but does not run tests
pytest tests --html=AutomationPageObjectReport.html
- will run tests in tests folder and generate HTML report (install Pytest-HTML before that)