Skip to content

Commit b53951c

Browse files
mattonemfrancisf
authored andcommitted
local execution test
1 parent 044043a commit b53951c

File tree

4 files changed

+13
-34
lines changed

4 files changed

+13
-34
lines changed

pom.xml

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
33
<modelVersion>4.0.0</modelVersion>
44

55
<groupId>com.browserstack</groupId>
@@ -18,6 +18,7 @@
1818
<surefire.version>2.19.1</surefire.version>
1919
<selenium.version>4.1.4</selenium.version>
2020
<json-simple.version>1.1.1</json-simple.version>
21+
<surefire.plugin.version>3.0.0-M5</surefire.plugin.version>
2122
<config.file>config/sample-local-test.testng.xml</config.file>
2223
</properties>
2324

@@ -32,12 +33,6 @@
3233
<artifactId>selenium-java</artifactId>
3334
<version>${selenium.version}</version>
3435
</dependency>
35-
<dependency>
36-
<groupId>com.browserstack</groupId>
37-
<artifactId>browserstack-java-sdk</artifactId>
38-
<version>LATEST</version>
39-
<scope>compile</scope>
40-
</dependency>
4136
</dependencies>
4237

4338
<build>
@@ -57,14 +52,7 @@
5752
<groupId>org.apache.maven.plugins</groupId>
5853
<artifactId>maven-surefire-plugin</artifactId>
5954
<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>
55+
6856
</plugin>
6957
<plugin>
7058
<groupId>org.apache.maven.plugins</groupId>
@@ -89,9 +77,6 @@
8977
<suiteXmlFiles>
9078
<suiteXmlFile>config/sample-local-test.testng.xml</suiteXmlFile>
9179
</suiteXmlFiles>
92-
<argLine>
93-
-javaagent:${com.browserstack:browserstack-java-sdk:jar}
94-
</argLine>
9580
</configuration>
9681
</plugin>
9782
</plugins>
@@ -109,9 +94,7 @@
10994
<suiteXmlFiles>
11095
<suiteXmlFile>config/sample-test.testng.xml</suiteXmlFile>
11196
</suiteXmlFiles>
112-
<argLine>
113-
-javaagent:${com.browserstack:browserstack-java-sdk:jar}
114-
</argLine>
97+
11598
</configuration>
11699
</plugin>
117100
</plugins>

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

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

3-
import com.browserstack.BrowserStackRemoteTest;
3+
import com.browserstack.SeleniumTest;
44
import org.openqa.selenium.By;
55
import org.testng.Assert;
66
import org.testng.annotations.Test;
77

8-
public class BStackDemoTest extends BrowserStackRemoteTest {
8+
public class BStackDemoTest extends SeleniumTest {
99
@Test
1010
public void addProductToCart() throws Exception {
1111
// navigate to bstackdemo

src/test/java/com/browserstack/LocalTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.testng.Assert;
44
import org.testng.annotations.Test;
55

6-
public class LocalTest extends BrowserStackRemoteTest {
6+
public class LocalTest extends SeleniumTest {
77

88
@Test
99
public void test() throws Exception {

src/test/java/com/browserstack/BrowserStackRemoteTest.java renamed to src/test/java/com/browserstack/SeleniumTest.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,20 @@
88
import org.openqa.selenium.remote.RemoteWebDriver;
99
import org.testng.annotations.AfterMethod;
1010
import org.testng.annotations.BeforeMethod;
11+
import org.openqa.selenium.WebDriver;
12+
import org.openqa.selenium.chrome.ChromeDriver;
1113

12-
public class BrowserStackRemoteTest {
14+
public class SeleniumTest {
1315
public WebDriver driver;
1416

1517
@BeforeMethod(alwaysRun = true)
1618
@SuppressWarnings("unchecked")
1719
public void setUp() throws Exception {
18-
MutableCapabilities capabilities = new MutableCapabilities();
19-
HashMap<String, String> bstackOptionsMap = new HashMap<String, String>();
20-
bstackOptionsMap.put("source", "testng:sample-sdk:v1.0");
21-
capabilities.setCapability("bstack:options", bstackOptionsMap);
22-
driver = new RemoteWebDriver(
23-
new URL("https://hub.browserstack.com/wd/hub"), capabilities);
24-
}
20+
driver = new ChromeDriver();
21+
}
2522

2623
@AfterMethod(alwaysRun = true)
2724
public void tearDown() throws Exception {
2825
driver.quit();
2926
}
3027
}
31-

0 commit comments

Comments
 (0)