From 9b9d90f8d31116c4da140616629437241c7989c0 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:23:44 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 15 ++ README.md | 3 + commands/gen-report.md | 50 ++++++ plugin.lock.json | 73 +++++++++ skills/test-report-generator/SKILL.md | 54 +++++++ skills/test-report-generator/assets/README.md | 7 + .../assets/example_config.yaml | 51 ++++++ .../assets/report_template.html | 145 ++++++++++++++++++ .../assets/sample_test_results.json | 128 ++++++++++++++++ .../references/README.md | 7 + .../test-report-generator/scripts/README.md | 8 + 11 files changed, 541 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 commands/gen-report.md create mode 100644 plugin.lock.json create mode 100644 skills/test-report-generator/SKILL.md create mode 100644 skills/test-report-generator/assets/README.md create mode 100644 skills/test-report-generator/assets/example_config.yaml create mode 100644 skills/test-report-generator/assets/report_template.html create mode 100644 skills/test-report-generator/assets/sample_test_results.json create mode 100644 skills/test-report-generator/references/README.md create mode 100644 skills/test-report-generator/scripts/README.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..fd6e01d --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "test-report-generator", + "description": "Generate comprehensive test reports with coverage, trends, and stakeholder-friendly formats", + "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..f254f2a --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# test-report-generator + +Generate comprehensive test reports with coverage, trends, and stakeholder-friendly formats diff --git a/commands/gen-report.md b/commands/gen-report.md new file mode 100644 index 0000000..65cebc1 --- /dev/null +++ b/commands/gen-report.md @@ -0,0 +1,50 @@ +--- +description: Generate comprehensive test reports with coverage and trends +shortcut: report +--- + +# Test Report Generator + +Create detailed, stakeholder-friendly test reports with coverage metrics, test trends, failure analysis, and exportable formats (HTML, PDF, JSON). + +## What You Do + +1. **Aggregate Test Results**: Collect results from all test frameworks +2. **Calculate Metrics**: Coverage, pass rate, duration, trends +3. **Generate Reports**: HTML dashboards, PDF summaries, JSON exports +4. **Trend Analysis**: Compare with previous runs, identify regressions + +## Output Example + +```markdown +## Test Execution Report + +**Date:** 2025-10-11 +**Branch:** main +**Commit:** abc123 + +### Summary +- Total Tests: 1,247 +- Passed: 1,198 (96.1%) +- Failed: 32 (2.6%) +- Skipped: 17 (1.4%) +- Duration: 4m 32s + +### Coverage +- Statements: 87.3% (↑ 2.1%) +- Branches: 79.5% (↑ 1.3%) +- Functions: 91.2% (↓ 0.5%) +- Lines: 86.8% (↑ 1.9%) + +### Failed Tests (32) +1. `UserService.test.ts` - Login validation +2. `PaymentAPI.test.ts` - Refund processing + +### Trend (Last 7 Days) +``` +Day | Tests | Pass Rate | Coverage +---------|-------|-----------|---------- +Oct 11 | 1,247 | 96.1% | 87.3% +Oct 10 | 1,235 | 94.8% | 85.2% +Oct 09 | 1,228 | 95.2% | 84.9% +``` diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..29f2abb --- /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-report-generator", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "e0535c6d695a220354bc019e0c5aaff98949a6db", + "treeHash": "0900c2cd86b88dd088424c6a21b5fd1b75e5624c75e1085a780a672d30ad3e29", + "generatedAt": "2025-11-28T10:18:49.794649Z", + "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-report-generator", + "description": "Generate comprehensive test reports with coverage, trends, and stakeholder-friendly formats", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "6d5edb3fbbb6c3727aeb0f7c94458ba6754fcbb24c2075affc986eeab24b1884" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "a5cff39697e1da89cbe4cd1867f4e54640744a80f8b01f2c82dd317e101e3830" + }, + { + "path": "commands/gen-report.md", + "sha256": "a6458b071adb41ff98d4af40f1d9e920b54fede207167bc7fbcf6fb0ca9a6a4a" + }, + { + "path": "skills/test-report-generator/SKILL.md", + "sha256": "068f588a5f2b73d4e299a7d99e44e9b81378bffb62b6307904a4bd990b583a92" + }, + { + "path": "skills/test-report-generator/references/README.md", + "sha256": "daf0f7f9d73f5162cedc36c984b6fa0c10e5856fdba6410fe98449116917697f" + }, + { + "path": "skills/test-report-generator/scripts/README.md", + "sha256": "07f6ee2f7ff5afbfcc3e9dbe701b935a838ebf17d316397551a1da05ab17f2d3" + }, + { + "path": "skills/test-report-generator/assets/README.md", + "sha256": "97968dc0061d3a612b90f7dc597ba4207743487c018e7b45cc441770cfc50f54" + }, + { + "path": "skills/test-report-generator/assets/example_config.yaml", + "sha256": "8c77c47edeef0ed4dcb75653df950cf2d4799bf276a2b985fdbd7cc66f34312e" + }, + { + "path": "skills/test-report-generator/assets/sample_test_results.json", + "sha256": "87259bb751f5df259f0b4cc987be720b453e192696c518a83af0cb803294e4a6" + }, + { + "path": "skills/test-report-generator/assets/report_template.html", + "sha256": "7b38da79501f0107c562482a8ddb9d7995a8d983b9ce6aaee550d0b6b0639cbc" + } + ], + "dirSha256": "0900c2cd86b88dd088424c6a21b5fd1b75e5624c75e1085a780a672d30ad3e29" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/test-report-generator/SKILL.md b/skills/test-report-generator/SKILL.md new file mode 100644 index 0000000..388efe9 --- /dev/null +++ b/skills/test-report-generator/SKILL.md @@ -0,0 +1,54 @@ +--- +name: generating-test-reports +description: | + This skill generates comprehensive test reports with coverage metrics, trends, and stakeholder-friendly formats (HTML, PDF, JSON). It aggregates test results from various frameworks, calculates key metrics (coverage, pass rate, duration), and performs trend analysis. Use this skill when the user requests a test report, coverage analysis, failure analysis, or historical comparisons of test runs. Trigger terms include "test report", "coverage report", "testing trends", "failure analysis", and "historical test data". +allowed-tools: Read, Write, Edit, Grep, Glob, Bash +version: 1.0.0 +--- + +## Overview + +This skill empowers Claude to create detailed test reports, providing insights into code coverage, test performance trends, and failure analysis. It supports multiple output formats for easy sharing and analysis. + +## How It Works + +1. **Aggregating Results**: Collects test results from various test frameworks used in the project. +2. **Calculating Metrics**: Computes coverage metrics, pass rates, test duration, and identifies trends. +3. **Generating Report**: Produces comprehensive reports in HTML, PDF, or JSON format based on the user's preference. + +## When to Use This Skill + +This skill activates when you need to: +- Generate a test report after a test run. +- Analyze code coverage to identify areas needing more testing. +- Identify trends in test performance over time. + +## Examples + +### Example 1: Generating an HTML Test Report + +User request: "Generate an HTML test report showing code coverage and failure analysis." + +The skill will: +1. Aggregate test results from all available frameworks. +2. Calculate code coverage and identify failing tests. +3. Generate an HTML report summarizing the findings. + +### Example 2: Comparing Test Results Over Time + +User request: "Create a report comparing the test results from the last two CI/CD runs." + +The skill will: +1. Retrieve test results from the two most recent CI/CD runs. +2. Compare key metrics like pass rate and duration. +3. Generate a report highlighting any regressions or improvements. + +## Best Practices + +- **Clarity**: Specify the desired output format (HTML, PDF, JSON) for the report. +- **Scope**: Define the scope of the report (e.g., specific test suite, time period). +- **Context**: Provide context about the project and testing environment to improve accuracy. + +## Integration + +This skill can integrate with CI/CD pipelines to automatically generate and share test reports after each build. It also works well with other analysis plugins to provide more comprehensive insights. \ No newline at end of file diff --git a/skills/test-report-generator/assets/README.md b/skills/test-report-generator/assets/README.md new file mode 100644 index 0000000..fbcf6d8 --- /dev/null +++ b/skills/test-report-generator/assets/README.md @@ -0,0 +1,7 @@ +# Assets + +Bundled resources for test-report-generator skill + +- [ ] report_template.html: HTML template for generating test reports. +- [ ] example_config.yaml: Example configuration file for the test report generator. +- [ ] sample_test_results.json: Sample test results in JSON format. diff --git a/skills/test-report-generator/assets/example_config.yaml b/skills/test-report-generator/assets/example_config.yaml new file mode 100644 index 0000000..6d6550f --- /dev/null +++ b/skills/test-report-generator/assets/example_config.yaml @@ -0,0 +1,51 @@ +# Configuration file for the test-report-generator plugin + +# --- General Settings --- +report_name: "Automated Test Report" # Name of the report +output_directory: "./reports" # Directory to store generated reports +report_format: "html" # Report output format (html, pdf, json) +timestamp_format: "%Y-%m-%d %H:%M:%S" # Format for timestamps in the report + +# --- Data Sources --- +test_results: + type: "junit" # Type of test result files (junit, pytest, etc.) + path: "./test-results/*.xml" # Path to the test result files (supports glob patterns) + # For multiple data sources, define additional entries: + # - type: "pytest" + # path: "./pytest-results/results.xml" + +coverage_data: + type: "cobertura" # Type of coverage data (cobertura, lcov) + path: "./coverage.xml" # Path to the coverage data file + # If no coverage data is available, leave this section commented out: + # type: "none" + # path: "" + +# --- Report Customization --- +logo_path: "YOUR_LOGO_PATH_HERE" # Path to a logo to include in the report (optional) +report_title: "REPLACE_ME - Project Test Report" # Title displayed in the report +report_description: "Comprehensive test report for REPLACE_ME project, including test results and code coverage." # Description of the report + +# --- Thresholds and Alerts --- +pass_rate_threshold: 0.95 # Minimum pass rate (as a fraction) to be considered successful +coverage_threshold: 0.80 # Minimum code coverage (as a fraction) to be considered successful +alert_on_failure: true # Send alerts if any tests fail +alert_recipients: # List of email addresses or channels to send alerts to + - "YOUR_EMAIL_ADDRESS_HERE" + # - "another_recipient@example.com" + +# --- Historical Data --- +historical_data: + enabled: false # Enable historical data tracking and comparisons + database_url: "sqlite:///test_report_history.db" # URL for the database storing historical data (e.g., SQLite, PostgreSQL) + retention_period: "30d" # How long to retain historical data (e.g., 30d, 90d, 1y) + +# --- Advanced Options --- +include_stacktraces: true # Include stack traces in the report +collapse_long_messages: true # Collapse long test messages for readability +debug_mode: false # Enable debug mode for more verbose logging + +# --- Plugin-Specific Options --- +# These options are specific to this test report generator plugin +failure_analysis_enabled: true # Enables automated failure analysis +stakeholder_format: "executive" # Format for stakeholder-friendly report (executive, detailed) \ No newline at end of file diff --git a/skills/test-report-generator/assets/report_template.html b/skills/test-report-generator/assets/report_template.html new file mode 100644 index 0000000..680b292 --- /dev/null +++ b/skills/test-report-generator/assets/report_template.html @@ -0,0 +1,145 @@ + + + + + + {{report_title}} + + + +
+

{{report_title}}

+

Generated on: {{report_date}}

+ +

Summary

+

Total Tests: {{total_tests}}

+

Passed: {{passed_tests}}

+

Failed: {{failed_tests}}

+

Skipped: {{skipped_tests}}

+ +

Test Results

+ + + + + + + + + + + {{test_results}} + +
Test NameStatusDuration (ms)Error Message
+ +

Coverage

+

Overall Coverage: {{coverage_percentage}}%

+
+
+
+ +

Trend Analysis

+
+ + Trend Chart Placeholder +
+ +

Failure Analysis

+

{{failure_analysis}}

+ +

Generated by Test Report Generator Plugin

+
+ + \ No newline at end of file diff --git a/skills/test-report-generator/assets/sample_test_results.json b/skills/test-report-generator/assets/sample_test_results.json new file mode 100644 index 0000000..dd1863a --- /dev/null +++ b/skills/test-report-generator/assets/sample_test_results.json @@ -0,0 +1,128 @@ +{ + "_comment": "Sample test results for test-report-generator plugin", + "report_metadata": { + "report_id": "test-report-2024-10-27-1430", + "generated_at": "2024-10-27T14:30:00Z", + "test_environment": "Production", + "report_version": "1.0", + "_comment": "Version of the report format. Allows for future schema changes." + }, + "summary": { + "total_tests": 100, + "passed": 95, + "failed": 3, + "skipped": 2, + "pass_rate": 95.0, + "fail_rate": 3.0, + "skip_rate": 2.0, + "total_duration_seconds": 120.5, + "_comment": "Overall summary of the test run" + }, + "test_suites": [ + { + "suite_name": "User Authentication", + "total_tests": 20, + "passed": 19, + "failed": 1, + "skipped": 0, + "duration_seconds": 25.2, + "tests": [ + { + "test_name": "Valid login", + "status": "passed", + "duration_seconds": 1.2, + "error_message": null, + "stack_trace": null + }, + { + "test_name": "Invalid password", + "status": "failed", + "duration_seconds": 0.8, + "error_message": "Authentication failed", + "stack_trace": "at UserAuthentication.InvalidPasswordTest(UserAuthentication.cs:25)" + } + ] + }, + { + "suite_name": "Payment Processing", + "total_tests": 30, + "passed": 28, + "failed": 1, + "skipped": 1, + "duration_seconds": 45.8, + "tests": [ + { + "test_name": "Successful payment", + "status": "passed", + "duration_seconds": 1.5, + "error_message": null, + "stack_trace": null + }, + { + "test_name": "Insufficient funds", + "status": "failed", + "duration_seconds": 1.1, + "error_message": "Payment declined: Insufficient funds", + "stack_trace": "at PaymentProcessing.InsufficientFundsTest(PaymentProcessing.cs:42)" + }, + { + "test_name": "Timeout", + "status": "skipped", + "duration_seconds": 0, + "error_message": "External API timeout", + "stack_trace": null + } + ] + }, + { + "suite_name": "Data Validation", + "total_tests": 50, + "passed": 48, + "failed": 1, + "skipped": 1, + "duration_seconds": 49.5, + "tests": [ + { + "test_name": "Valid data input", + "status": "passed", + "duration_seconds": 0.7, + "error_message": null, + "stack_trace": null + }, + { + "test_name": "Invalid email format", + "status": "failed", + "duration_seconds": 0.9, + "error_message": "Invalid email format", + "stack_trace": "at DataValidation.InvalidEmailTest(DataValidation.cs:17)" + }, + { + "test_name": "Empty field", + "status": "skipped", + "duration_seconds": 0, + "error_message": "Pending implementation", + "stack_trace": null + } + ] + } + ], + "coverage": { + "line_coverage": 85.2, + "branch_coverage": 70.5, + "function_coverage": 90.1, + "_comment": "Code coverage metrics" + }, + "trends": { + "pass_rate_history": [ + {"date": "2024-10-20", "pass_rate": 92.0}, + {"date": "2024-10-21", "pass_rate": 93.5}, + {"date": "2024-10-22", "pass_rate": 94.0}, + {"date": "2024-10-23", "pass_rate": 94.5}, + {"date": "2024-10-24", "pass_rate": 94.7}, + {"date": "2024-10-25", "pass_rate": 94.8}, + {"date": "2024-10-26", "pass_rate": 94.9}, + {"date": "2024-10-27", "pass_rate": 95.0} + ], + "_comment": "Historical trend of pass rates over time" + } +} \ No newline at end of file diff --git a/skills/test-report-generator/references/README.md b/skills/test-report-generator/references/README.md new file mode 100644 index 0000000..578e2b8 --- /dev/null +++ b/skills/test-report-generator/references/README.md @@ -0,0 +1,7 @@ +# References + +Bundled resources for test-report-generator skill + +- [ ] test_framework_api.md: API documentation for interacting with various test frameworks (pytest, JUnit, etc.). +- [ ] report_format_schema.json: JSON schema for the test report format. +- [ ] coverage_metrics_definition.md: Definitions of coverage metrics used in the test report (e.g., line coverage, branch coverage). diff --git a/skills/test-report-generator/scripts/README.md b/skills/test-report-generator/scripts/README.md new file mode 100644 index 0000000..7a50e39 --- /dev/null +++ b/skills/test-report-generator/scripts/README.md @@ -0,0 +1,8 @@ +# Scripts + +Bundled resources for test-report-generator skill + +- [ ] aggregate_results.py: Aggregates test results from various frameworks (pytest, JUnit, etc.) into a unified data structure. +- [ ] generate_report.py: Generates test reports in various formats (HTML, PDF, JSON) based on the aggregated test results. +- [ ] analyze_trends.py: Analyzes test results over time to identify trends in coverage, pass rate, and duration. +- [ ] validate_config.py: Validates the configuration file for the test report generator to ensure it is properly formatted and contains all required information.