Contract Testing

Contract testing with moclojer - validate API contracts, OpenAPI specs, and ensure frontend-backend compatibility with automated testing.

Use moclojer to validate API contracts between frontend and backend teams.

🎯 Approach

  1. Define contract (OpenAPI spec)

  2. Mock with moclojer (frontend development)

  3. Validate backend matches contract

πŸ“ OpenAPI Contract

# api-contract.yaml (OpenAPI 3.0)
openapi: 3.0.0
info:
  title: Users API
  version: 1.0.0
paths:
  /users:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                    name:
                      type: string

πŸ§ͺ Test Contract

πŸ“š See Also

Last updated

Was this helpful?