by wshobson
Temporal 工作流测试通常很慢或不稳定。本技能提供快速、确定性的测试模式,包括时间跳过、活动模拟和重放验证,以实现可靠的 CI/CD 流程。
1. 打开 Claude 聊天界面
2. 点击下方 "📋 复制" 按钮
3. 粘贴到 Claude 聊天框中并发送
4. 输入 "使用 temporal-python-testing 技能" 开始使用
=== temporal-python-testing 技能 === 作者: wshobson 描述: Temporal 工作流测试通常很慢或不稳定。本技能提供快速、确定性的测试模式,包括时间跳过、活动模拟和重放验证,以实现可靠的 CI/CD 流程。 使用方法: 1. 调用技能: "使用 temporal-python-testing 技能" 2. 提供相关信息: 根据技能要求提供必要参数 3. 查看结果: 技能会返回处理结果 示例: "使用 temporal-python-testing 技能,帮我分析一下这段代码"
这种方法适用于所有 Claude 用户,不需要安装额外工具。
coding
safe
Comprehensive testing approaches for Temporal workflows using pytest, progressive disclosure resources for specific testing scenarios.
Recommended Approach (Source: docs.temporal.io/develop/python/testing-suite):
Three Test Types:
This skill provides detailed guidance through progressive disclosure. Load specific resources based on your testing needs:
File: resources/unit-testing.md
When to load: Testing individual workflows or activities in isolation
Contains:
File: resources/integration-testing.md
When to load: Testing workflows with mocked external dependencies
Contains:
File: resources/replay-testing.md
When to load: Validating determinism or deploying workflow changes
Contains:
File: resources/local-setup.md
When to load: Setting up development environment
Contains:
import pytest
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
@pytest.fixture
async def workflow_env():
env = await WorkflowEnvironment.start_time_skipping()
yield env
await env.shutdown()
@pytest.mark.asyncio
async def test_workflow(workflow_env):
async with Worker(
workflow_env.client,
task_queue="test-queue",
workflows=[YourWorkflow],
activities=[your_activity],
):
result = await workflow_env.client.execute_workflow(
YourWorkflow.run,
args,
id="test-wf-id",
task_queue="test-queue",
)
assert result == expected
from temporalio.testing import ActivityEnvironment
async def test_activity():
env = ActivityEnvironment()
result = await env.run(your_activity, "test-input")
assert result == expected_output
Recommended Coverage (Source: docs.temporal.io best practices):
Load specific resource when needed:
resources/unit-testing.mdresources/integration-testing.mdresources/local-setup.mdresources/replay-testing.mdView Count
0
Download Count
0
Favorite Count
0
Quality Score
69