This project contains API automation tests for the Swagger Petstore API using PactumJS with Mocha.
- Shared test bootstrap in
tests/api/support/setup.js - Environment-driven base URL
- API key support via environment variables (
API_KEY,API_KEY_HEADER) - Mochawesome HTML reporting
- ESLint quality checks
- GitHub Actions CI for pull requests and pushes
tests/api/specs/pet/- Petstore API test specstests/api/fixtures/pet/- request payloads and reusable JSON datatests/api/services/petService.js- Petstore request builderstests/api/constants/- shared status codestests/api/support/- shared test bootstrap.github/workflows/- CI pipelines
- Node.js 20 or newer
- npm
-
Install dependencies:
npm install
-
Create local environment file:
cp .env.example .env
-
Optional: use the provided Petstore env file directly:
config/env/.env.petstore
-
Run Petstore suite:
npm test -
Run Petstore suite with explicit API key requirement:
npm run test:petstore:auth
-
Run lint:
npm run lint
-
Run CI-equivalent local check:
npm run test:ci
After test execution, open:
mochawesome-report/mochawesome.html
- Do not commit
.envfiles. - Use
.env.exampleas the source of required environment variables.
