JDK 17+ OR Specmatic VS Code Plugin
From a terminal, run the following command:
mvn clean test
You should see 38 failing tests:
[ERROR] Tests run: 38, Failures: 38, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
- Install Specmatic VS Code Plugin
- Launch command pallet and type "Run Contract Tests", this should launch the Specmatic plugin
- In the Contract Test Settings screen, update the following:
- Update API specification file to ./products_api.yaml
- Select the checkbox for Generative tests
- Click on the "Save and Run" button
- You should see 38 failing tests:
[ERROR] Tests run: 38, Failures: 38, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
Your objective is to get all the tests to pass by following the rest of the instructions.
- Watch the Contract-Driven Development - Turn your API Specification into Executable Contracts video on Specmatic.
- This will really help you to understand how Specmatic works and is necessary background/context about the project.
- This is a Kotlin based Spring Boot application.
- You are expected to implement the missing endpoints in the Products controller.
- You are not expected to use a database. Instead, use an in memory map to store and retrieve products.
- Feel free to leverage GPT or Github Copilot.
- Please do not alter the following files:
- ContractTest.kt
- products_api.yaml
- specmatic.json
- Any your choise of programming language and Web API framework.
- You are expected to implement the missing endpoints.
- All 38 tests are passing
- 100% API Coverage from 1 path is achieved
- Code changes are committed to your Github repo.
- Update the products_api.yaml OpenAPI specification such that 'cost' is added as a new mandatory property to ProductDetails
- This will increase the test count to 50 and cause a few tests to fail
- Update your kotlin code to make all the tests pass again.
- All 50 tests are passing
- 100% API Coverage is still maintained
- Code changes are committed to your Github repo.
- Make sure all tests are passing on the pipeline as well.
- Email the following details to coding.test@specmatic.in:
- Screenshot of passing CI pipeline
- Screenshot of API Coverage report
- Link to you github repo