adapter-contract-testing

Validate adapter implementations against a shared abstract contract.

Updated Feb 12, 2026
One-click install
npx skills add https://github.com/martinsson/checkin-automation --skill adapter-contract-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adapter-contract-testing
Source: https://github.com/martinsson/checkin-automation/tree/main/.claude/skills/adapter-contract-testing
Command: npx skills add https://github.com/martinsson/checkin-automation --skill adapter-contract-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Keeps adapters honest by ensuring the same abstract test contract is exercised by both real adapters and simulators, preventing drift when APIs or mock implementations evolve.

Core Features & Use Cases

  • Enforces a canonical contract testing pattern across ports/adapters
  • Ensures one abstract contract class, two concrete test subclasses, and no simulator-only tests to guarantee coverage
  • Facilitates regression safety for ports like SmoobuGateway, RequestMemory, and ReservationCache

Quick Start

Run the contract tests to validate consistency between real adapters and simulators.

Frequently Asked Questions about adapter-contract-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent drift between real adapters and simulators in contract testing?

Contract testing prevents adapter drift by exercising the same abstract test contract through both real adapters and simulators. You enforce one abstract contract class with two concrete test subclasses to validate consistent behavior and prevent mock implementations from evolving away from real APIs.

What is the canonical contract testing pattern for port adapters?

The canonical contract testing pattern for port adapters requires one abstract contract class, two concrete test subclasses, and no simulator-only tests. This structure guarantees cross-implementation coverage and enforces consistent behavior validation across all adapter implementations.

How do I set up pytest contract tests for multiple adapter implementations?

To set up pytest contract tests for multiple adapter implementations, create an abstract contract test class defining the shared behaviors, then subclass it with two concrete test classes that run against the real adapter and simulator respectively to validate cross-implementation coverage.

Why should I avoid simulator-only tests when testing adapter implementations?

Simulator-only tests should be avoided because they break the contract testing pattern and allow simulators to drift from real adapter behavior. The pattern mandates one abstract contract exercised by both implementations to guarantee regression safety and cross-implementation coverage.

Can I use contract testing for pre-seeded data validation across port adapters?

Yes, contract testing supports pre-seeded data validation across port adapters. The contract enforces clear rules for pre-seeded data and cross-implementation coverage, ensuring adapters like SmoobuGateway, RequestMemory, and ReservationCache validate behavior consistently.

What are the limitations of abstract contract test classes for adapter testing?

The abstract contract test class limits you to enforcing exactly one contract with two concrete test subclasses and no simulator-only tests. This rigidity ensures coverage but requires all port adapters and simulators to conform strictly to the shared contract rules for pre-seeded data.