|
| 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) |
0 commit comments