Create test scenario JSON files for Output SDK workflows. Use when creating test inputs, documenting expected behaviors, or setting up workflow testing.
This skill documents how to create test scenario JSON files for Output SDK workflows. Scenarios provide predefined inputs for testing workflows during development and validation.
Scenario files are stored INSIDE the workflow folder:
src/workflows/{workflow-name}/
āāā workflow.ts
āāā steps.ts
āāā types.ts
āāā scenarios/
āāā basic_input.json
āāā complex_input.json
āāā edge_case_empty.json
Important: Scenarios are workflow-specific and live inside the workflow folder.
Use snake_case for scenario file names:
{description}_input.json
Examples:
basic_input.jsontest_input_solar_panels.jsonedge_case_empty_content.jsoncomplex_with_references.jsonNaming patterns:
basic_* - Minimal valid inputcomplex_* - Full-featured input with all optionsedge_case_* - Boundary conditions and edge caseserror_* - Inputs expected to produce errorsA scenario file is a JSON file that matches the workflow's inputSchema:
{
"fieldName": "value",
"optionalField": "optional value",
"numericField": 42,
"arrayField": ["item1", "item2"]
}
The scenario JSON must match the Zod schema defined in types.ts:
export const WorkflowInputSchema = z.object({
content: z.string().describe('Text content to process'),
numberOfIdeas: z.number().min(1).max(10).default(1),
colorPalette: z.string().optional(),
aspectRatio: z.enum(['1:1', '16:9', '9:16']).default('1:1'),
referenceUrls: z.array(z.string()).optional()
});
basic_input.json (minimal required fields)
{
"content": "This is sample content for testing the workflow."
}
complete_input.json (all fields specified)
{
"content": "This is sample content for testing the workflow.",
"numberOfIdeas": 3,
"colorPalette": "blue and green tones",
"aspectRatio": "16:9",
"referenceUrls": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
]
}
Based on image_infographic_nano workflow:
{
"content": "Solar panels work by converting sunlight into electricity through the photovoltaic effect. The process begins when photons from sunlight strike the silicon cells in the panel, knocking electrons loose from their atoms. These free electrons flow through the semiconductor material, creating an electric current. The panels contain multiple layers: a protective glass covering, anti-reflective coating to maximize light absorption, silicon cells (both n-type and p-type layers forming a junction), and a backing material. The DC electricity generated by the panels flows through an inverter, which converts it to AC electricity suitable for home use or feeding back into the power grid. Modern solar panels achieve 15-20% efficiency, meaning they convert that percentage of sunlight into usable electricity. The entire system includes mounting hardware, wiring, inverters, and often battery storage for excess energy.",
"numberOfIdeas": 3,
"aspectRatio": "16:9",
"resolution": "2K",
"numberOfGenerations": 1
}
{
"content": "Detailed explanation of the topic...",
"numberOfIdeas": 5,
"colorPalette": "warm earth tones with orange accents",
"artDirection": "minimalist corporate style",
"aspectRatio": "1:1",
"resolution": "4K",
"numberOfGenerations": 2,
"referenceImageUrls": [
"https://storage.example.com/style-guide.png"
],
"storageNamespace": "test/infographics"
}
# Run with scenario file
npx output workflow run workflowName --input path/to/scenarios/basic_input.json
# Run with inline JSON
npx output workflow run workflowName --input '{"content": "test"}'
# Basic scenario
npx output workflow run contentUtilsImageInfographicNano --input src/workflows/content_utils/image_infographic_nano/scenarios/test_input_solar_panels.json
# Complex scenario
npx output workflow run contentUtilsImageInfographicNano --input src/workflows/content_utils/image_infographic_nano/scenarios/test_input_complex.json
Related Skill: output-workflow-run for detailed CLI usage
Minimal valid input to verify the workflow works:
{
"content": "Simple test content",
"numberOfIdeas": 1
}
All optional fields populated:
{
"content": "Detailed content...",
"numberOfIdeas": 5,
"colorPalette": "custom palette",
"artDirection": "specific style",
"aspectRatio": "16:9",
"resolution": "4K",
"numberOfGenerations": 3,
"referenceImageUrls": ["https://example.com/ref.jpg"],
"storageNamespace": "test/folder"
}
Test boundary conditions:
edge_case_min_values.json
{
"content": "x",
"numberOfIdeas": 1
}
edge_case_max_values.json
{
"content": "Very long content string...",
"numberOfIdeas": 10
}
error_missing_required.json
{
"numberOfIdeas": 3
}
Note: Error scenarios won't pass validation but are useful for testing error handling.
Add a comment field (if supported) or create a companion README:
{
"_comment": "Tests workflow with multiple reference images",
"content": "...",
"referenceImageUrls": ["url1", "url2", "url3"]
}
{
"content": "Actual representative content that matches real use cases..."
}
Not:
{
"content": "test"
}
If schema has enums, create scenarios for each:
// scenario_aspect_1x1.json
{ "aspectRatio": "1:1", ... }
// scenario_aspect_16x9.json
{ "aspectRatio": "16:9", ... }
// scenario_aspect_9x16.json
{ "aspectRatio": "9:16", ... }
// without_optional_fields.json
{ "content": "..." }
// with_all_optional_fields.json
{ "content": "...", "colorPalette": "...", "artDirection": "..." }
// with_some_optional_fields.json
{ "content": "...", "colorPalette": "..." }
Save inputs from bug reports:
// regression_issue_123.json
{
"_issue": "https://github.com/org/repo/issues/123",
"content": "Input that caused the bug..."
}
For workflows with many scenarios, organize into subfolders:
scenarios/
āāā basic/
ā āāā minimal_input.json
āāā complete/
ā āāā all_options.json
āāā edge_cases/
ā āāā empty_array.json
ā āāā max_length.json
āāā regression/
āāā issue_123.json
scenarios/ folder inside workflow directory.json extensionsnake_case# Check JSON is valid
cat scenarios/basic_input.json | jq .
# Run workflow with scenario
npx output workflow run workflowName --input scenarios/basic_input.json
# Check status if async
npx output workflow status <workflowId>
# Get result
npx output workflow result <workflowId>
output-dev-types-file - Defining inputSchema that scenarios must matchoutput-dev-folder-structure - Understanding scenarios folder locationoutput-workflow-run - Running workflows with scenario filesoutput-workflow-list - Finding available workflows