Skip to content

Commit edd5e31

Browse files
Merge branch 'master' of https://github.com/browserstack/testng-browserstack into update_build_identifier
2 parents d4c5f6c + d794195 commit edd5e31

File tree

6 files changed

+126
-124
lines changed

6 files changed

+126
-124
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ This repository uses the BrowserStack SDK to run tests on BrowserStack. Follow t
5858
</plugin>
5959
```
6060
* Install dependencies `mvn compile`
61-
62-
## Using Gradle
61+
62+
## Using Gradle
63+
64+
### Prerequisites
65+
- If using Gradle, Java v9+ is required.
6366

6467
### Run sample build
6568

@@ -69,14 +72,14 @@ This repository uses the BrowserStack SDK to run tests on BrowserStack. Follow t
6972
- To run local tests, run `gradle sampleLocalTest`
7073

7174
Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github)
72-
73-
### Integrate your test suite
74-
75+
76+
### Integrate your test suite
77+
7578
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:
7679

7780
* Following are the changes required in `gradle.build` -
78-
* Add `compileOnly 'com.browserstack:browserstack-java-sdk:latest.release'` in dependencies
79-
* Fetch Artifact Information and add `jvmArgs` property in tasks *SampleTest* and *SampleLocalTest* :
81+
* Add `compileOnly 'com.browserstack:browserstack-java-sdk:latest.release'` in dependencies
82+
* Fetch Artifact Information and add `jvmArgs` property in tasks *SampleTest* and *SampleLocalTest* :
8083
```
8184
def browserstackSDKArtifact = configurations.compileClasspath.resolvedConfiguration.resolvedArtifacts.find { it.name == 'browserstack-java-sdk' }
8285
@@ -89,7 +92,7 @@ This repository uses the BrowserStack SDK to run tests on BrowserStack. Follow t
8992
}
9093
}
9194
```
92-
95+
9396
* Install dependencies `gradle build`
9497

9598

browserstack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ platforms:
5353
# 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
5454
parallelsPerPlatform: 1
5555

56-
source: testng:sample-sdk:v1.1
56+
source: testng:sample-master:v1.1
5757

5858
# ==========================================
5959
# BrowserStack Local

config/sample-local-test.testng.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
</classes>
88
</test>
99
</suite>
10+

pom.xml

Lines changed: 112 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,121 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2-
<modelVersion>4.0.0</modelVersion>
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
34

4-
<groupId>com.browserstack</groupId>
5-
<artifactId>testng-browserstack</artifactId>
6-
<version>1.0-SNAPSHOT</version>
7-
<packaging>jar</packaging>
5+
<groupId>com.browserstack</groupId>
6+
<artifactId>testng-browserstack</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
<packaging>jar</packaging>
89

9-
<name>testng-browserstack</name>
10-
<url>https://www.github.com/browserstack/testng-browserstack</url>
10+
<name>testng-browserstack</name>
11+
<url>https://www.github.com/browserstack/testng-browserstack</url>
1112

12-
<properties>
13-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14-
<maven.compiler.source>1.8</maven.compiler.source>
15-
<maven.compiler.target>1.8</maven.compiler.target>
16-
<testng.version>7.4.0</testng.version>
17-
<surefire.version>2.19.1</surefire.version>
18-
<selenium.version>4.1.4</selenium.version>
19-
<json-simple.version>1.1.1</json-simple.version>
20-
<config.file>config/sample-test.testng.xml</config.file>
21-
</properties>
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
<maven.compiler.source>1.8</maven.compiler.source>
16+
<maven.compiler.target>1.8</maven.compiler.target>
17+
<testng.version>7.4.0</testng.version>
18+
<surefire.version>2.19.1</surefire.version>
19+
<selenium.version>4.1.4</selenium.version>
20+
<json-simple.version>1.1.1</json-simple.version>
21+
<config.file>config/sample-test.testng.xml</config.file>
22+
</properties>
2223

23-
<dependencies>
24-
<dependency>
25-
<groupId>org.testng</groupId>
26-
<artifactId>testng</artifactId>
27-
<version>${testng.version}</version>
28-
</dependency>
29-
<dependency>
30-
<groupId>org.seleniumhq.selenium</groupId>
31-
<artifactId>selenium-java</artifactId>
32-
<version>${selenium.version}</version>
33-
</dependency>
34-
<dependency>
35-
<groupId>com.browserstack</groupId>
36-
<artifactId>browserstack-java-sdk</artifactId>
37-
<version>LATEST</version>
38-
<scope>compile</scope>
39-
</dependency>
40-
</dependencies>
24+
<dependencies>
25+
<dependency>
26+
<groupId>org.testng</groupId>
27+
<artifactId>testng</artifactId>
28+
<version>${testng.version}</version>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.seleniumhq.selenium</groupId>
32+
<artifactId>selenium-java</artifactId>
33+
<version>${selenium.version}</version>
34+
</dependency>
35+
<dependency>
36+
<groupId>com.browserstack</groupId>
37+
<artifactId>browserstack-java-sdk</artifactId>
38+
<version>LATEST</version>
39+
<scope>compile</scope>
40+
</dependency>
41+
</dependencies>
4142

42-
<build>
43-
<plugins>
44-
<plugin>
45-
<artifactId>maven-dependency-plugin</artifactId>
46-
<executions>
47-
<execution>
48-
<id>getClasspathFilenames</id>
49-
<goals>
50-
<goal>properties</goal>
51-
</goals>
52-
</execution>
53-
</executions>
54-
</plugin>
55-
<plugin>
56-
<groupId>org.apache.maven.plugins</groupId>
57-
<artifactId>maven-surefire-plugin</artifactId>
58-
<version>${surefire.version}</version>
59-
<configuration>
60-
<suiteXmlFiles>
61-
<suiteXmlFile>${config.file}</suiteXmlFile>
62-
</suiteXmlFiles>
63-
<argLine>
64-
-javaagent:${com.browserstack:browserstack-java-sdk:jar}
65-
</argLine>
66-
</configuration>
67-
</plugin>
68-
<plugin>
69-
<groupId>org.apache.maven.plugins</groupId>
70-
<artifactId>maven-compiler-plugin</artifactId>
71-
<configuration>
72-
<source>${maven.compiler.source}</source>
73-
<target>${maven.compiler.target}</target>
74-
</configuration>
75-
</plugin>
76-
</plugins>
77-
</build>
78-
79-
<profiles>
80-
<profile>
81-
<id>sample-local-test</id>
82-
<build>
43+
<build>
8344
<plugins>
84-
<plugin>
85-
<groupId>org.apache.maven.plugins</groupId>
86-
<artifactId>maven-surefire-plugin</artifactId>
87-
<configuration>
88-
<suiteXmlFiles>
89-
<suiteXmlFile>config/sample-local-test.testng.xml</suiteXmlFile>
90-
</suiteXmlFiles>
91-
<argLine>
92-
-javaagent:${com.browserstack:browserstack-java-sdk:jar}
93-
</argLine>
94-
</configuration>
95-
</plugin>
45+
<plugin>
46+
<artifactId>maven-dependency-plugin</artifactId>
47+
<executions>
48+
<execution>
49+
<id>getClasspathFilenames</id>
50+
<goals>
51+
<goal>properties</goal>
52+
</goals>
53+
</execution>
54+
</executions>
55+
</plugin>
56+
<plugin>
57+
<groupId>org.apache.maven.plugins</groupId>
58+
<artifactId>maven-surefire-plugin</artifactId>
59+
<version>${surefire.version}</version>
60+
<configuration>
61+
<suiteXmlFiles>
62+
<suiteXmlFile>${config.file}</suiteXmlFile>
63+
</suiteXmlFiles>
64+
<argLine>
65+
-javaagent:${com.browserstack:browserstack-java-sdk:jar}
66+
</argLine>
67+
</configuration>
68+
</plugin>
69+
<plugin>
70+
<groupId>org.apache.maven.plugins</groupId>
71+
<artifactId>maven-compiler-plugin</artifactId>
72+
<configuration>
73+
<source>${maven.compiler.source}</source>
74+
<target>${maven.compiler.target}</target>
75+
</configuration>
76+
</plugin>
9677
</plugins>
97-
</build>
98-
</profile>
78+
</build>
9979

100-
<profile>
101-
<id>sample-test</id>
102-
<build>
103-
<plugins>
104-
<plugin>
105-
<groupId>org.apache.maven.plugins</groupId>
106-
<artifactId>maven-surefire-plugin</artifactId>
107-
<configuration>
108-
<suiteXmlFiles>
109-
<suiteXmlFile>config/sample-test.testng.xml</suiteXmlFile>
110-
</suiteXmlFiles>
111-
<argLine>
112-
-javaagent:${com.browserstack:browserstack-java-sdk:jar}
113-
</argLine>
114-
</configuration>
115-
</plugin>
116-
</plugins>
117-
</build>
118-
</profile>
119-
</profiles>
80+
<profiles>
81+
<profile>
82+
<id>sample-local-test</id>
83+
<build>
84+
<plugins>
85+
<plugin>
86+
<groupId>org.apache.maven.plugins</groupId>
87+
<artifactId>maven-surefire-plugin</artifactId>
88+
<configuration>
89+
<suiteXmlFiles>
90+
<suiteXmlFile>config/sample-local-test.testng.xml</suiteXmlFile>
91+
</suiteXmlFiles>
92+
<argLine>
93+
-javaagent:${com.browserstack:browserstack-java-sdk:jar}
94+
</argLine>
95+
</configuration>
96+
</plugin>
97+
</plugins>
98+
</build>
99+
</profile>
100+
101+
<profile>
102+
<id>sample-test</id>
103+
<build>
104+
<plugins>
105+
<plugin>
106+
<groupId>org.apache.maven.plugins</groupId>
107+
<artifactId>maven-surefire-plugin</artifactId>
108+
<configuration>
109+
<suiteXmlFiles>
110+
<suiteXmlFile>config/sample-test.testng.xml</suiteXmlFile>
111+
</suiteXmlFiles>
112+
<argLine>
113+
-javaagent:${com.browserstack:browserstack-java-sdk:jar}
114+
</argLine>
115+
</configuration>
116+
</plugin>
117+
</plugins>
118+
</build>
119+
</profile>
120+
</profiles>
120121
</project>

src/test/java/com/browserstack/BStackDemoTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void addProductToCart() throws Exception {
2020
driver.findElement(By.xpath("//*[@id=\"1\"]/div[4]")).click();
2121

2222
// See if the cart is opened or not
23-
Assert.assertTrue(driver.findElement(By.className("float-cart__content")).isDisplayed());
23+
Assert.assertTrue(driver.findElement(By.cssSelector(".float\\-cart__content")).isDisplayed());
2424

2525
// Check the product inside the cart is same as of the main page
2626
String productOnCartText = driver.findElement(By.xpath("//*[@id=\"__next\"]/div/div/div[2]/div[2]/div[2]/div/div[3]/p[1]")).getText();

src/test/java/com/browserstack/SeleniumTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package com.browserstack;
22

3-
import java.net.URL;
4-
import java.util.HashMap;
5-
63
import org.testng.annotations.AfterMethod;
74
import org.testng.annotations.BeforeMethod;
85
import org.openqa.selenium.WebDriver;

0 commit comments

Comments
 (0)