-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from browserstack/SDKAD-153-cucumber-java-sampl…
…e-repo Initial commit
- Loading branch information
Showing
21 changed files
with
912 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# This job is to test different maven profiles in sdk branch again Pull Request raised | ||
# This workflow targets Java with Maven execution | ||
|
||
name: Java SDK Test workflow for Maven on workflow_dispatch | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
commit_sha: | ||
description: 'The full commit id to build' | ||
required: true | ||
|
||
jobs: | ||
comment-run: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 3 | ||
matrix: | ||
java: [ '8', '11', '17' ] | ||
os: [ 'macos-latest', 'windows-latest', 'ubuntu-latest' ] | ||
name: Cucumber Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample | ||
env: | ||
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | ||
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.commit_sha }} | ||
- uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 | ||
id: status-check-in-progress | ||
env: | ||
job_name: Cucumber Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample | ||
commit_sha: ${{ github.event.inputs.commit_sha }} | ||
with: | ||
github-token: ${{ github.token }} | ||
script: | | ||
const result = await github.rest.checks.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
name: process.env.job_name, | ||
head_sha: process.env.commit_sha, | ||
status: 'in_progress' | ||
}).catch((err) => ({status: err.status, response: err.response})); | ||
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) | ||
if (result.status !== 201) { | ||
console.log('Failed to create check run') | ||
} | ||
- name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ matrix.java }} | ||
- name: Run android mvn test | ||
run: | | ||
cd android | ||
mvn compile | ||
mvn test | ||
- name: Run android mvn profile sample-local-test | ||
run: | | ||
cd android | ||
mvn compile | ||
mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.apk" | ||
- name: Run android mvn profile sample-test | ||
run: | | ||
cd android | ||
mvn compile | ||
mvn test -P sample-test | ||
- name: Run ios mvn test | ||
run: | | ||
cd ios | ||
mvn compile | ||
mvn test | ||
- name: Run ios mvn profile sample-local-test | ||
run: | | ||
cd ios | ||
mvn compile | ||
mvn test -P sample-local-test -D"browserstack.app"="./LocalSample.ipa" | ||
- name: Run ios mvn profile sample-test | ||
run: | | ||
cd ios | ||
mvn compile | ||
mvn test -P sample-test | ||
- if: always() | ||
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 | ||
id: status-check-completed | ||
env: | ||
conclusion: ${{ job.status }} | ||
job_name: Cucumber Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample | ||
commit_sha: ${{ github.event.inputs.commit_sha }} | ||
with: | ||
github-token: ${{ github.token }} | ||
script: | | ||
const result = await github.rest.checks.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
name: process.env.job_name, | ||
head_sha: process.env.commit_sha, | ||
status: 'completed', | ||
conclusion: process.env.conclusion | ||
}).catch((err) => ({status: err.status, response: err.response})); | ||
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) | ||
if (result.status !== 201) { | ||
console.log('Failed to create check run') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.png | ||
target/ | ||
local.log | ||
.idea | ||
*.iml | ||
.DS_Store | ||
**/logs/* | ||
reports/ | ||
logs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,69 @@ | ||
# cucumber-java-appium-app-browserstack | ||
This repository demonstrates how to run Appium tests in Cucumber Java on BrowserStack App Automate. | ||
|
||
This repository demonstrates how to run Appium tests in Cucumber Testng on BrowserStack App Automate using BrowserStack SDK. | ||
|
||
![BrowserStack Logo](https://d98b8t1nnulk5.cloudfront.net/production/images/layout/logo-header.png?1469004780) | ||
|
||
## Setup | ||
|
||
### Requirements | ||
|
||
1. Java 8+ | ||
|
||
- If Java is not installed, follow these instructions: | ||
- For Windows, download latest java version from [here](https://java.com/en/download/) and run the installer executable | ||
- For Mac and Linux, run `java -version` to see what java version is pre-installed. If you want a different version download from [here](https://java.com/en/download/) | ||
|
||
2. Maven | ||
- If Maven is not downloaded, download it from [here](https://maven.apache.org/download.cgi) | ||
- For installation, follow the instructions [here](https://maven.apache.org/install.html) | ||
|
||
### Install the dependencies | ||
|
||
To install the dependencies for Android tests, run : | ||
```sh | ||
cd android/ | ||
mvn clean | ||
``` | ||
|
||
Or, | ||
|
||
To install the dependencies for iOS tests, run : | ||
|
||
```sh | ||
cd ios/ | ||
mvn clean | ||
``` | ||
|
||
## Getting Started | ||
|
||
Getting Started with Appium tests in Cucumber TestNg on BrowserStack couldn't be easier! | ||
|
||
### **Run Sample test :** | ||
|
||
- Switch to one of the following directories: [Android examples](android) or [iOS examples](ios) | ||
- Run the following maven command `mvn test -P sample-test` | ||
|
||
### **Use Local testing for apps that access resources hosted in development or testing environments :** | ||
|
||
- Simply configure the `browserstackLocal` parameter in the `browserstack.yml` file accordingly in [Android examples](android) or [iOS examples](ios). | ||
``` | ||
browserstackLocal: true | ||
``` | ||
- You can use the `LocalSample` app provided in both folder [Android examples](android) or [iOS examples](ios) to run your test. Change the app parameter in the `browserstack.yml` file and run the tests with the following command: `mvn test -P sample-local-test` | ||
|
||
|
||
**Note**: If you are facing any issues, refer [Getting Help section](#Getting-Help) | ||
|
||
## Integration with other Java frameworks | ||
|
||
For other Java frameworks samples, refer to following repositories : | ||
|
||
- [JUnit](https://github.com/browserstack/junit-appium-app-browserstack) | ||
- [Java](https://github.com/browserstack/java-appium-app-browserstack) | ||
|
||
Note: For other test frameworks supported by App-Automate refer our [Developer documentation](https://www.browserstack.com/docs/) | ||
|
||
## Getting Help | ||
|
||
If you are running into any issues or have any queries, please check [Browserstack Support page](https://www.browserstack.com/support/app-automate) or [get in touch with us](https://www.browserstack.com/contact?ref=help). |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# ============================= | ||
# Set BrowserStack Credentials | ||
# ============================= | ||
# Add your BrowserStack userName and acccessKey here or set BROWSERSTACK_USERNAME and | ||
# BROWSERSTACK_ACCESS_KEY as env variables | ||
userName: BROWSERSTACK_USERNAME | ||
accessKey: BROWSERSTACK_ACCESS_KEY | ||
|
||
# ====================== | ||
# 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: BrowserStack Samples | ||
# 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: cucumber-testng | ||
|
||
source: cucumber-java:appium-sample-main:v1.0 | ||
|
||
app: ./WikipediaSample.apk | ||
# app: ./LocalSample.apk #For running local tests | ||
|
||
# ======================================= | ||
# 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: | ||
- deviceName: Samsung Galaxy S22 Ultra | ||
platformVersion: 12.0 | ||
platformName: android | ||
- deviceName: Samsung Galaxy S21 | ||
platformVersion: 11.0 | ||
platformName: android | ||
- deviceName: Google Pixel 6 Pro | ||
platformVersion: 12.0 | ||
platformName: android | ||
|
||
# ======================= | ||
# 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: true # <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 |
Oops, something went wrong.