commit cab6ef63cde36558ff2697b9fc3ea94c35d1c7ad Author: Zhongwei Li Date: Sun Nov 30 08:23:41 2025 +0800 Initial commit diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..20b2700 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "test-orchestrator", + "description": "Orchestrate complex test workflows with dependencies, parallel execution, and smart test selection", + "version": "1.0.0", + "author": { + "name": "Claude Code Plugin Hub", + "email": "[email protected]" + }, + "skills": [ + "./skills" + ], + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5589912 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# test-orchestrator + +Orchestrate complex test workflows with dependencies, parallel execution, and smart test selection diff --git a/commands/orchestrate.md b/commands/orchestrate.md new file mode 100644 index 0000000..ae75641 --- /dev/null +++ b/commands/orchestrate.md @@ -0,0 +1,75 @@ +--- +description: Orchestrate complex test workflows with smart execution +shortcut: orch +--- + +# Test Orchestrator + +Orchestrate complex test execution workflows with dependency management, parallel execution, smart test selection, and optimized CI/CD integration. + +## What You Do + +1. **Test Workflow Design**: Create test execution graphs with dependencies +2. **Parallel Execution**: Identify and run independent tests in parallel +3. **Smart Selection**: Run only affected tests based on code changes +4. **Dependency Management**: Ensure tests run in correct order +5. **Resource Optimization**: Balance test execution across available resources + +## Output Example + +```javascript +// test-orchestration.config.js +module.exports = { + stages: [ + { + name: 'unit-tests', + parallel: true, + tests: ['**/*.unit.test.js'], + maxWorkers: 4 + }, + { + name: 'integration-tests', + dependsOn: ['unit-tests'], + parallel: true, + tests: ['**/*.integration.test.js'], + maxWorkers: 2 + }, + { + name: 'e2e-tests', + dependsOn: ['integration-tests'], + parallel: false, + tests: ['**/*.e2e.test.js'] + } + ], + + smartSelection: { + enabled: true, + algorithm: 'affected-files', + fallback: 'all-tests' + }, + + retries: { + flaky: 2, + timeout: 1 + } +}; +``` + +```bash +# Smart test selection based on changed files +$ test-orchestrator run --changed + +Analyzing changes... + Modified files: 3 + Affected tests: 47 (4% of total) + +Executing test plan: + Stage 1: Unit Tests (32 tests, parallel) + Completed in 12s + Stage 2: Integration Tests (12 tests, parallel) + Completed in 28s + Stage 3: E2E Tests (3 tests, sequential) + Completed in 45s + +Total: 47 tests in 85s (instead of 18m for full suite) +``` diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..0c99a56 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,73 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/testing/test-orchestrator", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "65b5fc1ad8e9966029ac5fa4f7412794e054ed61", + "treeHash": "6f436acfbfbdd112b86c4534c5df395c7fcaab5438652daa92663271b9d8aef8", + "generatedAt": "2025-11-28T10:18:49.590653Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "test-orchestrator", + "description": "Orchestrate complex test workflows with dependencies, parallel execution, and smart test selection", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "f48a0a6185278fa6e2faca7b12cc6ac8fab19c1be2031b4ed6eda88d71007660" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "61d53b6149d8b51a640e0f007a9ae14cbb6fe041c28b7935685b1aae6b4fc2ec" + }, + { + "path": "commands/orchestrate.md", + "sha256": "cefa0c2cd4acf1fc38153f58676936b9ebaa30f098cd31acba7c959861189423" + }, + { + "path": "skills/test-orchestrator/SKILL.md", + "sha256": "0c1cc1799b5a0dea7e5d838d3cf7e3f306c9c37e5263e5203cc99feaf66fbb10" + }, + { + "path": "skills/test-orchestrator/references/README.md", + "sha256": "cf6e59c776ec6d4a4930e1417ac181fedda6ebfaefb685a6d5bc50bc46f5b5c3" + }, + { + "path": "skills/test-orchestrator/scripts/README.md", + "sha256": "0e86fa568dd68a371e42890b990caeea41dbb540758444d9ac1a3e6a15af807b" + }, + { + "path": "skills/test-orchestrator/assets/configuration_template.yaml", + "sha256": "11b1983ac839ad8395a25afa38a270974bdf97ed6b30ff267f91b66940990888" + }, + { + "path": "skills/test-orchestrator/assets/test_report_template.html", + "sha256": "05209f10fddec16b9db2a12acd6496e8cd9f7fbcd0dc17e2d2e983dc6088ca4a" + }, + { + "path": "skills/test-orchestrator/assets/README.md", + "sha256": "cbb24761f220567100fecdf74c5f62c7dba9719aba51ce23a13a34c946819521" + }, + { + "path": "skills/test-orchestrator/assets/example_test_graph.json", + "sha256": "56f960f956ae7715d1df2594c62dabf3eb1086f2c9fec261b86c81712ce45e06" + } + ], + "dirSha256": "6f436acfbfbdd112b86c4534c5df395c7fcaab5438652daa92663271b9d8aef8" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/test-orchestrator/SKILL.md b/skills/test-orchestrator/SKILL.md new file mode 100644 index 0000000..ad8eb71 --- /dev/null +++ b/skills/test-orchestrator/SKILL.md @@ -0,0 +1,52 @@ +--- +name: orchestrating-test-workflows +description: | + This skill enables Claude to orchestrate complex test workflows using the test-orchestrator plugin. It allows Claude to define test execution graphs with dependencies, execute tests in parallel, and intelligently select tests to run based on code changes. Use this skill when a user requests test orchestration, dependency management for tests, parallel test execution, smart test selection, or CI/CD integration for testing. Trigger terms include "orchestrate tests", "test workflow", "parallel testing", "smart test selection", "test dependencies", and "/orchestrate". +allowed-tools: Read, Bash, Grep, Glob +version: 1.0.0 +--- + +## Overview + +This skill empowers Claude to manage and execute complex test suites efficiently. It leverages the test-orchestrator plugin to handle test dependencies, parallel execution, and intelligent test selection, resulting in faster and more reliable testing processes. + +## How It Works + +1. **Workflow Definition**: Claude uses the plugin to define the test workflow, specifying dependencies between tests. +2. **Parallelization**: The plugin identifies independent tests and executes them in parallel to reduce overall execution time. +3. **Smart Selection**: Based on code changes, the plugin selects only the affected tests to run, minimizing unnecessary execution. + +## When to Use This Skill + +This skill activates when you need to: +- Optimize test execution time. +- Manage dependencies between tests. +- Run only relevant tests after code changes. + +## Examples + +### Example 1: Optimizing Regression Testing + +User request: "Orchestrate the regression tests for the user authentication module after the recent code changes." + +The skill will: +1. Use the test-orchestrator plugin to identify the tests affected by the changes in the user authentication module. +2. Execute those tests in parallel, respecting any dependencies. + +### Example 2: Setting up a CI/CD Pipeline + +User request: "Set up a test workflow for the CI/CD pipeline that runs unit tests, integration tests, and end-to-end tests with appropriate dependencies." + +The skill will: +1. Define a test workflow using the test-orchestrator plugin, specifying the order and dependencies between the different test suites (unit, integration, end-to-end). +2. Configure the pipeline to trigger the orchestrated test execution upon code commits. + +## Best Practices + +- **Dependency Mapping**: Clearly define dependencies between tests to ensure correct execution order. +- **Granularity**: Break down large test suites into smaller, more manageable units for better parallelization. +- **Change Tracking**: Integrate the test-orchestrator with version control to accurately identify affected tests. + +## Integration + +This skill integrates with the test-orchestrator plugin and can be incorporated into CI/CD pipelines. It can also be used in conjunction with other code analysis tools to further refine test selection. \ No newline at end of file diff --git a/skills/test-orchestrator/assets/README.md b/skills/test-orchestrator/assets/README.md new file mode 100644 index 0000000..a08c3c0 --- /dev/null +++ b/skills/test-orchestrator/assets/README.md @@ -0,0 +1,7 @@ +# Assets + +Bundled resources for test-orchestrator skill + +- [ ] example_test_graph.json: Example test graph file demonstrating dependencies and test execution order. +- [ ] test_report_template.html: HTML template for generating test reports. +- [ ] configuration_template.yaml: Template for configuring the test orchestrator. diff --git a/skills/test-orchestrator/assets/configuration_template.yaml b/skills/test-orchestrator/assets/configuration_template.yaml new file mode 100644 index 0000000..5b59c55 --- /dev/null +++ b/skills/test-orchestrator/assets/configuration_template.yaml @@ -0,0 +1,116 @@ +# Configuration template for the Test Orchestrator plugin + +# Global settings for the test orchestration process +global: + # Maximum number of parallel test executions + max_parallel_tests: 4 # Default: 4. Adjust based on available resources. + + # Default timeout for individual test execution (in seconds) + default_test_timeout: 300 # Default: 300 seconds (5 minutes). Use 0 for no timeout. + + # Number of retry attempts for failed tests + retry_attempts: 2 # Default: 2. Set to 0 to disable retries. + + # Base directory for test execution (relative to the repository root) + test_base_dir: "test" # Default: "test". Change if your tests are in a different directory. + + # Environment variables to apply to all test executions + environment: + # Example: API_KEY: "YOUR_API_KEY" + # REPLACE_ME : YOUR_VALUE_HERE + +# Definition of test suites and their dependencies +test_suites: + # Example test suite definition + integration_tests: + # Description of the test suite + description: "Integration tests for the core application functionality" + + # Test files to include in this suite (glob patterns) + include: + - "test/integration/**/*.test.js" + - "test/integration/**/*_spec.js" + + # Test files to exclude from this suite (glob patterns) + exclude: + - "test/integration/deprecated/*.test.js" # Example: Exclude deprecated tests + + # Dependencies: List of other test suites that must complete successfully before this one runs. + dependencies: + - unit_tests + # Example: - security_tests + + # Environment variables specific to this test suite (overrides global environment) + environment: + # Example: DATABASE_URL: "YOUR_INTEGRATION_DATABASE_URL" + # REPLACE_ME : YOUR_VALUE_HERE + + unit_tests: + description: "Unit tests for individual modules" + include: + - "test/unit/**/*.test.js" + - "test/unit/**/*_spec.js" + exclude: [] + dependencies: [] + environment: {} + + # Add more test suites as needed + # Example: + # security_tests: + # description: "Security vulnerability tests" + # include: + # - "test/security/**/*.test.js" + # exclude: [] + # dependencies: + # - integration_tests + # environment: + # SECURE_API_KEY: "YOUR_SECURE_API_KEY" + +# Smart test selection configuration (optional) +smart_selection: + # Enable or disable smart test selection + enabled: false # Default: false. Set to true to enable. + + # Git branch to compare against for changed files (e.g., "main", "develop") + base_branch: "main" # Default: "main". The branch to compare against for changes. + + # Regular expressions to identify source code files. + source_code_patterns: + - "src/**/*.js" + - "lib/**/*.py" + # Add more file patterns as needed + + # Mapping of source code files to associated test files. + # Each key is a glob pattern matching source code files. + # Each value is a list of glob patterns matching associated test files. + source_to_test_mapping: + "src/auth/*.js": + - "test/unit/auth/*.test.js" + - "test/integration/auth/*.test.js" + # Add more mappings as needed + +# Reporting configuration +reporting: + # Type of report to generate (e.g., "junit", "html") + report_type: "junit" # Default: "junit". Available options depend on the reporting plugins. + + # Output file for the test report + report_output_file: "test-results.xml" # Default: "test-results.xml". + + # Additional reporting options (plugin-specific) + options: + # Example: include_console_output: true + # REPLACE_ME : YOUR_VALUE_HERE + +# CI/CD integration configuration (optional) +ci_cd: + # Enable or disable CI/CD integration + enabled: false # Default: false. Set to true to enable. + + # Type of CI/CD system (e.g., "github_actions", "gitlab_ci") + system_type: "github_actions" # Default: "github_actions". + + # Additional CI/CD options (system-specific) + options: + # Example: upload_results_to_s3: true + # REPLACE_ME : YOUR_VALUE_HERE \ No newline at end of file diff --git a/skills/test-orchestrator/assets/example_test_graph.json b/skills/test-orchestrator/assets/example_test_graph.json new file mode 100644 index 0000000..7cd84ff --- /dev/null +++ b/skills/test-orchestrator/assets/example_test_graph.json @@ -0,0 +1,86 @@ +{ + "_comment": "Example test graph file for the Test Orchestrator plugin.", + "name": "Integration Test Suite", + "description": "Comprehensive integration tests covering various system components.", + "tests": [ + { + "id": "test_db_connection", + "name": "Database Connection Test", + "description": "Verifies connectivity to the database.", + "command": "python tests/integration/test_db.py", + "dependencies": [], + "priority": "high", + "retry_attempts": 2, + "timeout": 60, + "tags": ["database", "connectivity"] + }, + { + "id": "test_api_auth", + "name": "API Authentication Test", + "description": "Tests API authentication and authorization.", + "command": "python tests/integration/test_api_auth.py", + "dependencies": ["test_db_connection"], + "priority": "high", + "retry_attempts": 1, + "timeout": 45, + "tags": ["api", "authentication", "authorization"] + }, + { + "id": "test_user_registration", + "name": "User Registration Test", + "description": "Tests user registration functionality.", + "command": "python tests/integration/test_user_registration.py", + "dependencies": ["test_db_connection"], + "priority": "medium", + "retry_attempts": 0, + "timeout": 90, + "tags": ["user", "registration"] + }, + { + "id": "test_payment_processing", + "name": "Payment Processing Test", + "description": "Tests payment processing workflow.", + "command": "python tests/integration/test_payment.py", + "dependencies": ["test_api_auth", "test_user_registration"], + "priority": "high", + "retry_attempts": 3, + "timeout": 120, + "tags": ["payment", "api"] + }, + { + "id": "test_report_generation", + "name": "Report Generation Test", + "description": "Tests report generation functionality.", + "command": "python tests/integration/test_report.py", + "dependencies": ["test_db_connection"], + "priority": "low", + "retry_attempts": 1, + "timeout": 180, + "tags": ["report", "database"] + }, + { + "id": "test_data_migration", + "name": "Data Migration Test", + "description": "Tests the data migration process.", + "command": "python tests/integration/test_migration.py", + "dependencies": [], + "priority": "medium", + "retry_attempts": 0, + "timeout": 300, + "tags": ["migration", "database"] + } + ], + "configuration": { + "_comment": "Global configuration options for the test suite.", + "max_parallel_tests": 4, + "default_retry_attempts": 1, + "default_timeout": 60, + "test_directory": "tests/integration", + "report_format": "json" + }, + "smart_selection": { + "_comment": "Configuration for smart test selection based on code changes.", + "enabled": true, + "mapping_file": "test_mapping.json" + } +} \ No newline at end of file diff --git a/skills/test-orchestrator/assets/test_report_template.html b/skills/test-orchestrator/assets/test_report_template.html new file mode 100644 index 0000000..5ed8ff9 --- /dev/null +++ b/skills/test-orchestrator/assets/test_report_template.html @@ -0,0 +1,138 @@ + + + + + + Test Orchestrator Report + + + +
+ +

Test Orchestrator Report

+ + +
+

Summary

+

Total Tests: {{total_tests}}

+

Passed: {{passed_tests}}

+

Failed: {{failed_tests}}

+

Skipped: {{skipped_tests}}

+

Pass Rate: {{pass_rate}}%

+

Start Time: {{start_time}}

+

End Time: {{end_time}}

+

Duration: {{duration}}

+
+ + +

Test Results

+ + + + + + + + + + + {{test_results}} + +
Test NameStatusDurationError Message
+ + +

Additional Information

+

{{additional_info}}

+ + +

Generated by Test Orchestrator

+
+ + \ No newline at end of file diff --git a/skills/test-orchestrator/references/README.md b/skills/test-orchestrator/references/README.md new file mode 100644 index 0000000..9471d4b --- /dev/null +++ b/skills/test-orchestrator/references/README.md @@ -0,0 +1,7 @@ +# References + +Bundled resources for test-orchestrator skill + +- [ ] test_graph_schema.md: Documentation of the test graph schema used to define test dependencies. +- [ ] test_mapping.md: Documentation on how tests are mapped to code changes for smart test selection. +- [ ] ci_cd_integration.md: Best practices for integrating the test orchestrator into CI/CD pipelines. diff --git a/skills/test-orchestrator/scripts/README.md b/skills/test-orchestrator/scripts/README.md new file mode 100644 index 0000000..7aeac91 --- /dev/null +++ b/skills/test-orchestrator/scripts/README.md @@ -0,0 +1,7 @@ +# Scripts + +Bundled resources for test-orchestrator skill + +- [ ] test_selector.py: Script to intelligently select tests to run based on code changes, using git diff and test mapping. +- [ ] test_executor.py: Script to execute tests in parallel, managing dependencies and retrying flaky tests. +- [ ] report_generator.py: Script to generate test reports in various formats (JUnit, HTML).