✨ API Testing using Javascript, Supertest, Mocha, Chai, and Mochawesome for HTML Report. ✨
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 |
Install VS Code Editor and NPM.
To check whether you already installed NPM & Node.js
npm --versionnode --version👉 Clone this Repository through Terminal or Command Prompt
Open this Automation Project using VS Code Editor.
Change to Project directory on Terminal or Command Prompt
cd SupertestAPIInstall Chai
npm install chaiInstall Supertest
npm install supertestInstall Babel
npm install --save-dev @babel/coreInstall Mochawesome Reporter
npm install mochawesomeChange to Project directory on Terminal or Command Prompt
cd SupertestAPIRun All Tests on Terminal
npm run test test/api/mocha test/api/Run Specific Test
npm run test test/api/petStoreAPITesting.jsmocha test/api/petStoreAPITesting.jsRun API Test with the Reporter
Note: Please wait until all test execution finished
All Test
npx mocha --spec test/api/ --reporter mochawesome --reporter-options reportFilename=allPetStoreAPITestingSpecific Test
npx mocha --spec test/api/petStoreAPITesting.js --reporter mochawesome --reporter-options reportFilename=petStoreAPITestingTest HTML Report
✅ available on /SupertestAPI/mochawesome-report/allPetStoreAPITesting.html
✅ available on /SupertestAPI/mochawesome-report/petStoreAPITesting.html