Skip to content

Commit 97b8d8b

Browse files
committed
Adding mvn profiles for all the test scenarios
1 parent 39afd53 commit 97b8d8b

File tree

4 files changed

+169
-116
lines changed

4 files changed

+169
-116
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ local.log
55
*.iml
66
**/.DS_Store
77
**/.settings
8-
java-browserstack/.classpath
8+
.classpath
9+
.project
10+

java-browserstack/.project

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

pom.xml

Lines changed: 163 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,165 @@
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2-
<modelVersion>4.0.0</modelVersion>
3-
<groupId>com.browserstack</groupId>
4-
<artifactId>java-browserstack</artifactId>
5-
<version>0.0.1-SNAPSHOT</version>
6-
<name>java-browserstack</name>
7-
<description>Java appium app browserstack</description>
8-
9-
<properties>
10-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11-
<surefire.version>2.19.1</surefire.version>
12-
<test.file></test.file>
13-
<config.file>default</config.file>
14-
</properties>
15-
16-
17-
<dependencies>
18-
<dependency>
19-
<groupId>commons-io</groupId>
20-
<artifactId>commons-io</artifactId>
21-
<version>1.3.2</version>
22-
</dependency>
23-
<dependency>
24-
<groupId>org.seleniumhq.selenium</groupId>
25-
<artifactId>selenium-java</artifactId>
26-
<version>3.141.59</version>
27-
</dependency>
28-
<dependency>
29-
<groupId>io.appium</groupId>
30-
<artifactId>java-client</artifactId>
31-
<version>7.0.0</version>
32-
</dependency>
33-
<dependency>
34-
<groupId>com.browserstack</groupId>
35-
<artifactId>browserstack-local-java</artifactId>
36-
<version>1.0.3</version>
37-
</dependency>
38-
<dependency>
39-
<groupId>com.googlecode.json-simple</groupId>
40-
<artifactId>json-simple</artifactId>
41-
<version>1.1.1</version>
42-
</dependency>
43-
</dependencies>
44-
45-
<build>
46-
<plugins>
47-
<plugin>
48-
<groupId>org.apache.maven.plugins</groupId>
49-
<artifactId>maven-surefire-plugin</artifactId>
50-
<version>2.22.2</version>
51-
</plugin>
52-
<plugin>
53-
<groupId>org.apache.maven.plugins</groupId>
54-
<artifactId>maven-compiler-plugin</artifactId>
55-
<version>3.8.1</version>
56-
<configuration>
57-
<source>1.8</source>
58-
<target>1.8</target>
59-
</configuration>
60-
</plugin>
61-
</plugins>
62-
</build>
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.browserstack</groupId>
6+
<artifactId>java-browserstack</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<name>java-browserstack</name>
9+
<description>Java appium app browserstack</description>
10+
11+
<properties>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
<surefire.version>2.19.1</surefire.version>
14+
<test.file></test.file>
15+
<config.file>default</config.file>
16+
</properties>
17+
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>commons-io</groupId>
22+
<artifactId>commons-io</artifactId>
23+
<version>1.3.2</version>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.seleniumhq.selenium</groupId>
27+
<artifactId>selenium-java</artifactId>
28+
<version>3.141.59</version>
29+
</dependency>
30+
<dependency>
31+
<groupId>io.appium</groupId>
32+
<artifactId>java-client</artifactId>
33+
<version>7.0.0</version>
34+
</dependency>
35+
<dependency>
36+
<groupId>com.browserstack</groupId>
37+
<artifactId>browserstack-local-java</artifactId>
38+
<version>1.0.3</version>
39+
</dependency>
40+
<dependency>
41+
<groupId>com.googlecode.json-simple</groupId>
42+
<artifactId>json-simple</artifactId>
43+
<version>1.1.1</version>
44+
</dependency>
45+
</dependencies>
46+
47+
<build>
48+
<plugins>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-surefire-plugin</artifactId>
52+
<version>2.22.2</version>
53+
</plugin>
54+
<plugin>
55+
<groupId>org.apache.maven.plugins</groupId>
56+
<artifactId>maven-compiler-plugin</artifactId>
57+
<version>3.8.1</version>
58+
<configuration>
59+
<source>1.8</source>
60+
<target>1.8</target>
61+
</configuration>
62+
</plugin>
63+
</plugins>
64+
</build>
65+
66+
<profiles>
67+
<profile>
68+
<id>android-first-test</id>
69+
<build>
70+
<plugins>
71+
<plugin>
72+
<groupId>org.codehaus.mojo</groupId>
73+
<artifactId>exec-maven-plugin</artifactId>
74+
<version>1.1.1</version>
75+
<executions>
76+
<execution>
77+
<phase>test</phase>
78+
<goals>
79+
<goal>java</goal>
80+
</goals>
81+
<configuration>
82+
<mainClass>android.BrowserStackAndroid</mainClass>
83+
<classpathScope>test</classpathScope>
84+
</configuration>
85+
</execution>
86+
</executions>
87+
</plugin>
88+
</plugins>
89+
</build>
90+
</profile>
91+
<profile>
92+
<id>android-local-test</id>
93+
<build>
94+
<plugins>
95+
<plugin>
96+
<groupId>org.codehaus.mojo</groupId>
97+
<artifactId>exec-maven-plugin</artifactId>
98+
<version>1.1.1</version>
99+
<executions>
100+
<execution>
101+
<phase>test</phase>
102+
<goals>
103+
<goal>java</goal>
104+
</goals>
105+
<configuration>
106+
<mainClass>android.BrowserStackAndroidLocal</mainClass>
107+
<classpathScope>test</classpathScope>
108+
</configuration>
109+
</execution>
110+
</executions>
111+
</plugin>
112+
</plugins>
113+
</build>
114+
</profile>
115+
<profile>
116+
<id>ios-first-test</id>
117+
<build>
118+
<plugins>
119+
<plugin>
120+
<groupId>org.codehaus.mojo</groupId>
121+
<artifactId>exec-maven-plugin</artifactId>
122+
<version>1.1.1</version>
123+
<executions>
124+
<execution>
125+
<phase>test</phase>
126+
<goals>
127+
<goal>java</goal>
128+
</goals>
129+
<configuration>
130+
<mainClass>ios.BrowserStackiOS</mainClass>
131+
<classpathScope>test</classpathScope>
132+
</configuration>
133+
</execution>
134+
</executions>
135+
</plugin>
136+
</plugins>
137+
</build>
138+
</profile>
139+
<profile>
140+
<id>ios-local-test</id>
141+
<build>
142+
<plugins>
143+
<plugin>
144+
<groupId>org.codehaus.mojo</groupId>
145+
<artifactId>exec-maven-plugin</artifactId>
146+
<version>1.1.1</version>
147+
<executions>
148+
<execution>
149+
<phase>test</phase>
150+
<goals>
151+
<goal>java</goal>
152+
</goals>
153+
<configuration>
154+
<mainClass>ios.BrowserStackiOSLocal</mainClass>
155+
<classpathScope>test</classpathScope>
156+
</configuration>
157+
</execution>
158+
</executions>
159+
</plugin>
160+
</plugins>
161+
</build>
162+
</profile>
163+
</profiles>
63164

64-
<profiles>
65-
<profile>
66-
<id>first</id>
67-
<build>
68-
<plugins>
69-
<plugin>
70-
<groupId>org.codehaus.mojo</groupId>
71-
<artifactId>exec-maven-plugin</artifactId>
72-
<version>1.1.1</version>
73-
<executions>
74-
<execution>
75-
<phase>test</phase>
76-
<goals>
77-
<goal>java</goal>
78-
</goals>
79-
<configuration>
80-
<mainClass>android.BrowserStackAndroid</mainClass>
81-
<classpathScope>test</classpathScope>
82-
</configuration>
83-
</execution>
84-
</executions>
85-
</plugin>
86-
</plugins>
87-
</build>
88-
</profile>
89-
</profiles>
90-
91165
</project>

src/test/java/android/BrowserStackAndroid.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public static void main(String[] args) throws MalformedURLException, Interrupted
2121
DesiredCapabilities capabilities = new DesiredCapabilities();
2222

2323
// Set your access credentials
24-
capabilities.setCapability("browserstack.user", "neerajkumar42");
25-
capabilities.setCapability("browserstack.key", "MXmmyxNzZTYmXyyA8xyB");
24+
capabilities.setCapability("browserstack.user", "YOUR_USERNAME");
25+
capabilities.setCapability("browserstack.key", "YOUR_ACCESS_KEY");
2626

2727
// Set URL of the application under test
28-
capabilities.setCapability("app", "bs://d318ec55142bf92b1fec9fce6904109294db6678");
28+
capabilities.setCapability("app", "bs://<app-id>");
2929

3030
// Specify device and os_version for testing
3131
capabilities.setCapability("device", "Google Pixel 3");

0 commit comments

Comments
 (0)