This repository contains example Web UI tests that use the TestProject Python SDK. It is the companion project for my tutorial, Test-Driving TestProject's New Python SDK.
TestProject is a free end-to-end test automation platform for Web, mobile, and API tests. It provides:
- An in-browser recorder for building tests visually
- SDKs in Java, C#, and Python for coded automation solutions
- Add-ons that are automation building blocks developed and shared by the community
- Test dashboards and analytics hosted in the cloud
Check out TestProject's documentation for more information.
Make sure your machine has the latest version of Python installed, as well as any browsers you wish to test (Chrome, Firefox, etc.).
To set up TestProject for running the tests in this repository:
- Sign up for a free TestProject account.
- Download and install the TestProject agent for your operating system, or pull a container from Docker Hub.
- Run the agent and register it with your account.
- Install this project's Python dependencies using
pip install requirements.txt. - Set your developer token as the
testproject_tokenfield in theconfig.jsonfile.
This repository contains a Web UI test using pytest that does a basic search using DuckDuckGo. This test case is implemented in two ways:
- Using a traditional pytest function under
tests/traditional - Using a Gherkin feature file with pytest-bdd under
tests/bdd
Both implementations use the TestProject Python SDK for browser automation.
Here's a brief overview of the test design:
config.jsoncontains input values such as browser type, project name, and developer token.tests/conftest.pycontains pytest fixtures and hooks to set up tests and the TestProject WebDriver- the
pagespackage contains DuckDuckGo page objects that call the TestProject WebDriver - the test cases call page objects rather than calling the TestProject WebDriver directly
To run tests, execute python -m pytest at the command line.
You can provide path arguments to filter the tests to execute.
For example, pytest -m pytest tests/traditional
will execute only the traditional-style tests and not the BDD-style tests.
Once tests complete, their results should appear in the TestProject Reports dashboard online.