-
Notifications
You must be signed in to change notification settings - Fork 195
Setup
The setup for our open-sourced Python test automation framework is fairly simple. Don't get fooled by the length of this section. We have documented the setup instructions in detail so even beginners can get started.
The setup has four parts:
- Prerequisites
- Setup for GUI/Selenium automation
- Setup for Mobile/Appium automation
- Setup for API automation
a) Install Python 3.x
b) Add Python 3.x to your PATH environment variable
c) If you do not have it already, get pip (NOTE: Most recent Python distributions come with pip)
d) pip install -r requirements.txt to install dependencies
If you ran into some problems on step (d), please report them as an issue or email Arun([email protected]).
Starting with Selenium 4.10, there's no need to manually download browser drivers, as Selenium now automatically downloads both the browser and the driver if they are not already installed. By default, all downloads are stored in the ~/.cache/selenium directory.
To specify the browser and version:
You can run your tests by specifying the browser with the --browser argument and, optionally, the version with the --ver argument. If the specified browser or version is not already installed, Selenium will download the appropriate browser and driver automatically.
Example commands:
-
Chrome:
python -m pytest -k example_form --browser Chrome -
Firefox:
python -m pytest -k example_form --browser Firefox -
To specify a version: You can add the
--verargument to run the test against a specific browser versionpython -m pytest -k example_form --browser Chrome --ver 115.0This will automatically download both the specified version of the browser and its corresponding webdriver if not already installed.
Optional steps for integrating with third-party tools:
- Integrate our Python test automation framework with Testrail
- Integration with ReportPortal
- Integrate our Python GUI/web automation framework with BrowserStack
- Integrate our Python Selenium automation framework with Sauce Labs
- Integrate our Python GUI/web automation framework with LambdaTest
- Run Python integration tests on Jenkins
- Run Python integration tests on CircleCI
- Post Python automation test results on Slack
- Email pytest report with Gmail
a) Download and Install appium desktop app
b) Download and Install Android Studio and create an emulator
d) Install the appium Python client library pip install Appium-Python-Client
If your setup goes well, you should be to run a simple mobile test with this command after starting the Appium and Android emulator:
python -m pytest -k mobile_bitcoin_price --mobile_os_version $Emulator_OS_Version --device_name $Emulator_Name --app_path $App_path
Optional steps for more details on setting up appium and running tests on Android or iOS refer to below links:
a. Get Cars API code from repo https://github.com/qxf2/cars-api using command "git clone https://github.com/qxf2/cars-api.git"
b. Install Flask using command "pip install flask"
c. Run cars-app server using command "python cars-api/cars_app.py"
d. Run test_api_example now using command "python -m pytest -k api -s"
Optional steps for more details on setting up API and running tests refer to below link: