|
| 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 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +## :thought_balloon: Checkout the blogs related to Software Testing on my [website] |
| 45 | +[website]: https://www.codewithmmak.com/ |
0 commit comments