Skip to content

Commit 8696eef

Browse files
authored
Merge pull request #3 from browserstack/spec_v1
used maven, added single local and parallel test
2 parents edac79b + 4f87e05 commit 8696eef

23 files changed

+374
-357
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
test-output/
2-
dist/
3-
bin/
41
*.png
2+
target/
53
local.log
4+
.idea
5+
*.iml

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
TestNG-BrowserStack
2-
=========
1+
# testng-browserstack
32

4-
Sample for running [TestNG] tests with BrowserStack Automate.
3+
[TestNG](http://testng.org) Integration with BrowserStack.
54

6-
### Configuring the json
7-
- Open `src/com/browserstack/TestNGSample.java` or `src/com/browserstack/TestNGParallel.java`.
8-
- Add `username` and `accessKey` with your BrowserStack credentials. Don't have one? Get one on BrowserStack [dashboard].
9-
- Add / customise more [capabilities].
10-
- Optionally, you can add your BrowserStack credentials to the environment variables `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY`.
5+
## Setup
116

12-
### Running the tests
13-
- To start local tests run: `ant test-local`
14-
- To start tests in series, run: `ant test-series`
15-
- To start parallel tests run: `ant test-parallel`
7+
- Clone the repo
8+
- Install dependencies `mvn compile`
9+
- Update `*.conf.json` files inside the `src/test/resources/conf` directory with your BrowserStack Username and Access Key. (These can be found in the [settings](https://www.browserstack.com/accounts/settings) section on BrowserStack accounts page)
10+
- Alternatively, you can export the environment variables for the Username and Access Key of your BrowserStack account. `export BROWSERSTACK_USERNAME=<browserstack-username> && export BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>`
1611

17-
[TestNG]:http://testng.org
18-
[capabilities]:http://www.browserstack.com/automate/capabilities
19-
[dashboard]:https://www.browserstack.com/automate
12+
### Run the tests
13+
14+
- To run single test, run `mvn test -P single`
15+
- To run parallel tests, run `mvn test -P parallel`
16+
- To run local tests, run `mvn test -P local`
17+
18+
### Notes
19+
20+
- In order to test on different set of browsers, check out our [code generator](https://www.browserstack.com/automate/python#setting-os-and-browser)

Testng.xml

Lines changed: 0 additions & 28 deletions
This file was deleted.

build.xml

Lines changed: 0 additions & 58 deletions
This file was deleted.

config/local.testng.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
3+
<suite name="Local">
4+
<test name="LocalTest">
5+
<parameter name="config" value="local.conf.json"/>
6+
<parameter name="environment" value="chrome"/>
7+
<classes>
8+
<class name="com.browserstack.LocalTest"/>
9+
</classes>
10+
</test>
11+
</suite>

config/parallel.testng.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
3+
<suite name="Parallel" thread-count="4" parallel="tests">
4+
<test name="SingleTestChrome">
5+
<parameter name="config" value="parallel.conf.json"/>
6+
<parameter name="environment" value="chrome"/>
7+
<classes>
8+
<class name="com.browserstack.SingleTest"/>
9+
</classes>
10+
</test>
11+
12+
<test name="SingleTestFirefox">
13+
<parameter name="config" value="parallel.conf.json"/>
14+
<parameter name="environment" value="firefox"/>
15+
<classes>
16+
<class name="com.browserstack.SingleTest"/>
17+
</classes>
18+
</test>
19+
20+
<test name="SingleTestSafari">
21+
<parameter name="config" value="parallel.conf.json"/>
22+
<parameter name="environment" value="safari"/>
23+
<classes>
24+
<class name="com.browserstack.SingleTest"/>
25+
</classes>
26+
</test>
27+
28+
<test name="SingleTestIE">
29+
<parameter name="config" value="parallel.conf.json"/>
30+
<parameter name="environment" value="ie"/>
31+
<classes>
32+
<class name="com.browserstack.SingleTest"/>
33+
</classes>
34+
</test>
35+
</suite>

config/single.testng.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
3+
<suite name="Single">
4+
<test name="SingleTest">
5+
<parameter name="config" value="single.conf.json"/>
6+
<parameter name="environment" value="chrome"/>
7+
<classes>
8+
<class name="com.browserstack.SingleTest"/>
9+
</classes>
10+
</test>
11+
</suite>

lib/browserstack-local-java-0.1.0.jar

-7.71 KB
Binary file not shown.

lib/commons-io-2.4.jar

-181 KB
Binary file not shown.

lib/jcommander-1.27.jar

-54.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)