You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-15Lines changed: 14 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,8 +15,7 @@ This project aims to create a maintainable test framework, implement reusable co
15
15
This API test automation framework utilizes TestNG and REST Assured, managed with Maven for building, and generates clear, insightful reports using Allure Report.
16
16
It provides a set of predefined test cases to ensure bookstore API functions behave as expected.
17
17
18
-
19
-
### ⚙️ Tech Stack
18
+
### Tech Stack:
20
19
-**Programming Languages**: Java, JavaScript
21
20
-**Testing Framework**: TestNG
22
21
-**API Testing Library**: REST Assured
@@ -25,7 +24,7 @@ It provides a set of predefined test cases to ensure bookstore API functions beh
25
24
-**CI/CD**: GitHub Actions
26
25
-**Backend API**: Express.js (Node.js)
27
26
28
-
### ✅ Requirements
27
+
### Requirements:
29
28
Requires **Java 22**, **Maven 3.9.x**, and **Allure Report 2.33.x** to be installed and properly configured on your local machine.<br/>
30
29
31
30
## Table of Contents
@@ -37,21 +36,21 @@ Requires **Java 22**, **Maven 3.9.x**, and **Allure Report 2.33.x** to be instal
37
36
6.[CI/CD Pipeline with GitHub Actions](#six)
38
37
39
38
<aid="one"></a>
40
-
## 1. Setting up REST API using Express.js
39
+
###1. Setting up REST API using Express.js
41
40
The REST API, built with **Express.js**, is already set up and configured for immediate use.
42
41
The following steps provide details for understanding the setup process and exploring the existing configuration:<br/>
43
42
44
-
### Step 1. Project Initialization:
43
+
####Step 1. Project Initialization:
45
44
A new project directory (`api-bookstore/`) was created, and `npm init -y` command was used to initialize the project.
46
45
This generates a `package.json` file, which is essential for managing project dependencies.
47
46
48
-
### Step 2. Installing Dependencies:
47
+
####Step 2. Installing Dependencies:
49
48
The following dependencies were installed by running `npm install express body-parser nodemon`:
50
49
*`express` - the Express.js framework for building the API.
51
50
*`body-parser` - middleware for parsing request bodies, allowing easy access to data sent in POST and PUT requests.
52
51
*`nodemon` - utility that automatically restarts the server upon file changes, enhancing the development experience.
53
52
54
-
### Step 3. Creating `server.js`:
53
+
####Step 3. Creating `server.js`:
55
54
The core logic of the API resides in the `server.js` file. It handles routing, request processing, and data management, performing the following key tasks:
56
55
* Loads necessary libraries like Express.js for routing and request handling, and middleware for parsing incoming data.
57
56
* Creates an instance of the Express application, which serves as the foundation for the API.
@@ -62,7 +61,7 @@ The core logic of the API resides in the `server.js` file. It handles routing, r
62
61
63
62
You can explore the `server.js` file in the `api-bookstore/` directory for more details on the API implementation.
64
63
65
-
### Step 4. Configuring `package.json`:
64
+
####Step 4. Configuring `package.json`:
66
65
The `package.json` is an important file in Node.js projects. It has several critical functions:
67
66
* Contains **metadata** about the project, such as name, version, description, author, license, etc.
68
67
* Indicates **dependencies** which other packages (libraries) your project depends on. The `npm` uses this information to install the necessary packages.
@@ -73,14 +72,14 @@ You can explore the `package.json` file in the `api-bookstore/` directory for mo
73
72
It is used to define dependencies (**express**, **body-parser**, **nodemon**) and scripts (`start`, `dev`).
74
73
This helps to quickly set up the project by simply running `npm install`.
75
74
76
-
### Step 5. Run server:
75
+
####Step 5. Run server:
77
76
To start the server in development mode, use the following command `npm run dev`.
78
77
This command leverages `nodemon` to automatically restart the server whenever file changes are detected.
79
78
Upon successful startup, you should see a message similar to _"Server is running on port 3000"_ in your terminal, confirming that the API is active and listening for requests.
80
79
81
80
82
81
<aid="two"></a>
83
-
## 2. Framework Structure
82
+
###2. Framework Structure
84
83
The framework's architecture is built on a structured directory organization to ensure scalability and maintainability:<br/>
85
84
```
86
85
|--online-bookstoore-frmk/
@@ -112,7 +111,7 @@ The framework's architecture is built on a structured directory organization to
112
111
113
112
114
113
<aid="three"></a>
115
-
## 3. Creating API Test Scenarios
114
+
###3. Creating API Test Scenarios
116
115
Creating API test scenarios involves defining test data and expected API behavior.<br/>
117
116
118
117
**Steps to Build API Test Scenarios:**
@@ -123,7 +122,7 @@ Creating API test scenarios involves defining test data and expected API behavio
123
122
124
123
125
124
<aid="four"></a>
126
-
## 4. API Test Execution
125
+
###4. API Test Execution
127
126
This project uses **Maven** for dependency management and build automation. The base URL for the API tests can be configured by creating a hidden `.env` file and defining the `BASE_URL` parameter.
128
127
The default value is `http://localhost:3000/api/v1/`, but this setting can be modified directly within the `server.js` file.<br/>
129
128
@@ -145,7 +144,7 @@ _Parameters:_<br/>
145
144
146
145
147
146
<aid="five"></a>
148
-
## 5. Generate Allure REST Assured Report
147
+
###5. Generate Allure REST Assured Report
149
148
Before running tests, it's crucial to clean up any existing test results and reports. This ensures that your report accurately reflects the most recent test run.
150
149
Use the following command to remove the `allure-report` and `allure-results` directories:<br/>
151
150
```bash
@@ -175,14 +174,14 @@ allure serve
175
174
```
176
175
This command starts a local web server and automatically opens the generated report in your default browser.
177
176
178
-
### Allure Report Overview:
177
+
####Allure Report Overview:
179
178
An example of the generated Allure report looks like this:<br/>
This project utilizes a CI/CD pipeline configured using GitHub Actions. The pipeline automates the testing process, ensuring that every code change is thoroughly validated.
187
186
The configuration file for the workflow is located at `.github/workflows/ci.yml`.
0 commit comments