Skip to content

Patch 1 #28

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 64 commits into
base: java_ios
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
f727da4
Merge pull request #6 from browserstack/java_ios
tejasshah93 Sep 6, 2017
b651a88
remove local samples
Sep 17, 2017
26bcce6
Merge pull request #7 from browserstack/java_rm_local
tejasshah93 Sep 17, 2017
f2b96e2
use Android Driver Element instead of Selenium
Sep 21, 2017
2172119
Merge pull request #8 from browserstack/use_native
tejasshah93 Sep 22, 2017
d667cc8
add type to AndroidDriver
Sep 22, 2017
62af473
Merge pull request #9 from browserstack/use_native
tejasshah93 Sep 22, 2017
a32d46c
re-add local samples | update readme
Sep 22, 2017
3411a96
Merge pull request #10 from browserstack/use_native
tejasshah93 Sep 25, 2017
6a58a55
update sendKeys call
Oct 14, 2017
748b7a3
update condition | remove realMobile, automationName cap
Dec 12, 2017
5979031
Merge pull request #11 from browserstack/condition_caps
Dec 12, 2017
1924c16
Changes for new sample app
May 2, 2018
9543190
Merge pull request #12 from browserstack/new_sample_app
agundawar May 14, 2018
1bc5d60
New Maven project
kn-neeraj Aug 29, 2020
ee60227
Adding .DS_Store and IDE Settings to Git Ignore file
kn-neeraj Aug 29, 2020
9e93054
Adding Local script files
kn-neeraj Aug 29, 2020
70a6a4f
Update README.md
kn-neeraj Aug 29, 2020
e4dde43
Updating readme. Removing .classpath from gitignore
kn-neeraj Aug 31, 2020
b19e063
Updated pom to work from terminal
kn-neeraj Sep 1, 2020
39afd53
Bringing all files to the main folder
kn-neeraj Sep 1, 2020
97b8d8b
Adding mvn profiles for all the test scenarios
kn-neeraj Sep 1, 2020
399c107
Updated Readme
kn-neeraj Sep 1, 2020
788a1f8
Removing selenium dependency. Typo fix in Readme
kn-neeraj Sep 1, 2020
eda6352
Updating Local test for Android and iOS.
kn-neeraj Sep 24, 2020
f8ff5f5
Updating Readme with Local test
kn-neeraj Sep 24, 2020
9e698bc
Update README.md
kn-neeraj Sep 25, 2020
2673193
Update README.md
kn-neeraj Sep 25, 2020
c14a791
Updating class names according to QSG. Removing unwanted imports.
kn-neeraj Sep 26, 2020
d834fc4
Updating Readme
kn-neeraj Sep 26, 2020
3d232d6
Reverting to previous imports for android and ios sample tests
kn-neeraj Sep 30, 2020
60ecc20
changing 'capabilities' to 'caps'
kn-neeraj Oct 1, 2020
e7f7f02
Adding Access credentials URL for convenience.
kn-neeraj Oct 1, 2020
ef74b65
Merge pull request #13 from kn-neeraj/new_maven_project
agundawar Oct 7, 2020
db95171
Updated build names as per QIG
nitish-bhardwaj-code Sep 20, 2021
186d775
Merge pull request #16 from nitish-bhardwaj-code/update_build_name
deepwired Sep 29, 2021
3e7d33b
Added support for java-client 8.0.0
innovater21 Mar 10, 2022
10120bb
Updated java-client version to 8.0.0
innovater21 Mar 11, 2022
c1b2e32
added w3c capabilities
innovater21 Mar 11, 2022
15c4e05
added w3c capabilities
innovater21 Mar 11, 2022
8073b7f
Added w3c capabilities and support
innovater21 Mar 11, 2022
680d070
added support for w3c and upgrade
innovater21 Mar 11, 2022
5004519
removed deprecated syntax
innovater21 Mar 11, 2022
2a41e1d
added comment for w3c support
innovater21 Mar 16, 2022
9f20467
w3c compliant
innovater21 Mar 16, 2022
249f818
lint
innovater21 Mar 16, 2022
1316fea
Update README.md
innovater21 Mar 16, 2022
8931708
typo fix
innovater21 Mar 16, 2022
63478c0
Update README.md
innovater21 Mar 16, 2022
e2cf186
Update README.md
innovater21 Mar 16, 2022
f1cb725
Update README.md
innovater21 Mar 16, 2022
3cf22be
Updated README for initiating a local connection
innovater21 Mar 17, 2022
ecb8978
Added local testing link for local testing
innovater21 Mar 17, 2022
2f1f069
Merge pull request #18 from browserstack/AASI-812-support-java-client…
deepwired Mar 17, 2022
f2baa82
created dedicated directories for java7 and java8
deepwired May 10, 2022
7eb080f
updating readme.md file with links for java7 and java8
deepwired May 17, 2022
6b1f7cf
adding tab navigation for both java/protocol versions
deepwired May 17, 2022
92daf59
typo, missed a . in back links
deepwired May 17, 2022
07080f9
linking to repo instead of readme
deepwired May 17, 2022
b746aca
small content updates
deepwired May 17, 2022
dd073c2
updated ios device/os combo
deepwired May 25, 2022
8932035
iPhone 12 + iOS 13
deepwired May 26, 2022
e37aeb3
Merge pull request #20 from browserstack/java_versions
deepwired May 26, 2022
e9ea53a
Update BrowserStackSample.java
8ll Jan 30, 2023
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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.png
target/
local.log
.idea
*.iml
**/.DS_Store
**/.settings
.classpath
.project

11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
App Automate Java Samples
---------------------

This repository contains code for Automated Native App tests using Appium in Java. Please feel free to clone the repo and use the example code.

For frameworks integration with BrowserStack, refer to their individual repositories -

- [JUnit](https://github.com/browserstack/junit-appium-app-browserstack)
- [TestNg](https://github.com/browserstack/testng-appium-app-browserstack)
| [Using Java 7 client with MJSONWP protocol](./java_7) | [Using Java 8 client with w3c protocol](./java_8) |
|------------------------------------------------------ | ------------------------------------------------- |
39 changes: 0 additions & 39 deletions android/BrowserStackAndroid.java

This file was deleted.

74 changes: 0 additions & 74 deletions android/LocalSampleAndroid.java

This file was deleted.

16 changes: 0 additions & 16 deletions android/README.md

This file was deleted.

60 changes: 0 additions & 60 deletions ios/BrowserStackIOS.java

This file was deleted.

16 changes: 0 additions & 16 deletions ios/README.md

This file was deleted.

135 changes: 135 additions & 0 deletions java_7/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
| Using Java 7 client with MJSONWP protocol | [Using Java 8 client with w3c protocol](../java_8) |
|------------------------------------------ | -------------------------------------------------- |

# java-appium-app-browserstack

This repository demonstrates how to run Appium Java tests on BrowserStack App Automate.

## Setup

### Requirements

1. Java 8+ (JDK)

- 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, run the following command in the project's base folder

```cmd
mvn clean install
```

## Getting Started

Getting Started with Appium tests in Java on BrowserStack couldn't be easier!

### Run your first test :

**1. Upload your Android or iOS App**

Upload your Android app (.apk or .aab file) or iOS app (.ipa file) to BrowserStack servers using our REST API. Here is an example cURL request :

```
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@/path/to/apk/file"
```

Ensure that @ symbol is prepended to the file path in the above request. Please note the `app_url` value returned in the API response. We will use this to set the application under test while configuring the test later on.

**Note**: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our [sample Android app](https://www.browserstack.com/app-automate/sample-apps/android/WikipediaSample.apk) or [sample iOS app](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa).

**2. Configure and run your first test**

Open `BrowserStackSample.java` file in the `android` directory or `ios` directory :

- Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials. Get your BrowserStack access credentials from [here](https://www.browserstack.com/accounts/settings)

- Replace `bs://<app-id>` with the URL obtained from app upload step

- Set the device and OS version

- If you have uploaded your own app update the test case

- To run the test, use the following command in the base directory :

- For Android test, run

```cmd
mvn test -P android-first-test
```

- For iOS test, run

```cmd
mvn test -P ios-first-test
```

- You can access the test execution results, and debugging information such as video recording, network logs on [App Automate dashboard](https://app-automate.browserstack.com/dashboard)

---

### Use Local testing for apps that access resources hosted in development or testing environments :

**1. Upoad your Android or iOS App**

Upload your Android app (.apk or .aab file) or iOS app (.ipa file) that access resources hosted on your internal or test environments to BrowserStack servers using our REST API. Here is an example cURL request :

```
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@/path/to/apk/file"
```

Ensure that @ symbol is prepended to the file path in the above request. Please note the `app_url` value returned in the API response. We will use this to set the application under test while configuring the test later on.

**Note**: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our [sample Android Local app](https://www.browserstack.com/app-automate/sample-apps/android/LocalSample.apk) or [sample iOS Local app](https://www.browserstack.com/app-automate/sample-apps/ios/LocalSample.ipa).

**2. Configure and run your local test**

Open `BrowserStackSampleLocal.java` file in the `android` or `ios` directory :

- Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials. Get your BrowserStack access credentials from [here](https://www.browserstack.com/accounts/settings)

- Replace `bs://<app-id>` with the URL obtained from app upload step

- Set the device and OS version

- Ensure that `browserstack.local` capability is set to `true`. Within the test script, there is code snippet that automatically establishes Local Testing connection to BrowserStack servers using Java binding for BrowserStack Local.

- If you have uploaded your own app update the test case

- To run the test, use the following command in the base directory :

- For Android test, run

```cmd
mvn test -P android-local-test
```

- For iOS test, run

```cmd
mvn test -P ios-local-test
```

- You can access the test execution results, and debugging information such as video recording, network logs on [App Automate dashboard](https://app-automate.browserstack.com/dashboard)


## Integration with other Java frameworks

- [JUnit](https://github.com/browserstack/junit-appium-app-browserstack)
- [TestNg](https://github.com/browserstack/testng-appium-app-browserstack)

## 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).
Loading