https://github.com/zenwave360/karate-openapi-petstore
Complete Contract Testing solution with KarateDSL and ZenWave APIMock for OpenAPI PetStore demo REST API
https://github.com/zenwave360/karate-openapi-petstore
karate-tests mock-server openapi petstore-api
Last synced: 2 months ago
JSON representation
Complete Contract Testing solution with KarateDSL and ZenWave APIMock for OpenAPI PetStore demo REST API
- Host: GitHub
- URL: https://github.com/zenwave360/karate-openapi-petstore
- Owner: ZenWave360
- Created: 2021-10-07T16:27:45.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-08-21T18:49:01.000Z (almost 2 years ago)
- Last Synced: 2025-03-26T07:03:54.735Z (3 months ago)
- Topics: karate-tests, mock-server, openapi, petstore-api
- Language: Java
- Homepage:
- Size: 82 KB
- Stars: 1
- Watchers: 1
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Karate OpenAPI PetStore Contract Testing Complete source code
This repo contains a complete Contract Testing solution for the online demo REST API at https://petstore3.swagger.io/
You can find very detailed instructions at:
- [From Manual to Contract Testing with KarateDSL and KarateIDE](https://medium.com/@ivangsa/from-manual-to-contract-testing-with-karatedsl-and-karateide-i-5884f1732680)
- [High Fidelity Stateful Mocks (Consumer Contracts) with OpenAPI and KarateDSL](https://medium.com/@ivangsa/high-fidelity-stateful-mocks-consumer-contracts-with-openapi-and-karatedsl-85a7f31cf84e)## It uses:
- [KarateDSL](https://github.com/karatelabs/karate)
- [KarateDSL Mocks](https://github.com/karatelabs/karate/tree/master/karate-netty#server-life-cycle)
- [ZenWave APIMock](https://github.com/ZenWave360/zenwave-apimock)
- [org.openapi4j:openapi-operation-validator](https://www.openapi4j.org/operation-validator.html)And [ZenWave KarateIDE VSCode extension](https://marketplace.visualstudio.com/items?itemName=KarateIDE.karate-ide): The best user experience for KarateDSL+OpenAPI... by far!!
## You may be interested in:
### Tests and Mocks
- Atomic and Data Driven Tests: https://github.com/ZenWave360/karate-openapi-petstore/tree/master/src/test/resources/apis/PetApi
- Business Flow Test (CRUD Pet): https://github.com/ZenWave360/karate-openapi-petstore/blob/master/src/test/resources/apis/PetApi/PetCRUD.feature
- Stateful Pet Mock: https://github.com/ZenWave360/karate-openapi-petstore/blob/master/src/test/resources/mocks/PetMock.feature
- Mock initial DataSet is populated from: https://github.com/ZenWave360/karate-openapi-petstore/blob/master/petstore-openapi.yml#L853
- Mock Validation Test: https://github.com/ZenWave360/karate-openapi-petstore/blob/master/src/test/resources/mocks/mock-validation.feature### Runners for CI/CD Test Automation
- Karate Tests Runner: https://github.com/ZenWave360/karate-openapi-petstore/blob/master/src/test/java/com/petstore/karate/KarateRunnerTest.java
- Karate Tests Coverage Hook: https://github.com/ZenWave360/karate-openapi-petstore/blob/master/src/test/java/com/petstore/karate/KarateRunnerTest.java#L77
- Mocks Validator Runner: https://github.com/ZenWave360/karate-openapi-petstore/blob/master/src/test/java/com/petstore/karate/VerifyMocksTest.java
- Mocks Validator Coverage Hook: https://github.com/ZenWave360/karate-openapi-petstore/blob/master/src/test/java/com/petstore/karate/VerifyMocksTest.java#L77### Consumer Contract Testing and Java API
- Using Karate Mocks as Consumer Contracts in JUnit tests: https://github.com/ZenWave360/karate-openapi-petstore/blob/master/src/test/java/com/petstore/karate/PetstoreCRUDTest.java
- Karate Java API Example: https://github.com/ZenWave360/karate-openapi-petstore/blob/master/src/test/java/com/petstore/karate/PetDownloader.javaBest!!