TestingBot provides an online grid of browsers and mobile devices to run automated tests on via Selenium WebDriver. This example demonstrates how to use Python with pytest and pytest-selenium to run tests on TestingBot.
- Python 3.9 or newer
-
Setup
- Clone the repo
- Install the dependencies:
pip install -r requirements.txt
-
TestingBot Credentials
- Add your TestingBot Key and Secret as environment variables. You can find these in the TestingBot Dashboard.
$ export TESTINGBOT_KEY=<your TestingBot Key> $ export TESTINGBOT_SECRET=<your TestingBot Secret>
- Sample Test:
$ pytest test_sample.py
pytest.ini selects the TestingBot driver and the browser (latest Chrome on Windows 11).
To use another browser, override a capability on the command line:
$ pytest test_sample.py --capability browserName firefox
pytest-selenium marks each test as passed or failed on TestingBot and prints a link to the test. You will see the test result in the TestingBot Dashboard.