GithubHelp home page GithubHelp logo

specmatic-coding-test's Introduction

Specmatic Coding Test

Prerequisites:

JDK 17+ OR Specmatic VS Code Plugin

Instructions:

1. Fork this repository on Github. Checkout your forked repo to your local machine.

Java/Kotlin Steps

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] ------------------------------------------------------------------------

VS Code Plugin Steps (Programming Lanugage Agnostic)

  1. Install Specmatic VS Code Plugin
  2. Launch command pallet and type "Run Contract Tests", this should launch the Specmatic plugin
  3. 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
  1. You should see 38 failing tests:
[ERROR] Tests run: 38, Failures: 38, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Specmatic VSCode Extension Screenshot

Objective of this Assignment

Your objective is to get all the tests to pass by following the rest of the instructions.

2. Introduction to Specmatic

3. Part 1 - Implement REST endpoints:

Java/Kotlin Steps

  • This is a Kotlin based Spring Boot application.
  • You are expected to implement the missing endpoints in the Products controller.

Note:

  • 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

Other Programming Languages Steps

  • Any your choise of programming language and Web API framework.
  • You are expected to implement the missing endpoints.

4. Part 1 - Definition of Done

  • All 38 tests are passing
  • 100% API Coverage from 1 path is achieved
  • Code changes are committed to your Github repo.

5. Part 2 - Added mandatory property 'cost' to the ProductDetails schema

  • 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.

6. Part 2 - Definition of Done

  • All 50 tests are passing
  • 100% API Coverage is still maintained
  • Code changes are committed to your Github repo.

7. Trigger the CI pipeline under Github Actions.

  • Make sure all tests are passing on the pipeline as well.
  • Email the following details to [email protected]:
    • Screenshot of passing CI pipeline
    • Screenshot of API Coverage report
    • Link to you github repo

specmatic-coding-test's People

Contributors

nashjain avatar poorvi-patil avatar yogeshnikam671 avatar harikrishnan83 avatar poorviipatil avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.