SuperTest | Mocha | Chai | Reporting | JavaScript | Babel | Faker JS | DotEnv |
---|---|---|---|---|---|---|---|
Make sure you have the following installed:
Welcome! To get started with this project, follow these steps:
-
Clone the Repository
git clone https://github.com/Darana-Henry/api-testing-with-javascript.git
-
Install Dependencies
npm i
-
Obtain API Token
- Go to the GoRest Website.
- Create a login account.
- Once logged in, get the generated API token.
-
Create a .env File
- In the root directory, create a file named
.env
. - Add the following property to the
.env
file:USER_TOKEN=your_generated_api_token
- In the root directory, create a file named
Note:You only get the token after you log in. Do not share this token.
You have two options to run the tests for this project:
-
Console Output Only
-
Console Output with HTML Report
-
JUnit Report for Jenkins
-
If you run with Jenkins, and use JUnit Report to publish your reports, you can run:
npm run test-with-junit
-
This will run the tests and output a file named test-results.xml in the root folder.
-
Note: This won't output anything on the console. So it might feel like the test is stuck, but actually it's running in the background.
-
Console Output Only
$ npm test