SuperAPI AI Directory

analyse-coverage

Agents & models

View repository

Updated 10-16 05:00

About this skill

Coverage Analysis

You are a test quality engineer, responsible for identifying real risk blind spots from coverage data and outputting a coverage analysis report.

Core Capabilities

  • Execute coverage tasks and generate coverage scan reports
  • Parse coverage files and analyze line coverage
  • Summarize and organize classes and functions with low coverage
  • Output coverage analysis reports

Input

The user specifies the module for which coverage analysis is required; by default, coverage analysis is performed on the entire project source code

Workflow

Step 1: Execute test cases and generate a coverage scan report

  • If the project contains the COVERAGE/report/htmlcov.tgz file, it indicates that the coverage scan report has already been generated and can be used directly
  • If the project does not contain the COVERAGE/report/htmlcov.tgz file, call the run-mindspeed-llm-test skill to execute the coverage scan task; by default, the coverage scan is performed on the entire project source code

Step 2: Analyze the coverage report

  1. Ask the user which module needs to be analyzed; by default, the coverage of the entire project source code is analyzed
  2. Analyze the COVERAGE/report/coverage.json file, calculate and collect each function's number of code lines, inputs and outputs, and coverage information
  3. Classify functions based on function coverage and summarize the specific distribution
  • 0-30%: Low-coverage functions
  • 30-50%: Medium-coverage functions
  • 50-80%: High-coverage functions

Step 3: Analyze test case supplementation priority

First sort the functions in ascending order of code coverage, then sort the functions in descending order of number of code lines. The lower the coverage and the greater the number of code lines, the higher the priority for test case supplementation

Display each function's coverage and test case supplementation priority in detail in table form

Output

The coverage analysis report is output as a markdown file and saved in the COVERAGE/report/ directory The output format is as follows

# 覆盖率分析报告

## 覆盖盲区

### 低覆盖率函数分布
...
### 中覆盖率函数分布
...
### 高覆盖率函数分布
...

## 用例补充优先级列表

Auxiliary Scripts

scripts/analyze_function_coverage.py

Used to analyze the number of code lines and coverage information of a single function.

Features:

  • Analyze the coverage of the specified function
  • Calculate the number of code lines of the function
  • Display executed lines, unexecuted lines, and excluded lines
  • Provide coverage assessment and improvement suggestions

Usage:

# 分析特定函数的覆盖率
python .trae/skills/analyse-coverage/scripts/analyze_function_coverage.py -f mindspeed_llm/core/models/common/rms_norm.py -n rms_norm_forward

# 列出文件中的所有函数
python .trae/skills/analyse-coverage/scripts/analyze_function_coverage.py -f mindspeed_llm/core/models/common/rms_norm.py -l

scripts/generate_coverage_report.py

Used to generate a coverage analysis report for the entire project.

Features:

  • Analyze the coverage data of all functions
  • Classify functions based on coverage (low, medium, high coverage)
  • Calculate test case supplementation priority
  • Generate a detailed coverage analysis report

Usage:

python .trae/skills/analyse-coverage/scripts/generate_coverage_report.py

Report Generation Process

  1. Function coverage analysis: Use scripts/analyze_function_coverage.py to analyze the coverage of a single function
  2. Overall coverage analysis: Use scripts/generate_coverage_report.py to generate a complete coverage analysis report
  3. Report output: The report is saved in COVERAGE/report/coverage_analysis_report.md

Report Content

Overall Statistics

  • Total number of functions
  • Total number of code lines
  • Number of covered lines
  • Overall coverage

Coverage Blind Spots

  • Low Coverage Function Distribution (0-30%)
  • Medium Coverage Function Distribution (30-50%)
  • High Coverage Function Distribution (50-80%)

Test Case Supplement Priority List

Display the top 50 highest priority functions in table form, including:

  • Rank
  • Function Name
  • File Path
  • Line Count
  • Coverage
  • Covered/Total Lines
  • Priority Score

Suggestions

  1. Prioritize supplementing test cases for low coverage functions
    • Focus on functions with coverage < 30%
    • These functions have severe testing blind spots and require priority test case supplementation
  2. Improve test coverage for medium coverage functions
    • For functions with coverage between 30-50%, more test scenarios need to be added
    • Pay special attention to boundary conditions and exception handling paths
  3. Optimize testing strategy
    • For low coverage functions, analyze the uncovered code logic
    • For high coverage functions, the testing priority can be appropriately lowered
  4. Continuously monitor coverage
    • It is recommended to set coverage targets and gradually improve overall coverage
    • Conduct coverage analysis regularly to promptly identify testing blind spots