Skip to content

Commit 8dcf605

Browse files
authored
Initial commit
1 parent bec1017 commit 8dcf605

File tree

13 files changed

+3008
-0
lines changed

13 files changed

+3008
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# API Testing using SuperTest, Mocha, and Chai
3+
<img src="assets/API-Testing-using-SuperTest-Mocha-Chai-and-FakerJS.png"/>
4+
---
5+
6+
## :Star: the project if you like the work.
7+
8+
## Getting started
9+
10+
### Pre-requisites
11+
* Download and install Node.js
12+
* Download and install any Text Editor like Visual Code/Sublime/Brackets
13+
* Initilize the project with default settings `npm init -y`
14+
* Install dependencies `npm install --save-dev supertest mocha chai mochawesome @faker-js/faker`
15+
16+
### Setup Visual Code
17+
* Install GitLens Extension from the Marketplace: `GitLens — Git supercharged by GitKraken`
18+
* Go to Visual Code Preference > Setting and search `formatOnSave` and enable/ON it.
19+
20+
### Setup Git Repo
21+
* Clone the repository into a folder
22+
* Go to Project root directory and install Dependency: `npm install`
23+
* All the dependencies from package.json would be installed in node_modules folder.
24+
25+
### How to write Test
26+
* Add new spec under `test-reqres-api` folder
27+
* Name the file as <testname>.e2e.js (e.g. deleteTest.js)
28+
29+
### How to Run Test
30+
* Go to Project root directory and run command: `npm test`
31+
* If you want to run another set of api tests then run command: `npm run test-fakerest`
32+
33+
### How to Update local npm packages
34+
* Go to Project root directory and run command: `npm update`
35+
36+
### How to view HTML report
37+
* Go to Project root directory: `./allure-results/index.html`
38+
39+
### Sample Test Results
40+
![WebDriverIO and JavaScript Test Report](./assets/Allure-Report.png?raw=true "WebDriverIO and JavaScript Test Report")
41+
42+
![WebDriverIO and JavaScript Test Report Expanded View](./assets/Allure-Report-Detailed-View.png?raw=true "WebDriverIO and JavaScript Test Report Expanded View")
43+
44+
## :thought_balloon: Checkout the blogs related to Software Testing on my [website]
45+
[website]: https://www.codewithmmak.com/
212 KB
Loading

config/fakerestapi.config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"baseUrl": "https://fakerestapi.azurewebsites.net"
3+
}

config/reqres.config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"baseUrl": "https://reqres.in"
3+
}

0 commit comments

Comments
 (0)