Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

API Testing using supertest, mocha and chai.

License

NotificationsYou must be signed in to change notification settings

mfaisalkhatri/SuperTest_poc

Repository files navigation

Open Source LoveLicenseNode.js CI

Don't forget to give a ⭐ to make the project popular.

What is it all about?

I have been using Rest-Assured framework all the time for testing APIs with Java. But this time it was my project's demand to perform API testing in Javascript.Being a newbie to JS, I googled for some tools and foundSuperTest.To introduceSuperTest, it is a high level abstraction of HTTP requests, making it perfect for testing APIs.I decided to do a POC of this tool to understand it better, hence this project was created.I thought of sharing this on github, so it helps others as well who want to learn more about this tool.Checkoutthis link to learn more aboutSuperTest

Getting Started:

You need to have the following installed in your machine:

  1. Node (Latest Version).
  2. npm(Latest Version).
  3. mocha framework is used for writing tests andchai for assertions, following command should help to install the required npm packages:npm i -D -g supertest mocha chai mochawesome
  4. For running the tests, you need to type the command:npm run test.(Check Package.json for more details)
  5. For generating the mochawesome report, run the commandnpm run report(Check Package.json for more details.) It will generate and export the report inmochawesome-report folder from which you can open theindex.html file to view the report.

Talking more about the Scenarios Covered in this project:

  • I have covered,GET,POST,PUT,PATCH andDELETE requests. You will find the example code in the test folder of the repository.

  • End to End scenarios have been added for the restful booker APIs. If you need to get into more details abouthow to write tests using supertest, mocha and chai?, this blog is all you need to refer and get started.

  • Mochawesome reporter is used to generate the reports and show summary of the tests. I found it quite useful report as it shows the test description alongwith the tests and the time taken to run the tests.

❓ Need Assistance?

  • Discuss your queries by writing to me @mohammadfaisalkhatri@gmail.comOR ping me on any of the social media sites using the below link:

🚀 Trainings and Guidance

  • Contact me for 1:1 trainings/guidance for Software Testing, Mock Interviews, Test Automation tools queries, Mentoring and Coaching.

💭 Checkout the blogs related to Software Testing on mywebsite


[8]ページ先頭

©2009-2025 Movatter.jp