본문으로 건너뛰기
Skillpedia
테스트41k · #6642

temporal-python-testing

하는 일

이 도구는 Temporal 플랫폼에서 실행되는 프로그램('워크플로')을 테스트하도록 돕습니다. 시간을 시뮬레이션해 테스트를 빠르게 하고, 코드의 특정 부분을 따로 떼어 테스트할 수 있습니다.

사용하는 경우

  • ✓'워크플로'가 올바르게 작동하는지 테스트하고 싶을 때.
  • ✓시스템의 다른 부분에 의존하는 '워크플로'를 테스트하려는 경우.
  • ✓'워크플로'가 여러 상황에서 같은 방식으로 작동하는지 확인할 때.

스킬 링크

https://github.com/wshobson/agents/blob/main/plugins/backend-development/skills/temporal-python-testing/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/wshobson/agents/blob/main/plugins/backend-development/skills/temporal-python-testing/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“시간이 더 빨리 흐르는 것처럼 시뮬레이션해서 제 워크플로를 테스트하려면 어떻게 하면 좋을까요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

테스트를 정리하기 위해 pytest라는 라이브러리를 사용합니다. 시간을 빠르게 하려고, 실제로 기다리는 대신 시간을 건너뜁니다. 격리된 부분을 테스트하기 위해 의존성을 가짜 버전('모의 객체')으로 바꿉니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Temporal Python Testing Strategies

Comprehensive testing approaches for Temporal workflows using pytest, progressive disclosure resources for specific testing scenarios.

When to Use This Skill

  • Unit testing workflows - Fast tests with time-skipping
  • Integration testing - Workflows with mocked activities
  • Replay testing - Validate determinism against production histories
  • Local development - Set up Temporal server and pytest
  • CI/CD integration - Automated testing pipelines
  • Coverage strategies - Achieve ≥80% test coverage

Testing Philosophy

Recommended Approach (Source: docs.temporal.io/develop/python/testing-suite):

  • Write majority as integration tests
  • Use pytest with async fixtures
  • Time-skipping enables fast feedback (month-long workflows → seconds)
  • Mock activities to isolate workflow logic
  • Validate determinism with replay testing

Three Test Types:

  1. Unit: Workflows with time-skipping, activities with ActivityEnvironment
  2. Integration: Workers with mocked activities
  3. End-to-end: Full Temporal server with real activities (use sparingly)

Available Resources

This skill provides detailed guidance through progressive disclosure. Load specific resources based on your testing needs:

Unit Testing Resources

File: resources/unit-testing.md When to load: Testing individual workflows or activities in isolation Contains:

  • WorkflowEnvironment with time-skipping
  • ActivityEnvironment for activity testing
  • Fast execution of long-running workflows
  • Manual time advancement patterns
  • pytest fixtures and patterns

Integration Testing Resources

File: resources/integration-testing.md When to load: Testing workflows with mocked external dependencies Contains:

  • Activity mocking strategies
  • Error injection patterns
  • Multi-activity workflow testing
  • Signal and query testing
  • Coverage strategies

Replay Testing Resources

File: resources/replay-testing.md When to load: Validating determinism or deploying workflow changes Contains:

  • Determinism validation
  • Production history replay
  • CI/CD integration patterns
  • Version compatibility testing

Local Development Resources

File: resources/local-setup.md When to load: Setting up development environment Contains:

  • Docker Compose configuration
  • pytest setup and configuration
  • Coverage tool integration
  • Development workflow

Quick Start Guide

Basic Workflow Test

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

Basic Activity Test

from temporalio.testing import ActivityEnvironment

async def test_activity():
    env = ActivityEnvironment()
    result = await env.run(your_activity, "test-input")
    assert result == expected_output

Coverage Targets

Recommended Coverage (Source: docs.temporal.io best practices):

  • Workflows: ≥80% logic coverage
  • Activities: ≥80% logic coverage
  • Integration: Critical paths with mocked activities
  • Replay: All workflow versions before deployment

Key Testing Principles

  1. Time-Skipping - Month-long workflows test in seconds
  2. Mock Activities - Isolate workflow logic from external dependencies
  3. Replay Testing - Validate determinism before deployment
  4. High Coverage - ≥80% target for production workflows
  5. Fast Feedback - Unit tests run in milliseconds

How to Use Resources

Load specific resource when needed:

  • "Show me unit testing patterns" → Load resources/unit-testing.md
  • "How do I mock activities?" → Load resources/integration-testing.md
  • "Setup local Temporal server" → Load resources/local-setup.md
  • "Validate determinism" → Load resources/replay-testing.md

Additional References

  • Python SDK Testing: docs.temporal.io/develop/python/testing-suite

…

자주 묻는 질문

'시간 건너뛰기(time-skipping)'란 무엇인가요?

실제 시간이 흐르기를 기다리지 않고, 몇 초 만에 며칠이나 몇 달이 지난 것처럼 시뮬레이션해 테스트를 훨씬 빠르게 실행하는 기법입니다.

'모의 활동(mocked activities)'이란 무엇인가요?

워크플로가 호출하는 코드 부분(활동)의 가짜 버전입니다. 이를 쓰면 다른 부분이 실제로 작동하지 않아도 워크플로 자체의 논리만 테스트할 수 있습니다.

'리플레이 테스트(replay testing)'란 무엇인가요?

이전 실행 기록을 사용해 워크플로를 다시 실행하는 테스트입니다. 워크플로가 일관되게 작동하고 예상치 못하게 동작을 바꾸지 않는지 확인하는 데 도움이 됩니다.

상세 정보

작성자의 원본 설명

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

repo: wshobson/agents

인기도

GitHub 스타
41k
순위
#6642
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬