- Movie service
- List of movies
- Get movies by id
$npm install
$npm run provider:start
List of URLs of provider
- API document with Swagger
- Get all movies
- Get movie by id
Provider testing with Postman and newman
- Design test cases ?
- What to test ?
$npm install -g newman
$newman run <collection-file>
Working with HTML report
$npm install -g newman-reporter-htmlextra
$newman run <collection-file> -r htmlextra,cli
- Design test cases ?
- What to test ?
- Test files in folder
provider/component-tests/
$npm run provider:test
- Call data from provider via HTTP
- Provider vs Consumer
- File
consumer/contract-tests/consumer-contract.spec.js
$npm run consumer:contract-test
Result :: Contract file in folder /pacts
- Download and configuration Pact standalone executables
Run
$pact-broker version
1.77.0
Publish contract file to Pact broker
$export PACT_BROKER_BASE_URL=<url of broker>
$npm run publish:pact
$export PACT_BROKER_BASE_URL=<url of broker>
$npm run provider:verify
Start provider server
$npm run provider:start
Run verify again
$npm run provider:verify
- Folder
consumer-ui/
$npm run comsumer-ui:start
List of URLs
5. Contract testing with PactJS + Consumer Adapter
- Cypress adapter
- Playwright adapter
- Folder
cypress/
$npm i -D cypress
$npm i -D @pactflow/pact-cypress-adapter
$npm run consumer-ui:contract-test
Result :: Pact contract file in folder cypress/pacts
- MoviesAPI-UIConsumer.json