Skip to content

Commit 9f2fb3d

Browse files
Abhi Singhfrancisf
authored andcommitted
added parallel run
1 parent afb1e37 commit 9f2fb3d

File tree

13 files changed

+353
-158
lines changed

13 files changed

+353
-158
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ hs_err_pid*
1515
target/
1616
/.idea/
1717
*.iml
18+
19+
local.log

Makefile

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

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
# Cucumber JVM-Browserstack
2-
[Cucumber JVM](https://cucumber.io/docs/reference/jvm) Integration with BrowserStack.
1+
# Cucumber Java Browserstack
2+
<img src="https://avatars.githubusercontent.com/u/1119453?s=200&v=4" width="60" height="60" ><img src="https://avatars.githubusercontent.com/u/320565?s=200&v=4" width="60" height="60" >
33

4-
![BrowserStack Logo](https://d98b8t1nnulk5.cloudfront.net/production/images/layout/logo-header.png?1469004780)
5-
<img src="https://cucumber.io/images/cucumber-logo.svg" height="110" />
4+
[Cucumber JVM](https://cucumber.io/docs/reference/jvm) Integration with BrowserStack.
65

76
## Setup
87
* Clone the repo
98
* Install dependencies `mvn install`
10-
* Set environment variables with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings).
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.
1111

1212
## Running your tests
13-
* To run a single test, run `mvn install -Dbrowser=<BROWSER>`
14-
* Note - use command line properties to set additional webdriver capabilities
15-
* To run parallel tests, run `make run_all_in_parallel`
13+
* To run a single test, run `mvn compile exec:java -P single`
14+
* To run parallel tests, run `mvn compile exec:java -P parallel`
15+
* To run local tests, run `mvn compile exec:java -P local`
16+
1617

1718

1819
## Notes

pom.xml

Lines changed: 140 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -3,158 +3,189 @@
33
<modelVersion>4.0.0</modelVersion>
44

55
<groupId>com.browserstack</groupId>
6-
<artifactId>cucumber-jvm-java-browserstack</artifactId>
6+
<artifactId>cucumber-java-browserstack</artifactId>
77
<version>0.0.1-SNAPSHOT</version>
88
<packaging>jar</packaging>
99

10-
<name>cucumber-jvm-java-browserstack</name>
10+
<name>cucumber-java-browserstack</name>
1111
<url>http://maven.apache.org</url>
1212

1313
<properties>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15-
<cucumber.jvm.parallel.version>2.2.0</cucumber.jvm.parallel.version>
16-
<surefire.maven.plugin.version>2.19.1</surefire.maven.plugin.version>
17-
<acceptance.test.parallel.count>1</acceptance.test.parallel.count>
15+
<maven.compiler.source>1.8</maven.compiler.source>
16+
<maven.compiler.target>1.8</maven.compiler.target>
17+
<cucumber.version>6.9.1</cucumber.version>
18+
<selenium-java.version>3.141.59</selenium-java.version>
19+
<browserstack-local-java.version>1.0.6</browserstack-local-java.version>
20+
<json-simple.version>1.1.1</json-simple.version>
21+
<slf4j.version>1.7.30</slf4j.version>
1822
</properties>
1923

2024
<dependencies>
2125

2226
<dependency>
23-
<groupId>info.cukes</groupId>
24-
<artifactId>cucumber-java</artifactId>
25-
<version>1.2.5</version>
27+
<groupId>org.slf4j</groupId>
28+
<artifactId>slf4j-api</artifactId>
29+
<version>${slf4j.version}</version>
2630
</dependency>
2731

2832
<dependency>
29-
<groupId>info.cukes</groupId>
30-
<artifactId>cucumber-junit</artifactId>
31-
<version>1.2.5</version>
33+
<groupId>io.cucumber</groupId>
34+
<artifactId>cucumber-java</artifactId>
35+
<version>${cucumber.version}</version>
36+
<scope>test</scope>
3237
</dependency>
33-
3438
<dependency>
3539
<groupId>org.seleniumhq.selenium</groupId>
3640
<artifactId>selenium-java</artifactId>
37-
<version>3.0.1</version>
41+
<version>${selenium-java.version}</version>
3842
<scope>test</scope>
3943
</dependency>
40-
4144
<dependency>
42-
<groupId>junit</groupId>
43-
<artifactId>junit</artifactId>
44-
<version>4.12</version>
45-
<scope>test</scope>
45+
<groupId>com.browserstack</groupId>
46+
<artifactId>browserstack-local-java</artifactId>
47+
<version>${browserstack-local-java.version}</version>
4648
</dependency>
4749

4850
<dependency>
49-
<groupId>org.apache.commons</groupId>
50-
<artifactId>commons-io</artifactId>
51-
<version>1.3.2</version>
51+
<groupId>com.googlecode.json-simple</groupId>
52+
<artifactId>json-simple</artifactId>
53+
<version>${json-simple.version}</version>
5254
</dependency>
53-
5455
<dependency>
55-
<groupId>com.browserstack</groupId>
56-
<artifactId>browserstack-local-java</artifactId>
57-
<version>1.0.1</version>
56+
<groupId>org.apache.commons</groupId>
57+
<artifactId>commons-lang3</artifactId>
58+
<version>3.11</version>
5859
</dependency>
5960

6061
</dependencies>
6162

6263
<build>
6364
<plugins>
6465
<plugin>
66+
<groupId>org.apache.maven.plugins</groupId>
6567
<artifactId>maven-compiler-plugin</artifactId>
66-
<version>3.3</version>
68+
<version>3.8.0</version>
6769
<configuration>
68-
<source>1.6</source>
69-
<target>1.6</target>
70+
<source>8</source>
71+
<target>8</target>
7072
</configuration>
7173
</plugin>
72-
<plugin>
73-
<groupId>org.apache.maven.plugins</groupId>
74-
<artifactId>maven-surefire-plugin</artifactId>
75-
<version>${surefire.maven.plugin.version}</version>
76-
<executions>
77-
<execution>
78-
<id>acceptance-test</id>
79-
<phase>integration-test</phase>
80-
<goals>
81-
<goal>test</goal>
82-
</goals>
74+
</plugins>
75+
</build>
76+
<profiles>
77+
<profile>
78+
<id>single</id>
79+
<activation>
80+
<activeByDefault>true</activeByDefault>
81+
</activation>
82+
<build>
83+
<plugins>
84+
<plugin>
85+
<groupId>org.codehaus.mojo</groupId>
86+
<artifactId>exec-maven-plugin</artifactId>
87+
<version>3.0.0</version>
8388
<configuration>
84-
<forkCount>${acceptance.test.parallel.count}</forkCount>
85-
<reuseForks>true</reuseForks>
86-
<includes>
87-
<include>**/*IT.class</include>
88-
</includes>
89+
<classpathScope>test</classpathScope>
90+
<mainClass>com.browserstack.TestRunner</mainClass>
91+
<cleanupDaemonThreads>false</cleanupDaemonThreads>
92+
<systemProperties>
93+
<property>
94+
<key>cucumber.publish.quiet</key>
95+
<value>true</value>
96+
</property>
97+
<property>
98+
<key>cucumber.plugin</key>
99+
<value>html:target/cucumber-html-reports.html</value>
100+
</property>
101+
<property>
102+
<key>caps</key>
103+
<value>src/test/resources/conf/single.conf.json</value>
104+
</property>
105+
<property>
106+
<key>features</key>
107+
<value>src/test/resources/features/test</value>
108+
</property>
109+
</systemProperties>
89110
</configuration>
90-
</execution>
91-
</executions>
92-
</plugin>
93-
<plugin>
94-
<artifactId>maven-resources-plugin</artifactId>
95-
<version>3.0.2</version>
96-
<executions>
97-
<execution>
98-
<id>copy-resources</id>
99-
<!-- here the phase you need -->
100-
<phase>validate</phase>
101-
<goals>
102-
<goal>copy-resources</goal>
103-
</goals>
111+
</plugin>
112+
</plugins>
113+
</build>
114+
</profile>
115+
<profile>
116+
<id>parallel</id>
117+
<build>
118+
<plugins>
119+
<plugin>
120+
<groupId>org.codehaus.mojo</groupId>
121+
<artifactId>exec-maven-plugin</artifactId>
122+
<version>3.0.0</version>
104123
<configuration>
105-
<outputDirectory>target/test-classes/com/yourcompany/cucumberjvm</outputDirectory>
106-
<resources>
107-
<resource>
108-
<directory>src/test/resources</directory>
109-
<filtering>true</filtering>
110-
</resource>
111-
</resources>
124+
<classpathScope>test</classpathScope>
125+
<mainClass>com.browserstack.TestRunner</mainClass>
126+
<cleanupDaemonThreads>false</cleanupDaemonThreads>
127+
<systemProperties>
128+
<property>
129+
<key>cucumber.publish.quiet</key>
130+
<value>true</value>
131+
</property>
132+
<property>
133+
<key>cucumber.plugin</key>
134+
<value>html:target/cucumber-html-reports.html</value>
135+
</property>
136+
<property>
137+
<key>caps</key>
138+
<value>src/test/resources/conf/parallel.conf.json</value>
139+
</property>
140+
<property>
141+
<key>parallel-count</key>
142+
<value>5</value>
143+
</property>
144+
<property>
145+
<key>features</key>
146+
<value>src/test/resources/features/test</value>
147+
</property>
148+
</systemProperties>
112149
</configuration>
113-
</execution>
114-
</executions>
115-
</plugin>
116-
<plugin>
117-
<groupId>com.github.temyers</groupId>
118-
<artifactId>cucumber-jvm-parallel-plugin</artifactId>
119-
<version>${cucumber.jvm.parallel.version}</version>
120-
<executions>
121-
<execution>
122-
<id>generateRunners</id>
123-
<phase>validate</phase>
124-
<goals>
125-
<goal>generateRunners</goal>
126-
</goals>
150+
</plugin>
151+
</plugins>
152+
</build>
153+
</profile>
154+
<profile>
155+
<id>local</id>
156+
<build>
157+
<plugins>
158+
<plugin>
159+
<groupId>org.codehaus.mojo</groupId>
160+
<artifactId>exec-maven-plugin</artifactId>
161+
<version>3.0.0</version>
127162
<configuration>
128-
<!-- Mandatory -->
129-
<!-- comma separated list of package names to scan for glue code -->
130-
<glue>com.browserstack.stepdefs</glue>
131-
<!-- These are the default values -->
132-
<!-- Where to output the generated Junit tests -->
133-
<outputDirectory>${project.build.directory}/generated-test-sources/features</outputDirectory>
134-
<!-- The diectory containing your feature files. -->
135-
<featuresDirectory>src/test/java/resources/features</featuresDirectory>
136-
<cucumberOutputDir>${project.build.directory}/cucumber_reports/test_results</cucumberOutputDir>
137-
<!-- comma separated list of output formats -->
138-
<format>junit</format>
139-
<!-- CucumberOptions.strict property -->
140-
<strict>true</strict>
141-
<!-- CucumberOptions.monochrome property -->
142-
<monochrome>true</monochrome>
143-
<!-- The tags to run, maps to CucumberOptions.tags property -->
144-
<tags>"~@ignore"</tags>
145-
146-
<namingScheme>pattern</namingScheme>
147-
<!-- The class naming pattern to use. Only required/used if naming scheme is 'pattern'.-->
148-
<namingPattern>{f}_Parallel{c}IT</namingPattern>
149-
150-
<!-- If set to true, only feature files containing the required tags shall be generated. -->
151-
<!-- Excluded tags (~@notMe) are ignored. -->
152-
<filterFeaturesByTags>true</filterFeaturesByTags>
163+
<classpathScope>test</classpathScope>
164+
<mainClass>com.browserstack.TestRunner</mainClass>
165+
<cleanupDaemonThreads>false</cleanupDaemonThreads>
166+
<systemProperties>
167+
<property>
168+
<key>cucumber.publish.quiet</key>
169+
<value>true</value>
170+
</property>
171+
<property>
172+
<key>cucumber.plugin</key>
173+
<value>html:target/cucumber-html-reports.html</value>
174+
</property>
175+
<property>
176+
<key>caps</key>
177+
<value>src/test/resources/conf/local.conf.json</value>
178+
</property>
179+
<property>
180+
<key>features</key>
181+
<value>src/test/resources/features/localtest</value>
182+
</property>
183+
</systemProperties>
153184
</configuration>
154-
</execution>
155-
</executions>
156-
</plugin>
157-
</plugins>
158-
</build>
185+
</plugin>
186+
</plugins>
187+
</build>
188+
</profile>
189+
</profiles>
159190

160191
</project>

0 commit comments

Comments
 (0)