API testing in Swagger Petstore with Mocha and Chai
| Path | Description |
|---|---|
| test/ | We create all the necessary folders and files to organize and create our test case scenarios |
| support/ | We create the functions to support the test cases |
| endpoints.js | We have the endpoints we are using |
| package.json | We have all the information of the project dependencies |
You’ll need Node.js installed. Install at least v12.16.1 or higher as this is the oldest active LTS version.
To install the framework, you must follow the following steps:
-
git clone https://github.com/squella/api-testing.git -
npm install
Now, time to run your tests! To do so, just run:
npm test
To create a new test case, you must follow the following steps:
-
Go to the tests folder and create a new test file where you will put the description of the test with its respective expect (or assert) -
Create a new function file in the support area to create the functions that you will implement in the test cases -
Run the test cases