Selecting Tests with Pytest


Index

  1. Running tests
    1.1 Run all tests
    1.2 Run individual test modules
    1.3 Run all tests inside a folder
    1.4 Run a specific test inside a module
  1. Repository
  1. Thanks
  1. Bibliography


1. Running tests

In this tutorial we will see a bunch of possible ways you can run your tests using pytest.


1.1 Run all tests

pipenv run python -m pytest


1.2 Run individual test modules

pipenv run python -m pytest tests/test_search.py


1.3 Run all tests inside a folder

pipenv run python -m pytest tests/


1.4 Run a specific test inside a module

pipenv run python -m pytest tests/test_search.py::test_basic_duckduckgo_search

PS: Calling a test inside a module does not work when using pytest-bdd, for this case please use tags.


2. Repository

If you want to test the commands above, clone the project from the link below and run the commands in the project root.
https://github.com/LuizGustavoR/intro-selenium-py/tree/tutorial/webdriver-with-python

The end.


3. Thanks


4. Bibliography

Leave a Comment

Your email address will not be published. Required fields are marked *