capture-api-response-test-fixture

Capture real API responses and save them as test fixtures under a __fixtures__ directory.

26.1k|4.9k|Updated May 23, 2023
One-click install
npx skills add https://github.com/vercel/ai --skill capture-api-response-test-fixture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: capture-api-response-test-fixture
Source: https://github.com/vercel/ai/tree/main/skills/capture-api-response-test-fixture
Command: npx skills add https://github.com/vercel/ai --skill capture-api-response-test-fixture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach for storing true API responses as test fixtures, enabling reliable provider-parsing tests and deterministic results.

Core Features & Use Cases

  • Store real provider responses in a dedicated fixtures folder to ensure tests reflect real-world outputs.
  • Guide for generating and validating fixtures using generateText and streamText workflows, with examples.
  • Use Case: Validate response parsing across providers by reusing saved fixtures during test runs.

Quick Start

Use the fixtures workflow to generate a new test fixture from a provider response and save it under the fixtures directory using the examples described in the Skill's guidance.

Frequently Asked Questions about capture-api-response-test-fixture

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

FAQPage Schema
How do I store real API responses as test fixtures for deterministic provider testing?

You can store real API responses as test fixtures by capturing provider outputs and saving them to a dedicated __fixtures__ directory, ensuring tests reflect real-world data and yield deterministic results during validation.

What is the best way to validate response parsing across multiple API providers?

Validating response parsing across providers is best achieved by reusing saved real API response fixtures during test runs, which ensures consistent and deterministic validation across different provider outputs.

How do I generate test fixtures from generateText and streamText workflows?

Generating test fixtures from generateText and streamText workflows involves using helper scripts to capture the API responses and saving them directly under the __fixtures__ subfolder for later test validation.

Why do my API provider tests return inconsistent results between runs?

API provider tests return inconsistent results because they rely on live network responses, so capturing real API responses into test fixtures ensures deterministic validation by reusing the same saved outputs.

Do I need a specific folder structure to save API response test fixtures?

You need to store fixtures under a specific __fixtures__ subfolder within your test directory, which allows the validation helper scripts to correctly locate and reuse the saved API responses during test runs.