Langsung ke konten
Skillpedia
Testing75k Β· #2787

contract-testing

Fungsinya

Skill ini menjelaskan cara menulis pengujian yang mendeskripsikan apa yang diharapkan frontend dari backend, lalu memeriksa bahwa backend memenuhinya. Cocok untuk tim yang frontend dan backend-nya di-deploy secara terpisah.

Kapan dipakai

  • βœ“Saat perubahan frontend dan backend sering saling merusak.
  • βœ“Saat pengujian end-to-end lambat dan rapuh karena kedua layanan harus berjalan bersama.
  • βœ“Saat Anda ingin tahu apakah dua layanan dapat di-deploy secara mandiri.

Link skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/contract-testing/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/contract-testing/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œAtur contract test antara aplikasi frontend saya dan API-nya agar perubahan backend yang merusak tertangkap di CI.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent menambahkan pengujian konsumen Pact untuk klien API, menerbitkan kontrak yang diharapkan ke broker, dan menambahkan verifikasi provider ke pipeline backend.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Implement consumer-driven contract testing for API boundaries

Integration tests that require both services running at the same time are slow, brittle, and hard to maintain. Consumer-driven contract testing decouples the consumer and provider test suites β€” each team can run their tests independently, yet the broker guarantees that the published contract is always verified against the live provider. This catches API mismatches days earlier than end-to-end tests, with far less infrastructure overhead.

Quick Reference

  • The consumer writes tests that describe what it expects from the API (the "contract")
  • The contract is published to a Pact Broker and verified against the real provider
  • Provider changes that break the contract fail CI before they are deployed
  • This replaces fragile end-to-end tests that require both services to be running simultaneously

Check

Check whether the frontend has consumer-driven contract tests that define and verify the API contract with the backend.

Fix

Add Pact consumer tests for the frontend API client, publish the contracts to a broker, and add provider verification to the backend CI pipeline.

Explain

Explain how consumer-driven contract testing works, what the Pact workflow looks like end-to-end, and how it compares to mocking and end-to-end testing.

Code Review

Review the Pact consumer tests. Flag interactions that are too permissive (any-type matchers on fields the consumer actually uses), missing status code assertions, and interactions for endpoints the consumer no longer calls.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/testing/contract-testing

Pertanyaan umum

Apa itu contract test?

Pengujian yang mencatat apa yang diharapkan frontend dari sebuah API, lalu memeriksa API sungguhan terhadap harapan tersebut.

Alat apa yang dipakai skill?

Pact, dengan Pact Broker untuk membagikan kontrak.

Apa bedanya dengan pengujian end-to-end?

Skill menyatakan contract test tidak memerlukan kedua layanan berjalan bersamaan, dan menangkap ketidakcocokan lebih awal.

Detail

Deskripsi asli dari pembuat

Use when setting up integration testing for a frontend-backend API boundary, evaluating whether two services are safe to deploy independently, or replacing slow end-to-end tests with contract tests.

repo: thedaviddias/Front-End-Checklist

Popularitas

Bintang GitHub
75k
Peringkat
#2787
Lisensi
MIT
Diperbarui
31/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa