|
6 | 6 |
|
7 | 7 | <a href="http://selenide.org/"><img src ="http://selenide.org/images/selenide-logo-big.png" height = "110"></a> |
8 | 8 |
|
9 | | -## Setup |
| 9 | +## Using Maven |
| 10 | + |
| 11 | +### Setup |
10 | 12 |
|
11 | 13 | * Clone the repo |
12 | 14 | * Install dependencies `mvn compile` |
13 | 15 | * Update `browserstack.yml` files at the root directory with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings) |
14 | 16 |
|
15 | | -## Running your tests |
| 17 | +### Running your tests |
16 | 18 |
|
17 | 19 | - To run a parallel tests, run `mvn test -P sample-test` |
18 | 20 | - To run local tests, run `mvn test -P sample-local-test` |
19 | 21 | - To run a full suite of tests with Cross-browser Testing, run `mvn test -P suite` |
20 | 22 |
|
21 | 23 | Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github) |
22 | 24 |
|
| 25 | +## Using Gradle |
| 26 | + |
| 27 | +### Prerequisites |
| 28 | +- If using Gradle, Java v9+ is required. |
| 29 | + |
| 30 | +### Setup |
| 31 | + |
| 32 | +- Clone the repository |
| 33 | +- Install dependencies `gradle build` |
| 34 | +- Update `browserstack.yml` files at the root directory with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings) |
| 35 | + |
| 36 | +### Run sample build |
| 37 | + |
| 38 | +- To run the test suite having cross-platform with parallelization, run `gradle sampleTest` |
| 39 | +- To run local tests, run `gradle sampleLocalTest` |
| 40 | + |
| 41 | +Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github) |
| 42 | + |
| 43 | +### Integrate your test suite |
| 44 | + |
| 45 | +This repository uses the BrowserStack SDK to run tests on BrowserStack. Follow the steps below to install the SDK in your test suite and run tests on BrowserStack: |
| 46 | + |
| 47 | +* Following are the changes required in `build.gradle` - |
| 48 | + * Add `implementation 'com.browserstack:browserstack-java-sdk:latest.release'` in dependencies |
| 49 | + * Fetch Artifact Information and add `jvmArgs` property in tasks *SampleTest* and *SampleLocalTest* : |
| 50 | + ``` |
| 51 | + def browserstackSDKArtifact = configurations.compileClasspath.resolvedConfiguration.resolvedArtifacts.find { it.name == 'browserstack-java-sdk' } |
| 52 | + |
| 53 | + task sampleTest(type: Test) { |
| 54 | + useTestNG() { |
| 55 | + dependsOn cleanTest |
| 56 | + useDefaultListeners = true |
| 57 | + suites "config/sample.testng.xml" |
| 58 | + jvmArgs "-javaagent:${browserstackSDKArtifact.file}" |
| 59 | + } |
| 60 | + } |
| 61 | + ``` |
| 62 | + |
| 63 | +* Install dependencies `gradle build` |
| 64 | + |
23 | 65 | ## Notes |
24 | 66 | * You can view your test results on the [BrowserStack Automate dashboard](https://www.browserstack.com/automate) |
25 | 67 | * To test on a different set of browsers, check out our [platform configurator](https://www.browserstack.com/automate/java#setting-os-and-browser) |
|
0 commit comments