workflow-testing

Test StatefulWorkflow and StatelessWorkflow render logic and event handling with RenderTester.

1.1k|112|Updated Jun 2, 2020
One-click install
npx skills add https://github.com/square/workflow-kotlin --skill workflow-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: workflow-testing
Source: https://github.com/square/workflow-kotlin/tree/main/workflow-testing/.agents/skills/workflow-testing
Command: npx skills add https://github.com/square/workflow-kotlin --skill workflow-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Testing workflows manually is error-prone and slow; this Skill provides a framework to write targeted unit tests for StatefulWorkflow and StatelessWorkflow using testRender and RenderTester to validate render results, state transitions, and emitted outputs.

Core Features & Use Cases

  • Isolate render logic with RenderTester and testRender to verify rendering results
  • Verify state transitions, actions, and outputs for both StatefulWorkflow and StatelessWorkflow
  • Assert interactions with child workflows and workers via expectations and fake components

Quick Start

Write a unit test that creates a workflow instance, calls testRender with initial props and state, and asserts the initial rendering or subsequent transitions.

Frequently Asked Questions about workflow-testing

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

FAQPage Schema
How do I unit test state transitions and render logic in a workflow?

You can validate state transitions and render logic by creating a workflow instance, calling testRender with initial props and state, and asserting the rendering results or subsequent transitions.

How do I isolate child workflow interactions during workflow unit testing?

Workflow unit testing allows you to assert interactions with child workflows and workers by setting expectations and utilizing fake components to isolate the workflow under test.

Can I verify emitted outputs and actions for both StatefulWorkflow and StatelessWorkflow?

Yes, testing validates state transitions, actions, and emitted outputs for both StatefulWorkflow and StatelessWorkflow using testRender and RenderTester.

What is the best way to fake workers and check props propagation in a state machine test?

RenderTester enables you to fake workers and check props propagation by setting up initial props and state, then verifying actions, outputs, and worker expectations in isolation.

Why does my workflow test fail to verify rendering outputs correctly?

Workflow tests may fail if you do not properly set up the initial props and state required to verify rendering outputs, state transitions, and emitted actions in isolation.

Do I need to set up initial state before testing a stateless workflow render?

Yes, testing both StatefulWorkflow and StatelessWorkflow requires setting up initial props and state to properly check rendering outputs, actions, and worker expectations.