Skip to content

Commit 7281807

Browse files
addressed comment
1 parent 34bf438 commit 7281807

File tree

23 files changed

+45
-57
lines changed

23 files changed

+45
-57
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Getting Started with Appium tests in TestNg on BrowserStack couldn't be easier!
9797
- If you do not have an local .apk file and looking to simply try local for App Automate, [you can download our sample local app and upload](https://www.browserstack.com/app-automate/sample-apps/android/LocalSample.apk)
9898
to the BrowserStack servers using the same app upload API.
9999
100-
- Switch to `run-local-test` directory under [Android examples](android/testng-examples/) or [iOS examples](ios/testng-examples/)
100+
- Switch to `run_local_test` directory under [Android examples](android/testng-examples/) or [iOS examples](ios/testng-examples/)
101101
- Then run
102102
```sh
103103
mvn test -P local

android/testng-examples/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<artifactId>maven-surefire-plugin</artifactId>
8181
<configuration>
8282
<suiteXmlFiles>
83-
<suiteXmlFile>src/test/resources/com/browserstack/run_first_test/first.testing.xml</suiteXmlFile>
83+
<suiteXmlFile>src/test/resources/com/browserstack/run_first_test/first.testng.xml</suiteXmlFile>
8484
</suiteXmlFiles>
8585
</configuration>
8686
</plugin>
@@ -97,7 +97,7 @@
9797
<artifactId>maven-surefire-plugin</artifactId>
9898
<configuration>
9999
<suiteXmlFiles>
100-
<suiteXmlFile>src/test/resources/com/browserstack/run_local_test/local.testing.xml</suiteXmlFile>
100+
<suiteXmlFile>src/test/resources/com/browserstack/run_local_test/local.testng.xml</suiteXmlFile>
101101
</suiteXmlFiles>
102102
</configuration>
103103
</plugin>
@@ -114,7 +114,7 @@
114114
<artifactId>maven-surefire-plugin</artifactId>
115115
<configuration>
116116
<suiteXmlFiles>
117-
<suiteXmlFile>src/test/resources/com/browserstack/run_parallel_test/parallel.testing.xml</suiteXmlFile>
117+
<suiteXmlFile>src/test/resources/com/browserstack/run_parallel_test/parallel.testng.xml</suiteXmlFile>
118118
</suiteXmlFiles>
119119
</configuration>
120120
</plugin>

android/testng-examples/src/test/java/com/browserstack/run_first_test/BrowserStackTestNGTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.net.URL;
44
import java.util.Map;
5-
import java.util.HashMap;
65
import java.util.Iterator;
76
import java.io.FileReader;
87
import org.json.simple.JSONObject;
@@ -16,7 +15,6 @@
1615

1716
import org.testng.annotations.BeforeMethod;
1817
import org.testng.annotations.AfterMethod;
19-
import org.testng.annotations.Parameters;
2018

2119

2220
public class BrowserStackTestNGTest {
@@ -48,12 +46,12 @@ public void setUp() throws Exception {
4846

4947
String username = System.getenv("BROWSERSTACK_USERNAME");
5048
if(username == null) {
51-
username = (String) config.get("user");
49+
username = (String) config.get("username");
5250
}
5351

5452
String accessKey = System.getenv("BROWSERSTACK_ACCESS_KEY");
5553
if(accessKey == null) {
56-
accessKey = (String) config.get("key");
54+
accessKey = (String) config.get("access_key");
5755
}
5856

5957
String app = System.getenv("BROWSERSTACK_APP_ID");

android/testng-examples/src/test/java/com/browserstack/run_local_test/BrowserStackTestNGTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717

1818
import org.testng.annotations.BeforeMethod;
1919
import org.testng.annotations.AfterMethod;
20-
import org.testng.annotations.Parameters;
2120

2221

2322
public class BrowserStackTestNGTest {
2423
public AndroidDriver<AndroidElement> driver;
25-
private Local l;
24+
private Local local;
2625

2726
@BeforeMethod(alwaysRun=true)
2827
public void setUp() throws Exception {
@@ -50,12 +49,12 @@ public void setUp() throws Exception {
5049

5150
String username = System.getenv("BROWSERSTACK_USERNAME");
5251
if(username == null) {
53-
username = (String) config.get("user");
52+
username = (String) config.get("username");
5453
}
5554

5655
String accessKey = System.getenv("BROWSERSTACK_ACCESS_KEY");
5756
if(accessKey == null) {
58-
accessKey = (String) config.get("key");
57+
accessKey = (String) config.get("access_key");
5958
}
6059

6160
String app = System.getenv("BROWSERSTACK_APP_ID");
@@ -64,10 +63,10 @@ public void setUp() throws Exception {
6463
}
6564

6665
if(capabilities.getCapability("browserstack.local") != null && capabilities.getCapability("browserstack.local") == "true"){
67-
l = new Local();
66+
local = new Local();
6867
Map<String, String> options = new HashMap<String, String>();
6968
options.put("key", accessKey);
70-
l.start(options);
69+
local.start(options);
7170
}
7271

7372
driver = new AndroidDriver(new URL("http://"+username+":"+accessKey+"@"+config.get("server")+"/wd/hub"), capabilities);
@@ -76,6 +75,6 @@ public void setUp() throws Exception {
7675
@AfterMethod(alwaysRun=true)
7776
public void tearDown() throws Exception {
7877
driver.quit();
79-
if(l != null) l.stop();
78+
if(local != null) local.stop();
8079
}
8180
}

android/testng-examples/src/test/java/com/browserstack/run_parallel_test/BrowserStackTestNGTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package com.browserstack.run_parallel_test;
2-
import com.browserstack.local.Local;
32

43
import java.net.URL;
54
import java.util.Map;
6-
import java.util.HashMap;
75
import java.util.Iterator;
86
import java.io.FileReader;
97
import org.json.simple.JSONObject;
@@ -50,12 +48,12 @@ public void setUp(String deviceIndex) throws Exception {
5048

5149
String username = System.getenv("BROWSERSTACK_USERNAME");
5250
if(username == null) {
53-
username = (String) config.get("user");
51+
username = (String) config.get("username");
5452
}
5553

5654
String accessKey = System.getenv("BROWSERSTACK_ACCESS_KEY");
5755
if(accessKey == null) {
58-
accessKey = (String) config.get("key");
56+
accessKey = (String) config.get("access_key");
5957
}
6058

6159
String app = System.getenv("BROWSERSTACK_APP_ID");

android/testng-examples/src/test/resources/com/browserstack/run_first_test/first.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"server": "hub-cloud.browserstack.com",
3-
"user": "BROWSERSTACK_USERNAME",
4-
"key": "BROWSERSTACK_ACCESS_KEY",
3+
"username": "BROWSERSTACK_USERNAME",
4+
"access_key": "BROWSERSTACK_ACCESS_KEY",
55

66
"capabilities": {
77
"project": "First TestNg Android Project",

android/testng-examples/src/test/resources/com/browserstack/run_local_test/local.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"server": "hub-cloud.browserstack.com",
3-
"user": "BROWSERSTACK_USERNAME",
4-
"key": "BROWSERSTACK_ACCESS_KEY",
3+
"username": "BROWSERSTACK_USERNAME",
4+
"access_key": "BROWSERSTACK_ACCESS_KEY",
55

66
"capabilities": {
77
"project": "First TestNg Android Project",

android/testng-examples/src/test/resources/com/browserstack/run_parallel_test/parallel.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"server": "hub-cloud.browserstack.com",
3-
"user": "BROWSERSTACK_USERNAME",
4-
"key": "BROWSERSTACK_ACCESS_KEY",
3+
"username": "BROWSERSTACK_USERNAME",
4+
"access_key": "BROWSERSTACK_ACCESS_KEY",
55

66
"capabilities": {
77
"project": "First TestNg Android Project",

ios/testng-examples/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<artifactId>maven-surefire-plugin</artifactId>
8181
<configuration>
8282
<suiteXmlFiles>
83-
<suiteXmlFile>src/test/resources/com/browserstack/run_first_test/first.testing.xml</suiteXmlFile>
83+
<suiteXmlFile>src/test/resources/com/browserstack/run_first_test/first.testng.xml</suiteXmlFile>
8484
</suiteXmlFiles>
8585
</configuration>
8686
</plugin>
@@ -97,7 +97,7 @@
9797
<artifactId>maven-surefire-plugin</artifactId>
9898
<configuration>
9999
<suiteXmlFiles>
100-
<suiteXmlFile>src/test/resources/com/browserstack/run_local_test/local.testing.xml</suiteXmlFile>
100+
<suiteXmlFile>src/test/resources/com/browserstack/run_local_test/local.testng.xml</suiteXmlFile>
101101
</suiteXmlFiles>
102102
</configuration>
103103
</plugin>
@@ -114,7 +114,7 @@
114114
<artifactId>maven-surefire-plugin</artifactId>
115115
<configuration>
116116
<suiteXmlFiles>
117-
<suiteXmlFile>src/test/resources/com/browserstack/run_parallel_test/parallel.testing.xml</suiteXmlFile>
117+
<suiteXmlFile>src/test/resources/com/browserstack/run_parallel_test/parallel.testng.xml</suiteXmlFile>
118118
</suiteXmlFiles>
119119
</configuration>
120120
</plugin>

ios/testng-examples/src/test/java/com/browserstack/run_first_test/BrowserStackTestNGTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import java.net.URL;
55
import java.util.Map;
6-
import java.util.HashMap;
76
import java.util.Iterator;
87
import java.io.FileReader;
98
import org.json.simple.JSONObject;
@@ -14,7 +13,6 @@
1413

1514
import org.testng.annotations.BeforeMethod;
1615
import org.testng.annotations.AfterMethod;
17-
import org.testng.annotations.Parameters;
1816

1917
import io.appium.java_client.ios.IOSDriver;
2018
import io.appium.java_client.ios.IOSElement;
@@ -49,12 +47,12 @@ public void setUp() throws Exception {
4947

5048
String username = System.getenv("BROWSERSTACK_USERNAME");
5149
if(username == null) {
52-
username = (String) config.get("user");
50+
username = (String) config.get("username");
5351
}
5452

5553
String accessKey = System.getenv("BROWSERSTACK_ACCESS_KEY");
5654
if(accessKey == null) {
57-
accessKey = (String) config.get("key");
55+
accessKey = (String) config.get("access_key");
5856
}
5957

6058
String app = System.getenv("BROWSERSTACK_APP_ID");

ios/testng-examples/src/test/java/com/browserstack/run_first_test/FirstTest.java

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

3-
import java.util.List;
43
import org.testng.Assert;
54
import org.testng.annotations.Test;
65

ios/testng-examples/src/test/java/com/browserstack/run_local_test/BrowserStackTestNGTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414

1515
import org.testng.annotations.BeforeMethod;
1616
import org.testng.annotations.AfterMethod;
17-
import org.testng.annotations.Parameters;
1817

1918
import io.appium.java_client.ios.IOSDriver;
2019
import io.appium.java_client.ios.IOSElement;
2120

2221

2322
public class BrowserStackTestNGTest {
2423
public IOSDriver<IOSElement> driver;
25-
private Local l;
24+
private Local local;
2625

2726
@BeforeMethod(alwaysRun=true)
2827
public void setUp() throws Exception {
@@ -50,12 +49,12 @@ public void setUp() throws Exception {
5049

5150
String username = System.getenv("BROWSERSTACK_USERNAME");
5251
if(username == null) {
53-
username = (String) config.get("user");
52+
username = (String) config.get("username");
5453
}
5554

5655
String accessKey = System.getenv("BROWSERSTACK_ACCESS_KEY");
5756
if(accessKey == null) {
58-
accessKey = (String) config.get("key");
57+
accessKey = (String) config.get("access_key");
5958
}
6059

6160
String app = System.getenv("BROWSERSTACK_APP_ID");
@@ -64,10 +63,10 @@ public void setUp() throws Exception {
6463
}
6564

6665
if(capabilities.getCapability("browserstack.local") != null && capabilities.getCapability("browserstack.local") == "true"){
67-
l = new Local();
66+
local = new Local();
6867
Map<String, String> options = new HashMap<String, String>();
6968
options.put("key", accessKey);
70-
l.start(options);
69+
local.start(options);
7170
}
7271

7372
driver = new IOSDriver<IOSElement>(new URL("http://"+username+":"+accessKey+"@"+config.get("server")+"/wd/hub"), capabilities);
@@ -76,6 +75,6 @@ public void setUp() throws Exception {
7675
@AfterMethod(alwaysRun=true)
7776
public void tearDown() throws Exception {
7877
driver.quit();
79-
if(l != null) l.stop();
78+
if(local != null) local.stop();
8079
}
8180
}

ios/testng-examples/src/test/java/com/browserstack/run_parallel_test/BrowserStackTestNGTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package com.browserstack.run_parallel_test;
2-
import com.browserstack.local.Local;
32

43
import java.net.URL;
54
import java.util.Map;
6-
import java.util.HashMap;
75
import java.util.Iterator;
86
import java.io.FileReader;
97
import org.json.simple.JSONObject;
@@ -50,12 +48,12 @@ public void setUp(String deviceIndex) throws Exception {
5048

5149
String username = System.getenv("BROWSERSTACK_USERNAME");
5250
if(username == null) {
53-
username = (String) config.get("user");
51+
username = (String) config.get("username");
5452
}
5553

5654
String accessKey = System.getenv("BROWSERSTACK_ACCESS_KEY");
5755
if(accessKey == null) {
58-
accessKey = (String) config.get("key");
56+
accessKey = (String) config.get("access_key");
5957
}
6058

6159
String app = System.getenv("BROWSERSTACK_APP_ID");

ios/testng-examples/src/test/java/com/browserstack/run_parallel_test/ParallelTest.java

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

3-
import java.util.List;
43
import org.testng.Assert;
54
import org.testng.annotations.Test;
65

ios/testng-examples/src/test/resources/com/browserstack/run_first_test/first.conf.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"server": "hub-cloud.browserstack.com",
3-
"user": "BROWSERSTACK_USERNAME",
4-
"key": "BROWSERSTACK_ACCESS_KEY",
3+
"username": "BROWSERSTACK_USERNAME",
4+
"access_key": "BROWSERSTACK_ACCESS_KEY",
55

66
"capabilities": {
7-
"project": "First TestNg IOS Project",
8-
"build": "TestNg IOS First",
7+
"project": "First TestNg iOS Project",
8+
"build": "TestNg iOS First",
99
"name": "first_test",
1010
"browserstack.debug": true,
1111
"app": "bs://<hashed app-id>"

ios/testng-examples/src/test/resources/com/browserstack/run_local_test/local.conf.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"server": "hub-cloud.browserstack.com",
3-
"user": "BROWSERSTACK_USERNAME",
4-
"key": "BROWSERSTACK_ACCESS_KEY",
3+
"username": "BROWSERSTACK_USERNAME",
4+
"access_key": "BROWSERSTACK_ACCESS_KEY",
55

66
"capabilities": {
7-
"project": "First TestNg IOS Project",
8-
"build": "TestNg IOS Local",
7+
"project": "First TestNg iOS Project",
8+
"build": "TestNg iOS Local",
99
"name": "local_test",
1010
"browserstack.debug": true,
1111
"browserstack.local": true,

ios/testng-examples/src/test/resources/com/browserstack/run_parallel_test/parallel.conf.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"server": "hub-cloud.browserstack.com",
3-
"user": "BROWSERSTACK_USERNAME",
4-
"key": "BROWSERSTACK_ACCESS_KEY",
3+
"username": "BROWSERSTACK_USERNAME",
4+
"access_key": "BROWSERSTACK_ACCESS_KEY",
55

66
"capabilities": {
7-
"project": "First TestNg IOS Project",
8-
"build": "TestNg IOS Parallel",
7+
"project": "First TestNg iOS Project",
8+
"build": "TestNg iOS Parallel",
99
"name": "parallel_test",
1010
"browserstack.debug": true,
1111
"app": "bs://<hashed app-id>"

0 commit comments

Comments
 (0)