Modern QA2026Provider Verification — tiles
Log inJoin
18 / 89 · 04 API & Contract Testing with AI · Consumer-Driven Contract Testing with Pact← prev⊞ allnext →☰ Read as one page

3.6Provider Verification

The provider team runs verification to ensure they meet all consumer expectations:

# Provider verification (runs against the real provider)
from pact import Verifier

verifier = Verifier(
    provider='ProductService',
    provider_base_url='http://localhost:8080'
)

# Set up provider states
@verifier.provider_state('product ABC-123 exists')
def setup_product_exists():
    db.insert_product(id='ABC-123', name='Blue Widget', price=29.99)

@verifier.provider_state('product NONEXISTENT does not exist')
def setup_product_not_exists():
    db.delete_product(id='NONEXISTENT')

# Verify all pacts from the broker
success = verifier.verify_with_broker(
    broker_url='https://pact-broker.example.com',
    publish_verification_results=True,
    provider_version='1.2.3'
)
assert success