Skip to content

Automation of GET< PUT < POST < DELETE using Jest in TypeScript

Notifications You must be signed in to change notification settings

Zahid-Automate/TypeScript-API-Automation

Repository files navigation

Setup

Install packages:
npm install --save-dev supertest
npm install --save-dev ts-jest
npm i @types/[email protected] (make sure to match with @types/jest dependency)
npm install --save @types/jest
npm install --save @types/supertest

Package.json file should look like below after all the above commands are run

image

Add tsconfig.json file with below details

image

Run test

npx jest {filename}

Reporting with Jest using Junit

npm install jest-junit --save-dev

==> Include the reporters section in jest.config.js as per below

image

Sample junit xml report will look like below

image

Adding a Jest HTML report


npm install jest-html-reporters --save-dev

==> Include the jest-html-reporters in jest.config.js as per below

image

Sample jest HTML report will look like below

_C__Users_mzahi_Desktop_TypeScript-API-Automation_reports_jest_html_reporters html(iPad Pro)

About

Automation of GET< PUT < POST < DELETE using Jest in TypeScript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published