sadabnepal / pactum-api-test

api testing using pactum with mock services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

api testing using pactum js with mock data

getting started

git clone https://github.com/sadabnepal/pactum-api-test.git
cd pactum-api-test

pre-requisite

NodeJs VSCode

set environment

export ENV=local  
      OR
export ENV=dev

run test

npm run test

stub details

The project is using pactum mock which provides following endpoints

GET: /api/users/{id} fetches the user information by user id
POST: /api/users fetches the user with query parameter { page: 2 }
POST: /api/users creates user with body { name: 'Ken', job: 'Test Engineer' } GET: /bearer authenticate user with token that includes Bearer

learning references:

pactum: https://pactumjs.github.io/introduction/welcome.html
supertest: http://visionmedia.github
mocha: https://ricostacruz.com/mocha/
mocha config: https://github.com/mochajs/mocha/tree/master/example/config
eslint: https://eslint.org/docs/latest/use/getting-started
vscode settings: https://code.visualstudio.com/docs/getstarted/settings
Blog: https://medium.com/@joaovitorcoelho10/pactumjs-a-next-gen-rest-api-testing-tool-ae88a9e51916

TODO:

  - better reusable http calls

About

api testing using pactum with mock services


Languages

Language:TypeScript 86.2%Language:JavaScript 13.8%