test-contract

Implement contract tests validating DataStore-like protocols across in-memory, SQLite, and mock implementations.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/mazicimert/RunDom --skill test-contract-mazicimert
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-contract
Source: https://github.com/mazicimert/RunDom/tree/main/.claude/skills/testing/test-contract
Command: npx skills add https://github.com/mazicimert/RunDom --skill test-contract-mazicimert

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill lets teams define a single contract of behaviors and automatically validate every implementation against it, ensuring consistent adherence across mocks, in-memory stores, or real data sources.

Core Features & Use Cases

  • Contract-driven testing: Write one set of tests that all implementations must satisfy.
  • Supports multiple implementations (InMemory, SQLite, MockCloud) and ensures behavior parity.

Quick Start

Run the contract tests against all DataStore implementations to verify consistent behavior.

Frequently Asked Questions about test-contract

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

FAQPage Schema
How do I write contract tests that validate a DataStore protocol across multiple implementations?

Contract tests validate a DataStore protocol by defining a single authoritative specification that all implementations must satisfy. You write one generic test suite covering CRUD, fetchAll, and invariants to automatically verify protocol conformance.

What are protocol invariants and how do they enforce behavior parity in mock data stores?

Protocol invariants are specific rules and edge-case conditions that any DataStore-like implementation must enforce. By running a shared contract test suite against in-memory, SQLite, and mock implementations, invariants guarantee identical behavior parity across all data sources.

Can I use contract testing to ensure my SQLite and in-memory data stores have matching behavior?

Yes, contract testing ensures SQLite and in-memory data stores have matching behavior by validating both against a single authoritative specification. The generic contract test suite automatically checks CRUD operations, fetchAll, and edge-case handling for consistent protocol conformance.

What is the best way to enforce protocol conformance on test doubles like mock cloud implementations?

The best way to enforce protocol conformance on test doubles is applying a reusable contract test suite. This suite validates that mock cloud implementations adhere to the same authoritative specification and invariants as real data sources, ensuring reliable test doubles.

Do I need a separate test suite for each DataStore implementation to verify protocol conformance?

No, you do not need separate test suites. Contract testing uses one generic, reusable test suite that validates any DataStore-like protocol against a single authoritative specification, automatically verifying CRUD, fetchAll, and invariants across all implementations.

Why does my mock DataStore fail to adhere to the same protocol behaviors as my real database?

A mock DataStore fails protocol adherence when it lacks proper contract tests validating edge-case handling and invariants. Implementing a generic contract test suite against an authoritative specification identifies and resolves behavior mismatches between mocks and real data sources.