Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 11 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ This repository contains the following Cucumber tests:
| User | Login as User with no image loaded | This test verifies that the product images load for user: "image_not_loading_user" on the e-commerce application. Since the images do not load, the test case assertion fails. | user |
| User | Login as User with existing Orders | This test verifies that existing orders are shown for user: "existing_orders_user" | user |

---
## Configuring the maximum parallel test threads for this repository

For all the parallel run configuration profiles, you can configure the maximum parallel test threads by changing the number of workers in [pavement.py](pavement.py)

```py
... pytest -s src/test/suites/e2e.py --driver Browserstack -n 2
```

eg: Using `-n 2` will execute `2` tests in parallel per environment configuration that has been passed in the capabilities

---
# On Premise

This infrastructure points to running the tests on your own machine using a browser (e.g. Chrome) using the browser's driver executables (e.g. ChromeDriver for Chrome). Selenium enables this functionality using WebDriver for many popular browsers.
Expand All @@ -58,7 +46,7 @@ Note: The ChromeDriver version must match the Chrome browser version on your mac
To run the entire test suite on your own machine, use the following command:

```sh
paver run single on-prem
pytest -s src/test/suites/*.py --driver Chrome --driver-path src/driver/chromedriver
```

- Output
Expand Down Expand Up @@ -89,29 +77,25 @@ Note: The ChromeDriver version must match the Chrome browser version on your mac
set BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
```

Alternatively, you can also hardcode username and access_key objects in the [single.json](src/resources/single.json) file, [parallel.json](src/resources/parallel.json) and [local.json](src/resources/local.json).

Note:

- The exact test capability values can be easily identified using the [Browserstack Capability Generator](https://browserstack.com/automate/capabilities)
Alternatively, you can also hardcode username and access_key objects in the browserstack.yml file,

## Running Your Tests

### Run the entire test suite in parallel on a single BrowserStack browser
### Run the entire test suite in parallel on a BrowserStack browser

In this section, we will run the tests in parallel on a single browser on Browserstack.
In this section, we will run the tests in parallel on a browser on Browserstack.

- How to run the test?

To run the entire test suite in parallel on a single BrowserStack browser, use the following command:
To run the entire test suite in parallel on a BrowserStack browser, use the following command:

```sh
paver run single remote
browserstack-sdk pytest -s src/test/suites/*.py --browserstack.config ./src/conf/browserstack_single.yml
```

- Output

This run profile executes the entire test suite in parallel on a single BrowserStack browser. Please refer to your [BrowserStack dashboard](https://automate.browserstack.com/) for test results.
This run profile executes the entire test suite in parallel on a BrowserStack browser. Please refer to your [BrowserStack dashboard](https://automate.browserstack.com/) for test results.

### Run the entire test suite in parallel on multiple BrowserStack browsers

Expand All @@ -122,7 +106,7 @@ In this section, we will run the tests in parallel on multiple browsers on Brows
To run the entire test suite in parallel on multiple BrowserStack browsers, use the following command:

```sh
paver run parallel remote
browserstack-sdk pytest -s src/test/suites/*.py --browserstack.config ./src/conf/browserstack_parallel.yml
```
### [Web application hosted on internal environment] Running your tests on BrowserStack using BrowserStackLocal

Expand All @@ -133,7 +117,7 @@ In this section, we will run the tests in parallel on multiple browsers on Brows
git clone https://github.com/browserstack/browserstack-demo-app
```
- Please follow the README.md on the BrowserStack demo application repository to install and start the dev server on localhost.
- In this section, we will run a single test case to test the BrowserStack Demo app hosted on your local machine i.e. localhost. Refer to the `browserstack.local` object in `nightwatch-browserstack.conf.js` file to change test capabilities for this configuration.
- In this section, we will run a single test case to test the BrowserStack Demo app hosted on your local machine i.e. localhost.
- Note: You may need to provide additional BrowserStackLocal arguments to successfully connect your localhost environment with BrowserStack infrastructure. (e.g if you are behind firewalls, proxy or VPN).
- Further details for successfully creating a BrowserStackLocal connection can be found here:

Expand All @@ -143,10 +127,10 @@ In this section, we will run the tests in parallel on multiple browsers on Brows

- How to run the test?

- To run the default test scenario (e.g. End to End Scenario) on a single BrowserStack browser using BrowserStackLocal, use the following command:
- To run the default test scenario (e.g. End to End Scenario) on a single BrowserStack browser using BrowserStackLocal, update the 'browserstackLocal' in the browserstack.yml file & use the following command:

```sh
paver run local remote
LOCAL=True browserstack-sdk pytest -s src/test/suites/*.py --browserstack.config ./src/conf/browserstack_local.yml
```

- Output
Expand Down
68 changes: 68 additions & 0 deletions browserstack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# =============================
# Set BrowserStack Credentials
# =============================
# Add your BrowserStack userName and accessKey here or set BROWSERSTACK_USERNAME and
# BROWSERSTACK_ACCESS_KEY as env variables
userName:
accessKey:

# ======================
# BrowserStack Reporting
# ======================
# The following capabilities are used to set up reporting on BrowserStack:
# Set 'projectName' to the name of your project. Example, Marketing Website
projectName: POC Test
# Set `buildName` as the name of the job / testsuite being run
buildName: browserstack build
# `buildIdentifier` is a unique id to differentiate every execution that gets appended to
# buildName. Choose your buildIdentifier format from the available expressions:
# ${BUILD_NUMBER} (Default): Generates an incremental counter with every execution
# ${DATE_TIME}: Generates a Timestamp with every execution. Eg. 05-Nov-19:30
# Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests
buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression}
# Set `framework` of your test suite. Example, `testng`, `cucumber`, `cucumber-testng`
# This property is needed to send test context to BrowserStack (test name, status)
framework: pytest

# =======================================
# Platforms (Browsers / Devices to test)
# =======================================
# Platforms object contains all the browser / device combinations you want to test on.
# Entire list available here -> (https://www.browserstack.com/list-of-browsers-and-platforms/automate)
platforms:
- os: OS X
osVersion: Big Sur
browserName: Chrome
browserVersion: latest

# =======================
# Parallels per Platform
# =======================
# The number of parallel threads to be used for each platform set.
# BrowserStack's SDK runner will select the best strategy based on the configured value
#
# Example 1 - If you have configured 3 platforms and set `parallelsPerPlatform` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack
#
# Example 2 - If you have configured 1 platform and set `parallelsPerPlatform` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack
parallelsPerPlatform: 1

# ==========================================
# BrowserStack Local
# (For localhost, staging/private websites)
# ==========================================
# Set browserStackLocal to true if your website under test is not accessible publicly over the internet
# Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction
browserstackLocal: false # <boolean> (Default false)
# browserStackLocalOptions:
# Options to be passed to BrowserStack local in-case of advanced configurations
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
# forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections

# ===================
# Debugging features
# ===================
debug: false # <boolean> # Set to true if you need screenshots for every selenium command ran
networkLogs: false # <boolean> Set to true to enable HAR logs capturing
consoleLogs: errors # <string> Remote browser's console debug levels to be printed (Default: errors)
# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors)
62 changes: 0 additions & 62 deletions conftest.py

This file was deleted.

52 changes: 0 additions & 52 deletions pavement.py

This file was deleted.

2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
pythonpath = .
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
browserstack-local
browserstack-sdk
jsonmerge
multiprocess
paver
Expand Down
25 changes: 0 additions & 25 deletions resources/local.json

This file was deleted.

61 changes: 0 additions & 61 deletions resources/parallel.json

This file was deleted.

Loading