Skip to content

Commit c6acd00

Browse files
authored
Merge pull request #2 from nsingla/addreadme
adding readme and plugin for release preparation
2 parents a83aaab + f15f13e commit c6acd00

File tree

3 files changed

+113
-2
lines changed

3 files changed

+113
-2
lines changed

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Basic Framework to get you started with running UI tests using Selenium
2+
This allows you to run UI tests using selenium webdriver. You can also run your tests in parallel by specifying the number of parallel threads as `-DthreadCount=` as runtime param.
3+
4+
## Requirement
5+
* Java 11
6+
* Maven >3.0
7+
8+
## Building the project:
9+
* You can build the project with maven goals `clean install`
10+
11+
## How To Use
12+
13+
In order to include *selenium-java-framework* in your Maven project, first add the following dependency to your `pom.xml`:
14+
15+
```xml
16+
<dependency>
17+
<groupId>io.github.nsingla</groupId>
18+
<artifactId>selenium-framework</artifactId>
19+
<version>1.0.0</version>
20+
<scope>test</scope>
21+
</dependency>
22+
```
23+
24+
And also add following repository to your pom:
25+
```xml
26+
<repositories>
27+
<repository>
28+
<id>ossrh</id>
29+
<name>Central Repository OSSRH</name>
30+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
31+
</repository>
32+
</repositories>
33+
```
34+
35+
## Examples to run tests
36+
Simply extend your test class with `SeleniumBase.java`
37+
38+
```java
39+
40+
import io.nsingla.selenium.SeleniumBase;
41+
42+
/**
43+
* This will enable your tests to fetch a webdriver object
44+
*/
45+
class YourTestClass extends SeleniumBase {
46+
47+
}
48+
```
49+
50+
## Available runtime parameters
51+
| Param | Values | Default |
52+
|-----------------|------------------------------------------------------------------------|-----------|
53+
| mode | LOCAL, REMOTE | LOCAL |
54+
| browser | chrome, firefox, <br/>ie, edge, safari | chrome |
55+
| headless | true, false | false |
56+
| gridHost | String | localhost |
57+
| gridPort | String | 4444 |
58+
| consoleloglevel | OFF, SEVERE, WARNING, <br/>INFO, CONFIG, FINE, <br/>FINER, FINEST, ALL | OFF |
59+
| locale | en, es ... | en |
60+
| downloadPath | String | null |
61+
| retryCount | String | 0 |
62+
| threadCount | String | 1 |
63+
- `mode` - To run tests locally or via grid
64+
- `browser` - To specify which browser to run tests in
65+
- `headless` - To run tests in a headless mode or via a GUI
66+
- `gridHost` - Selenium Grid hostname
67+
- `gridPort` - Selenium Grid Port Number
68+
- `consoleloglevel` - Log Level for logging
69+
- `locale` - to set browser locale (in case website picks it based on your location)
70+
- `downloadPath` - To specify a custom download path
71+
- `retryCount` - Number of times a test should retry if failed (find how to enable your tests to rerun on failure [here](https://github.com/nsingla/junit5-framework/blob/master/README.md))
72+
- `threadCount` - To specify how many tests you want to run in parallel (total across whole suite of classes)

pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,45 @@
167167
</includes>
168168
</configuration>
169169
</plugin>
170+
<plugin>
171+
<groupId>com.amashchenko.maven.plugin</groupId>
172+
<artifactId>gitflow-maven-plugin</artifactId>
173+
<version>1.16.0</version>
174+
175+
<configuration>
176+
<verbose>true</verbose>
177+
178+
<skipTestProject>true</skipTestProject>
179+
180+
<postReleaseGoals>deploy</postReleaseGoals>
181+
<postHotfixGoals>deploy</postHotfixGoals>
182+
183+
<versionDigitToIncrement>1</versionDigitToIncrement>
184+
185+
<gitFlowConfig>
186+
<developmentBranch>master</developmentBranch>
187+
<productionBranch>master</productionBranch>
188+
</gitFlowConfig>
189+
190+
<commitMessages>
191+
<hotfixStartMessage>Prepare fix version @{version}</hotfixStartMessage>
192+
193+
<releaseStartMessage>Release version @{version}</releaseStartMessage>
194+
<releaseFinishMessage>Prepare snapshot version @{version}</releaseFinishMessage>
195+
</commitMessages>
196+
</configuration>
197+
</plugin>
198+
<plugin>
199+
<groupId>org.sonatype.plugins</groupId>
200+
<artifactId>nexus-staging-maven-plugin</artifactId>
201+
<version>1.6.7</version>
202+
<extensions>true</extensions>
203+
<configuration>
204+
<serverId>ossrh</serverId>
205+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
206+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
207+
</configuration>
208+
</plugin>
170209
</plugins>
171210
</build>
172211
<profiles>

src/main/java/io/nsingla/constants/SeleniumConstants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
public class SeleniumConstants {
1010

1111
// Constants for Selenium
12-
public static final String SELENIUM_GRID_HOST = System.getProperty("seleniumHost", "localhost");
13-
public static final String SELENIUM_GRID_PORT = System.getProperty("seleniumPort", "4444");
12+
public static final String SELENIUM_GRID_HOST = System.getProperty("gridHost", "localhost");
13+
public static final String SELENIUM_GRID_PORT = System.getProperty("gridPort", "4444");
1414
public static final String APP_URL = System.getProperty("url", "https://www.google.com");
1515
public static final Level CONSOLE_LOG_LEVEL = Level.parse(System.getProperty("consoleloglevel", Level.OFF.getName()));
1616
public static final String TEST_MODE = System.getProperty("mode", TestMode.LOCAL.name());

0 commit comments

Comments
 (0)