passionatedevtester / pyunit-selenium-sample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to LambdaTest Logo - Python-UnitTest-Selenium Sample


Step 1 : Environment Setup

Lambdatest Credentials

Set LambdaTest username and access key in environment variables in the file lamdatest.env

Replace the values with your credentials, you can find them at (https://www.lambdatest.com/capabilities-generator/)

ln 1: export LT_USERNAME="Your Username"
ln 2: export LT_ACCESS_KEY="Your Access key"

Lamdatest Credentials

After your save your credentials at lambdatest.env please run the command:

$ source lambdatest.env

Step 2: Setting up your test capabilites

You can genegate the test capabilites at (https://www.lambdatest.com/capabilities-generator/) and choose Python as the language.

Now, can setup the capabilites of the test in the single_test.py file at:

ln 13: desired_caps = {
ln 14:           "build": 'PyunitTest sample build',
ln 15:            "name": 'Py-unittest',
ln 16:           "platform": 'OS X El Capitan',
ln 17:            "browserName": 'chrome',
ln 18:           "version": '81.0',
ln 19:           "console": 'true',
ln 20:           "network":'true'
ln 21:        }

You can setup the capabilites of your test in the parallel_test.py file at:

browsers = [
    {"build": 'PyunitTest sample build',"name": "Test 1", "platform": "Windows 10","browserName": "Chrome", "version": "86.0"},
    {"build": 'PyunitTest sample build',"name": "Test 2", "platform": "Windows 10","browserName": "Firefox", "version": "82.0"}
]

Step 3: Running Tests

To start a single test Run following command:

$ python single_test.py 

To start a parallel test Run the following command:

$ python parallel_test.py

About LambdaTest

LambdaTest is a cloud based selenium grid infrastructure that can help you run automated cross browser compatibility tests on 2000+ different browser and operating system environments. LambdaTest supports all programming languages and frameworks that are supported with Selenium, and have easy integrations with all popular CI/CD platforms. It's a perfect solution to bring your selenium automation testing to cloud based infrastructure that not only helps you increase your test coverage over multiple desktop and mobile browsers, but also allows you to cut down your test execution time by running tests on parallel.

For further References

About


Languages

Language:Python 97.2%Language:Shell 2.8%