Skip to content

Commit 4e61bb5

Browse files
Updated description
1 parent 5b969eb commit 4e61bb5

File tree

5 files changed

+147
-63
lines changed

5 files changed

+147
-63
lines changed

.github/workflows/jupiter-tests.yml renamed to .github/workflows/automated-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Jupiter Automated Tests
1+
name: REST Assured Automated Tests
22

33
on: [ push ]
44
#on:
@@ -15,7 +15,7 @@ permissions:
1515
jobs:
1616
test:
1717
runs-on: ubuntu-latest
18-
name: Run JUPITER Automated Tests
18+
name: Run REST Assured Automated Tests
1919
steps:
2020
- name: Checkout Repository
2121
uses: actions/checkout@v4
@@ -26,7 +26,7 @@ jobs:
2626
java-version: '21'
2727
- name: Check Java version
2828
run: java -version
29-
- name: Run Automates Tests
29+
- name: Run Automated Tests
3030
run: ./mvnw clean test
3131
continue-on-error: true
3232
- name: Check Allure Results Directory

README.md

Lines changed: 136 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,168 @@
1-
# Test Automation Project
1+
# Test Automation Framework - API Automation with REST Assured, Spring Boot and JUnit 5
22

3-
This is a test automation project for JUPITER platform (demo version).
3+
## Overview
44

5-
## Project components
5+
This is a robust and scalable test automation framework built with modern **Java** technologies
6+
**for testing RESTful APIs**. The framework leverages a variety of open-source libraries and tools to create
7+
an efficient, reliable, and easily extensible solution for automated API testing.
68

7-
Given test automation project is built with next key frameworks and technologies:
9+
## Key Technologies and Libraries
810

9-
- [Java 21](https://openjdk.org/projects/jdk/21/);
10-
- [Maven 3.9.9](https://maven.apache.org/);
11-
- [Spring](https://spring.io/) for bean lifecycle management, dependency injection and configuration properties;
12-
- [REST Assured](https://rest-assured.io/) REST API client library;
13-
- [Project Lombok](https://projectlombok.org/)
14-
- [JUnit 5](https://junit.org/junit5/) testing framework
15-
- [AssertJ](https://assertj.github.io/doc/) for assertions;
16-
- [Allure](https://docs.qameta.io/allure/) reporting framework
17-
- [Jackson](https://github.com/FasterXML/jackson) for serialization/deserialization
11+
- [Java 21](https://openjdk.org/projects/jdk/21/): A modern version of Java that offers enhanced performance, security,
12+
and new features.
13+
- [Maven 3.9.9](https://maven.apache.org/): The build automation tool to manage dependencies and build processes.
14+
- [Spring Boot](https://spring.io/projects/spring-boot/): For dependency injection (DI) and easy management of
15+
configuration properties.
16+
- [REST Assured](https://rest-assured.io/): A powerful REST API client library used for sending HTTP requests and
17+
validating responses.
18+
- [JUnit 5](https://junit.org/junit5/): The testing framework for writing and running tests. It supports both
19+
traditional and parameterized tests.
20+
- [Project Lombok](https://projectlombok.org/): To reduce boilerplate code, such as getters, setters, and constructors.
21+
- [AssertJ](https://assertj.github.io/doc/): A fluent assertion library used for clearer and more readable assertions in
22+
tests.
23+
- [Jackson](https://github.com/FasterXML/jackson): For JSON serialization and deserialization, making it easier to
24+
handle JSON data.
25+
- [Log4j2](https://logging.apache.org/log4j/): A powerful and flexible logging framework used to log detailed
26+
information during test execution, enabling efficient troubleshooting and analysis.
27+
- [Allure Report](https://docs.qameta.io/allure/): A framework to generate interactive and visual test reports.
1828

19-
## Installation guide
29+
## Testing Services
2030

21-
Project usage requires next to be installed:
31+
The framework is designed to test REST APIs from different services:
2232

23-
- Java 21;
24-
- Git;
25-
- [Allure CLI](https://www.npmjs.com/package/allure-commandline)
33+
- [Reqres API](https://reqres.in/): A mock API for testing user registration and login.
34+
- [Travelpayouts API](https://travelpayouts.github.io/slate/): An API for accessing data related to travel.
2635

27-
## Clone the project from GitHub:
36+
## Key Features
37+
38+
- **API and Data-Driven Testing:** The framework includes both traditional API tests and parameterized tests (using
39+
`@ParameterizedTest` in JUnit 5) to demonstrate data-driven testing approaches.
40+
- **Parallel Test Execution:** Tests can be executed in parallel to reduce test suite runtime.
41+
- **Logging:** Utilizes `@Log4j2` for detailed logging during test execution, with configuration managed through the
42+
`log4j2.xml` file.
43+
- **Allure Reporting:** Generates detailed test execution reports to visualize results. Allure reports are available
44+
online at **[Allure Report](https://alex-sviatenko.github.io/rest-assured-test-automation/)**, providing
45+
insights into testing results and trends.
46+
47+
## Getting Started
48+
49+
### Prerequisites
50+
51+
- JDK 21 or higher.
52+
- Git
53+
- Maven for build and dependency management.
54+
- [Allure Commandline](https://www.npmjs.com/package/allure-commandline/)
55+
56+
### Clone repository
57+
58+
1. [Fork](https://github.com/alex-sviatenko/rest-assured-test-automation/fork) the repository.
59+
2. Clone the repository and navigate to the project
2860

2961
```
30-
$ cd project_repo
31-
$ git clone git@github.com:alex-sviatenko/jupiter-test-automation.git
62+
$ git clone https://github.com/[your_username]/rest-assured-test-automation.git
63+
$ cd rest-assured-test-automation
3264
```
3365

34-
# Running Tests
66+
## Running Tests
3567

36-
Example:
68+
To run the tests, simply execute:
3769

3870
```shell
3971
./mvnw clean test
4072
```
41-
## Parallel Test Execution
4273

43-
To run test in parallel mode use Junit runner with following properties:
44-
> systemProperty "junit.jupiter.execution.parallel.enabled", true
45-
> systemProperty "junit.jupiter.execution.parallel.mode.default", "concurrent"
46-
> systemProperty "junit.jupiter.execution.parallel.mode.classes.default", "concurrent"
47-
> systemProperty "junit.jupiter.execution.parallel.config.strategy", "fixed"
48-
> systemProperty "junit.jupiter.execution.parallel.config.fixed.parallelism", 3
74+
For parallel execution, ensure the appropriate configurations for JUnit are set in the `junit-platform.properties` file.
4975

50-
## Retry Flaky Tests
76+
## Parallel Test Execution with JUnit 5
5177

52-
You may re-run flaky tests. Set the **rerunFailingTestsCount** property to be a value larger than 0. Tests will be run until they pass or the number of reruns has been exhausted.
53-
```shell
54-
./mvnw clean test -Dsurefire.rerunFailingTestsCount=2
78+
To optimize test suite runtime, tests can be executed in parallel. This reduces the overall execution time, especially
79+
when dealing with a large number of tests. JUnit 5 supports parallel execution of tests out of the box with simple
80+
configuration settings.
81+
82+
To enable parallel test execution, you need to add the following properties to the JUnit runner configuration. These
83+
settings control how tests are executed in parallel and can be adjusted based on your project needs.
84+
85+
```properties
86+
junit.jupiter.execution.parallel.enabled=true
87+
junit.jupiter.execution.parallel.mode.default=concurrent
88+
junit.jupiter.execution.parallel.config.strategy=fixed
89+
junit.jupiter.execution.parallel.config.fixed.parallelism=5
5590
```
56-
You may add the configuration directly to your pom.xml file under the Surefire plugin configuration. This way, you won't need to pass the **-Dsurefire.rerunFailingTestsCount** property on the command line.
91+
92+
Let’s break down what each of these settings means:
93+
94+
1. `junit.jupiter.execution.parallel.enabled = true`
95+
96+
This setting enables the parallel execution feature of JUnit 5. By default, parallel execution is disabled, so you
97+
need to explicitly set this property to true to activate it.
98+
99+
2. `junit.jupiter.execution.parallel.mode.default = concurrent`
100+
101+
This setting defines the default mode for test execution.
102+
103+
- `concurrent:` Tests will be executed concurrently (in parallel) by JUnit 5. This is the mode you'll want to use when
104+
aiming to reduce runtime and fully utilize parallelism.
105+
- Other options include `same_thread` (which runs all tests in the same thread) and `dynamic` (which adapts to parallel
106+
execution depending on the situation).
107+
108+
3. `junit.jupiter.execution.parallel.config.strategy = fixed`
109+
110+
This setting determines how the parallel execution strategy is configured.
111+
112+
- `fixed:` This option allows you to specify a fixed level of parallelism, i.e., the number of test threads that should
113+
run concurrently. You define this value through the next setting.
114+
- Another option, `dynamic`, adjusts the parallelism dynamically based on the system's available resources, but a fixed
115+
approach provides more predictable and stable execution.
116+
117+
4. `junit.jupiter.execution.parallel.config.fixed.parallelism = 5`
118+
119+
This setting specifies the fixed number of threads (parallelism) JUnit will use to run tests concurrently. In this
120+
case, it is set to 5, meaning a maximum of `5` tests will run simultaneously. You can adjust this number based on the
121+
available resources on your machine or CI server to find the optimal level of parallelism.
122+
123+
## Flaky Test Retry Mechanism
124+
125+
The framework includes a **Retry Flaky Tests** mechanism, enabling automatic re-runs for failing tests to ensure
126+
stability
127+
in case of intermittent failures. This can be configured with:
128+
129+
- Command-line option:
130+
131+
```shell
132+
./mvnw clean test -Dsurefire.rerunFailingTestsCount=2
57133
```
134+
135+
- Maven `pom.xml` configuration:
136+
137+
```xml
58138
<plugin>
59-
<groupId>org.apache.maven.plugins</groupId>
60-
<artifactId>maven-surefire-plugin</artifactId>
61-
<version>${maven.surefire.plugin}</version>
62-
<configuration>
63-
<rerunFailingTestsCount>2</rerunFailingTestsCount>
64-
</configuration>
139+
<groupId>org.apache.maven.plugins</groupId>
140+
<artifactId>maven-surefire-plugin</artifactId>
141+
<version>${maven.surefire.plugin}</version>
142+
<configuration>
143+
<rerunFailingTestsCount>2</rerunFailingTestsCount>
144+
</configuration>
65145
</plugin>
66146
```
67-
This will configure the Surefire plugin to automatically rerun failing tests 2 times without needing to pass the property via the command line.
68-
If **rerunFailingTestsCount** is set to a value smaller than or equal to 0, then it will be ignored.
69147

148+
This setup ensures that failing tests are re-run up to `2` times (or any other specified value) before they are marked
149+
as failed. If `rerunFailingTestsCount` is set to a value smaller than or equal to 0, then it will be ignored.
70150

71-
# Creating Allure report
151+
## Allure Report
72152

73-
To create allure report execute command:
74-
1. If you need to save the report for future reference or for sharing it with colleagues. It will generate test results and saves an HTML report into the **allure-report** directory
75-
```
76-
$ allure generate ./target/allure-results/ --clean
77-
$ allure open
78-
```
153+
The reports can be generated and opened with:
79154

80-
2. If you need to create the same report as **allure generate**, but put it into a temporary directory and start a local web server configured to show this directory's contents. The command then automatically opens the main page of the report in a web browser.
155+
- Option 1:
81156

157+
```shell
158+
allure generate ./target/allure-results/ --clean
159+
allure open
82160
```
83-
$ allure serve ./target/allure-results/
161+
162+
`--clean` - clean Allure report directory before generating a new one.
163+
164+
- Option 2:
165+
166+
```shell
167+
allure serve ./target/allure-results/
84168
```

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<modelVersion>4.0.0</modelVersion>
55

66
<groupId>com.jupiter</groupId>
7-
<artifactId>jupiter-test-automation</artifactId>
7+
<artifactId>rest-assured-test-automation</artifactId>
88
<version>0.0.1-SNAPSHOT</version>
9-
<name>jupiter-test-automation</name>
10-
<description>demo test automation project</description>
9+
<name>rest-assured-test-automation</name>
10+
<description>rest-assured test automation framework</description>
1111

1212
<properties>
1313
<java.version>21</java.version>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
spring.application.name=jupiter-test-automation
1+
spring.application.name=rest-assured-test-automation
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
junit.jupiter.execution.parallel.enabled = true
2-
junit.jupiter.execution.parallel.mode.default = concurrent
3-
junit.jupiter.execution.parallel.config.strategy = fixed
4-
junit.jupiter.execution.parallel.config.fixed.parallelism = 5
1+
junit.jupiter.execution.parallel.enabled=true
2+
junit.jupiter.execution.parallel.mode.default=concurrent
3+
junit.jupiter.execution.parallel.config.strategy=fixed
4+
junit.jupiter.execution.parallel.config.fixed.parallelism=5

0 commit comments

Comments
 (0)