Skip to content

Add threadlocal driver #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github/workflows/*.yml @browserstack/asi-devs
5 changes: 5 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### How to run tests?
- Before running tests please take master merge in the PR
- Comment RUN_TESTS to run maven tests

Note: Tests will also be triggered when PR is opened or reopened
43 changes: 43 additions & 0 deletions .github/workflows/comment-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This job is to test different maven profiles in sdk branch again Pull Request raised
# This workflow targets Java with Maven execution

name: TestNG SDK Test workflow for Maven on comment RUN_TESTS

on:
issue_comment:
types: [ created, edited ]

jobs:
comment-run:
if: contains(github.event.comment.body, 'RUN_TESTS')
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
max-parallel: 3
matrix:
java: [ '8', '11', '17' ]
os: [ 'macos-latest', 'windows-latest', 'ubuntu-latest' ]
name: TestNG Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}

steps:
- uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Run mvn test
run: |
mvn compile
mvn test
- name: Run mvn profile sample-local-test
run: |
mvn compile
mvn test -P sample-local-test
- name: Run mvn profile sample-test
run: |
mvn compile
mvn test -P sample-test
43 changes: 43 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This job is to test different maven profiles in sdk branch again Pull Request raised
# This workflow targets Java with Maven execution

name: TestNG SDK Test workflow for Maven

on:
pull_request:
branches: [ "master", "sdk" ]
types: [ opened, reopened ]

jobs:
maven-run:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
max-parallel: 3
matrix:
java: [ '8', '11', '17' ]
os: [ 'macos-latest', 'windows-latest', 'ubuntu-latest' ]
name: TestNG Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}

steps:
- uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Run mvn test
run: |
mvn compile
mvn test
- name: Run mvn profile sample-local-test
run: |
mvn compile
mvn test -P sample-local-test
- name: Run mvn profile sample-test
run: |
mvn compile
mvn test -P sample-test
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
- Clone the repository
- Replace YOUR_USERNAME and YOUR_ACCESS_KEY with your BrowserStack access credentials in browserstack.yml.
- Install dependencies `mvn compile`
- To run the test suite having cross-platform with parallelization, run `mvn test -P sample-test`
- To run local tests, run `mvn test -P sample-local-test`
- To run the test suite with local webdriver, run `mvn test -P skip-browserstack-test`
- To run the test suite having cross-platform with parallelization on browserstack, run `mvn test -P sample-test`
- To run local (privately hosted websites) tests on browserstack, run `mvn test -P sample-local-test`

Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github)

Expand Down Expand Up @@ -68,8 +69,9 @@ This repository uses the BrowserStack SDK to run tests on BrowserStack. Follow t

- Clone the repository
- Install dependencies `gradle build`
- To run the test suite having cross-platform with parallelization, run `gradle sampleTest`
- To run local tests, run `gradle sampleLocalTest`
- To run the test suite with local webdriver, run `gradle skipBrowserstackTest`
- To run the test suite having cross-platform with parallelization on browserstack, run `gradle sampleTest`
- To run local (privately hosted websites) tests on browserstack, run `gradle sampleLocalTest`

Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github)

Expand Down
14 changes: 12 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ repositories { mavenCentral() }

dependencies {
implementation 'org.testng:testng:7.4.0'
implementation 'commons-io:commons-io:1.3.2'
implementation 'commons-io:commons-io:2.11.0'
implementation 'org.seleniumhq.selenium:selenium-java:4.1.4'
implementation 'com.browserstack:browserstack-local-java:1.0.6'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'io.github.bonigarcia:webdrivermanager:5.3.0'
compileOnly 'com.browserstack:browserstack-java-sdk:latest.release'
}

Expand All @@ -24,6 +24,16 @@ tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

task skipBrowserstackTest(type: Test) {
useTestNG() {
environment = [ 'BROWSERSTACK_AUTOMATION': 'false' ]
dependsOn cleanTest
useDefaultListeners = true
suites "config/sample-test.testng.xml"
jvmArgs "-javaagent:${browserstackSDKArtifact.file}"
}
}

task sampleTest(type: Test) {
useTestNG() {
dependsOn cleanTest
Expand Down
Loading