Skip to content

Commit 80e1756

Browse files
committed
Added README
1 parent f35e8ad commit 80e1756

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

.github/allure-img.png

322 KB
Loading

README.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Java Selenium Framework
2+
3+
The Selenium Java Framework is a good starting point for writing your UI automated tests utilizing Java,
4+
Selenium and Zalenium for running the tests in a CI manner.
5+
6+
## Features
7+
### Multiple domains
8+
Tests can be configured to run against different domains. For example:
9+
https://www.some-site.de and https://www.some-site.fr.
10+
11+
### Multiple environments
12+
Similar as for multiple domains the tests can also be run on multiple environments,
13+
for example a staging and a live environment. It is as simple as changing a spring profile parameter.
14+
15+
### Localization
16+
Page content can be validated with different languages through a config file.
17+
18+
### User data handling
19+
Handling user data within a json file where the appropriate user will be determined by country.
20+
21+
### Headless
22+
The option to run the tests in headless mode (without opening a browser).
23+
24+
### Zalenium integration
25+
[Zalenium](https://github.com/zalando/zalenium) is a Selenium Grid extension to scale your local grid dynamically with docker containers.
26+
27+
### Allure reports integration
28+
[Allure Framework](https://github.com/allure-framework/allure2) is a flexible lightweight multi-language test report tool that shows a very concise representation of what has been tested in a neat web report form
29+
30+
### Parallelization
31+
The framework has the ability to run multiple tests in parallel. Setting this up just requires to set the `thread-count` paramenter in `testng.xml`.
32+
33+
## Tech Stack
34+
* Java 8
35+
* Maven
36+
* Spring Boot
37+
* TestNG
38+
* Allure
39+
* Zalenium
40+
41+
## How-to
42+
### Local on different browsers
43+
To run the tests on your local machine use the command:
44+
45+
```
46+
mvn clean test -Dspring.profiles.active=live -Dcountry=com -Dbrowser=chrome
47+
```
48+
49+
The parameters explained:
50+
* `spring.profiles.active` - defines on which environment the tests will run
51+
* `country` - defines on which domain the tests will run
52+
* `browser` - defines the browser (`chrome/firefox`)
53+
54+
55+
### With Zalenium
56+
To be able to run the tests on Zalenium (which is basically just a dockerized Selenium Grid), first Zalenium has to be started.
57+
```
58+
# Pull docker-selenium
59+
docker pull elgalu/selenium
60+
61+
# Pull Zalenium
62+
docker pull dosel/zalenium
63+
64+
docker run --rm -ti --name zalenium -p 4444:4444 \
65+
-v /var/run/docker.sock:/var/run/docker.sock \
66+
-v /tmp/videos:/home/seluser/videos \
67+
--privileged dosel/zalenium start
68+
```
69+
70+
After Zalenium is running just the browser parameter has to be changed in order to run the tests
71+
72+
```
73+
mvn clean test -Dspring.profiles.active=live -Dcountry=com -Dbrowser=zalenium
74+
```
75+
76+
### Headless
77+
The latest versions of the Chrome and Firefox browsers have the feature to run browsers in headless mode. This speeds up the running time of the tests immensely. For running the tests using the headlless mode feature:
78+
79+
```
80+
mvn clean test -Dspring.profiles.active=live -Dcountry=com -Dbrowser=chrome -Dmode=headless
81+
```
82+
83+
where as browser either `chrome` or `firefox` can be selected.
84+
85+
### Running the tests on a different OS
86+
Currently the tests are configured to run just on MacOS. But this can be changed [here](https://github.com/edinc/java-selenium-framework/blob/master/src/main/java/selenium/driver/DriverManager.java#L21) , the relative path just has to be replaced with the appropriate driver for that OS.
87+
88+
## Reports
89+
90+
Reporting of the tests results is one of the most important aspects of a framework. It doesn't matter how many and good your tests are when they are not enough visible. In this framework Allure was used to generate
91+
visually rich and insightful reports.
92+
93+
![Allure Report](.github/allure-img.png)
94+
95+
Allure has to be installed before being able to show test results:
96+
97+
```
98+
$ brew untap qameta/allure
99+
$ brew update
100+
$ brew install allure
101+
```
102+
103+
After every test run the results are automatically stored in an `allure-results` directory. The results then can be seen locally by running:
104+
105+
```
106+
allure serve
107+
```
108+
109+
or in all popular CI's with the help of allure plugins.
110+
## Contact
111+
112+
Open a github issue or for suggestions a Pull Request straight away.

0 commit comments

Comments
 (0)