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
- High Fidelity Stateful Mocks (Consumer Contracts) with OpenAPI and KarateDSL
And ZenWave KarateIDE VSCode extension: The best user experience for KarateDSL+OpenAPI... by far!!
- 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
- 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
- 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.java
Best!!