| 🚀 Sign Up for a free trial at Sauce Labs |
|---|
📄 Source python Repo and README |
| 📄 Dynamic Device Allocation |
| 📄 Selenium Python Course |
📄 saucelabs Documentation Home |
📄 saucelabs Knowledge Base |
📄 saucelabs API Reference |
pipenvRequired- Set Environment Variables
SAUCE_USERNAMESAUCE_ACCESS_KEY
- Download Repo and Create virtualenv
# clone repo
git clone https://github.com/kmissoumi/demo-python.git && cd demo-python
# setup virtualenv
pipenv install
# enter virtualenv
pipenv shell
# optional info
python --version # Python 3.9.9
pipenv --version # pipenv, version 2021.11.23 The test suite referenced below has (5) tests.
- The format follows as this
B<NN>_S<NN>_D<NN>_C<NN>_J<NN>- Where
Nis a number. - Where
Bis the build prefix. - Where
Sis for the suite, andNis the number of cycles run. - Where
Dis for the device, andNis the number of devices requested. - Where
Jis for jobs, andNis the number of jobs submitted.
- Where
# Test 01
# Run the entire test suite, (5) tests, (1) cycle.
# Spread the tests out over (1) device.
export BUILD_TAG="B01_S01_D01_J05"
pytest best_practice/mobile_native/android --dc=us
# Test 02
# Run the entire test suite, (5) tests, , (1) cycle.
# Spread the tests out over (5) devices.
export BUILD_TAG="B02_S01_D05_C01_J05"
pytest best_practice/mobile_native/android --dc=us -n5Does a request for 5x devices result in 5x performance?
What if we don't use cacheId?
# Test 03
# Run every test in the entire test suite, (5) times in a row, for (5) full cycles.
# On the same (1) device.
export BUILD_TAG="B03_S05_D01_J25"
pytest best_practice/mobile_native/android --dc=us --count 5
# Test 04
# Run each test in the suite (5) times in a row.
# Spread the tests out over (5) devices.
# Tests are submitted to the first allocated device that is available.
export BUILD_TAG="B04_S10_D20_J25"
pytest best_practice/mobile_native/android --dc=us -n5 --count 5
# Test 05
# Run the entire test suite, (5) tests, (10) full cycles
# Spread the tests out over (10) devices.
export BUILD_TAG="B05_S10_D20_J50"
pytest best_practice/mobile_native/android --dc=us -n10 --count 10Explore other plugins such as pytest-parallel.
export BUILD_TAG="ZZ_S01_W05_J05"`
pytest best_practice/mobile_native/android --dc=us --workers 5`
Note: Only update the rdc_browser in best_practice/conftest.py
Suggestion: Only update one capability at a time for your first few reps.
Hint: Run multiple test suites on the same device with cacheId!
# specific device via id
caps = {
'deviceName': 'iPhone_12_POC137',
'platformName': 'iOS',
'cacheId': 'yogi'
}
# any iPhone from my private device pool
caps = {
'deviceName': 'iPhone.*',
'platformName': 'iOS',
'cacheId': 'booboo',
'privateDevicesOnly': True
}
# any iOS 15.x phone from the public device pool
caps = {
'deviceName': '.*',
'platformName': 'iOS',
'platformVersion': 15,
'phoneOnly': True,
'cacheId': 'cindy',
'publicDevicesOnly': True
}
# any Android 10 phone or tablet
caps = {
'deviceName': '*',
'platformName': 'Android',
'platformVersion': 10,
'cacheId': 'ranger'
}
- Documentation Home
- Demo Repos
- Source demo-python Repo and README file
- Support Central
- Knowledge Base Articles
- Sauce School Training Resources
- Videos & Webinars
- Data Sheets
- Papers & Reports
- Case Studies
- YouTube Channel
- API Reference
- CLi Reference
- Glossary of Sauce Labs Terminology
- Common Error Messages
- System Status & Maintenance Windows
- Platform Configurator
Per Session Device Cleanup Steps
- accounts and data cleared
- default browser history and user data removed
- non-default browsers uninstalled
- network settings reset
- device settings reset
- app uninstalled
- cached data deleted
- device de-allocated
