playwright/docs/src/running-tests-python.md
2022-07-21 00:57:09 +02:00

1.3 KiB

id title
running-tests Running Tests

You can run a single test, a set of tests or all tests. Tests can be run on one browser or multiple browsers. By default tests are run in a headless manner meaning no browser window will be opened while running the tests and results will be seen in the terminal. If you prefer you can run your tests in headed mode by using the --headed flag.

  • Running tests on Chromium

    pytest
    
  • Running a single test file

    pytest test_login.py
    
  • Run a set of test files

    pytest tests/todo-page/ tests/landing-page/
    
  • Run the test with the function name

    pytest -k "test_add_a_todo_item"
    
  • Running tests in headed mode

    pytest --headed test_login.py
    
  • Running Tests on specific browsers

    pytest test_login.py --browser webkit
    
  • Running Tests on multiple browsers

    pytest test_login.py --browser webkit --browser firefox
    

For more information see Playwright Pytest usage or the Pytest documentation for general CLI usage.

What's Next