Skip to main content

Creating Ref Data Files Dynamically

You can use a FunctionalFlowFuzzer (steps:) workflow—or cats triage --exportRefData—to generate --refData files dynamically instead of hardcoding resource identifiers.

--createRefData removed in 16.0.0

The legacy --createRefData flag (refData_custom.yml) was removed in CATS 16.0.0. Use --exportRefData <file> with cats run or cats triage instead.

Option 1: Export --refData from a functional flow (--exportRefData)​

Capture identifiers in a steps: flow's save: block, reference them in downstream steps, and pass --exportRefData when running cats run:

cats run functionalFlow.yml -c contract.yml -s http://localhost:8080 --exportRefData refData.yml

The functionalFlow.yml file:

steps:
- name: "createPet"
description: "Create a Pet and capture its ID"
POST: "/pet"
body:
name: "My Pet"
save:
petId: "pet.id"
expect:
status: [200, 201]

- name: "getPetType"
GET: "/pet-type"
query:
id: "${petId}"
expect:
status: 200

After cats run finishes, CATS writes refData.yml with the resolved runtime values for every path and field where a saved variable was consumed:

/pet-type:
id: 123

Option 2: Mine --refData from an existing report with cats triage​

If you have already run CATS and want to extract working path parameters and resource IDs observed in 2XX responses across the report:

cats triage -r cats-report --exportRefData refData.yml