Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fatimazza/supertestapi
API Testing using Supertest, Mocha, and Chai
https://github.com/fatimazza/supertestapi
api-testing chai javascript mocha mochawesome-report supertest supertest-mocha-chai
Last synced: 9 days ago
JSON representation
API Testing using Supertest, Mocha, and Chai
- Host: GitHub
- URL: https://github.com/fatimazza/supertestapi
- Owner: Fatimazza
- Created: 2023-03-15T05:39:31.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-05-30T11:03:11.000Z (over 1 year ago)
- Last Synced: 2024-11-17T08:31:48.946Z (2 months ago)
- Topics: api-testing, chai, javascript, mocha, mochawesome-report, supertest, supertest-mocha-chai
- Language: JavaScript
- Homepage:
- Size: 72.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Supertest API Testing
:sparkles: API Testing using Javascript, Supertest, Mocha, Chai, and Mochawesome for HTML Report. :sparkles:## Preparation
What will be used on this project
| Item | Source |
| -------------- | ------------------------------------------------------------ |
| Editor | VS Code (https://code.visualstudio.com/download) |
| Package Manager| NPM (https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) |
| API Test Tools | Chai (https://www.npmjs.com/package/chai) |
| | Supertest (https://www.npmjs.com/package/supertest) |
| | Babel Core - Language API: Node (https://babeljs.io/setup) |
| Test Reporter | Mochawesome (https://www.npmjs.com/package/mochawesome) |
| Run on | Terminal or Command Prompt |## Pre-Requisite Installation
Install VS Code Editor and NPM.
To check whether you already installed NPM & Node.js
```Bash
npm --version
```
```Bash
node --version
```## Setting up Project
### Clone
**👉 [Clone this Repository](https://github.com/Fatimazza/SupertestAPI/)** through Terminal or Command Prompt
### Open the Project on Editor
Open this Automation Project using VS Code Editor.
### Testing Tools Installation
Change to Project directory on Terminal or Command Prompt
```Bash
cd SupertestAPI
```Install Chai
```Bash
npm install chai
```Install Supertest
```Bash
npm install supertest
```Install Babel
```Bash
npm install --save-dev @babel/core
```Install Mochawesome Reporter
```Bash
npm install mochawesome
```### Run the Automation Project
Change to Project directory on Terminal or Command Prompt
```Bash
cd SupertestAPI
```Run All Tests on Terminal
```Bash
npm run test test/api/
``````Bash
mocha test/api/
```Run Specific Test
```Bash
npm run test test/api/petStoreAPITesting.js
``````Bash
mocha test/api/petStoreAPITesting.js
```### Generate Test Execution HTML Report
Run API Test with the Reporter
> Note: Please wait until all test execution finished
All Test
```Bash
npx mocha --spec test/api/ --reporter mochawesome --reporter-options reportFilename=allPetStoreAPITesting
```Specific Test
```Bash
npx mocha --spec test/api/petStoreAPITesting.js --reporter mochawesome --reporter-options reportFilename=petStoreAPITesting
```Test HTML Report
:white_check_mark: available on /SupertestAPI/mochawesome-report/allPetStoreAPITesting.html
:white_check_mark: available on /SupertestAPI/mochawesome-report/petStoreAPITesting.html