Skip to main content
This guide shows how to capture and compare API response snapshots to detect regressions. Perfect for ensuring API responses remain consistent over time.

Use Cases

  • Detect API response changes
  • Validate response structure consistency
  • Catch unintended API modifications
  • Monitor API stability over time

Simple Implementation

Setup Instructions

  1. Run initial test to create baseline snapshots
  2. Save snapshots to persistent storage (file/database) for real use
  3. Configure endpoints you want to monitor
  4. Set appropriate thresholds for size and structure changes

What This Tests

  • Response Consistency: Detects when API responses change
  • Structure Stability: Monitors JSON structure changes
  • Field Presence: Ensures required fields remain present
  • Response Size: Tracks significant size changes

Snapshot Components

  • Content Hash: MD5 hash of entire response
  • Structure: JSON structure template
  • Fields: All field names in response
  • Size: Response size in bytes
  • Headers: HTTP response headers

Change Detection

The guide detects:
  • Structure Changes: JSON schema modifications
  • Missing Fields: Required fields removed
  • New Fields: Additional fields added
  • Size Changes: Significant response size changes
  • Status Code Changes: HTTP status modifications

Best Practices

  • Regular Baselines: Update baselines when changes are intentional
  • Threshold Tuning: Adjust change thresholds for your API
  • Persistent Storage: Save snapshots to files or database
  • Change Review: Review all detected changes before deployment

Common Use Cases

  • Regression Testing: Catch unintended API changes
  • API Monitoring: Continuous API stability monitoring
  • Version Validation: Ensure API versions remain stable
  • Documentation Sync: Verify API matches documentation