|
3 | 3 |
|
4 | 4 | [Cucumber JVM](https://cucumber.io/docs/reference/jvm) Integration with BrowserStack. |
5 | 5 |
|
6 | | -## Setup |
7 | | -* Clone the repo |
8 | | -* Install dependencies `mvn install` |
9 | | -* Set environment variables with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings). |
10 | | -* Update `*.conf.js` files inside the `src/test/resources/conf/` directory to update desired capabilities. |
| 6 | +## Using Maven |
11 | 7 |
|
12 | | -## Running your tests |
13 | | -* To run a single test, run `mvn test -P single` |
14 | | -* To run parallel tests, run `mvn test -P parallel` |
15 | | -* To run local tests, run `mvn test -P local` |
| 8 | +### Run sample build |
16 | 9 |
|
| 10 | +- Clone the repository |
| 11 | +- Install dependencies `mvn compile` |
| 12 | +- To run the test suite having cross-platform with parallelization, run `mvn test -P sample-test` |
| 13 | +- To run local tests, run `mvn test -P sample-local-test` |
17 | 14 |
|
| 15 | +Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github) |
| 16 | + |
| 17 | +### Integrate your test suite |
| 18 | + |
| 19 | +* Install dependencies `mvn compile` |
| 20 | +* Create sample browserstack.yml file with the browserstack related capabilities with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings) and place it in your root folder. |
| 21 | +* Add maven dependency of browserstack-java-sdk in your pom.xml file |
| 22 | +```sh |
| 23 | +<dependency> |
| 24 | + <groupId>com.browserstack</groupId> |
| 25 | + <artifactId>browserstack-java-sdk</artifactId> |
| 26 | + <version>LATEST</version> |
| 27 | + <scope>compile</scope> |
| 28 | +</dependency> |
| 29 | +``` |
| 30 | +* Modify your build plugin to run tests by adding argLine `-javaagent:${com.browserstack:browserstack-java-sdk:jar}` and `maven-dependency-plugin` for resolving dependencies in the profiles `sample-test` and `sample-local-test`. |
| 31 | +``` |
| 32 | + <plugin> |
| 33 | + <artifactId>maven-dependency-plugin</artifactId> |
| 34 | + <executions> |
| 35 | + <execution> |
| 36 | + <id>getClasspathFilenames</id> |
| 37 | + <goals> |
| 38 | + <goal>properties</goal> |
| 39 | + </goals> |
| 40 | + </execution> |
| 41 | + </executions> |
| 42 | + </plugin> |
| 43 | + <plugin> |
| 44 | + <groupId>org.apache.maven.plugins</groupId> |
| 45 | + <artifactId>maven-surefire-plugin</artifactId> |
| 46 | + <version>3.0.0-M5</version> |
| 47 | + <configuration> |
| 48 | + <suiteXmlFiles> |
| 49 | + <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile> |
| 50 | + </suiteXmlFiles> |
| 51 | + <argLine> |
| 52 | + -javaagent:${com.browserstack:browserstack-java-sdk:jar} |
| 53 | + </argLine> |
| 54 | + </configuration> |
| 55 | + </plugin> |
| 56 | +``` |
18 | 57 |
|
19 | 58 | ## Notes |
20 | 59 | * You can view your test results on the [BrowserStack Automate dashboard](https://www.browserstack.com/automate) |
|
0 commit comments