boosting-coverage
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "boosting-coverage" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-b72430ab8b2375f4bb194ccd50b70d778456fd08c85316d63cf50d83b7f5cce3. Verify the upstream source and version against https://skillhub.cn/skills/user_e3e8b067/boosting-coverage before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Used to increase unit test coverage in existing projects, add tests for untested code, or quickly raise coverage percentages—especially when source code cannot be modified, all logic branches must be covered, and redundant tests must be avoided.
Introduction source: third_party · user_e3e8b067 · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Use when asked to improve unit test coverage on an existing project, add tests to untested code, or rapidly increase coverage percentage — especially when source code must not be modified, all logic branches must be covered, and redundant tests must be avoided
- Testing
- Not tested
Browse files
Frontmatter
name: Boosting-Coverage
description: Use when asked to improve unit test coverage on an existing project, add tests to untested code, or rapidly increase coverage percentage — especially when source code must not be modified, all logic branches must be covered, and redundant tests must be avoidedBoosting Coverage
Overview
Read source → map every branch → write minimum tests hitting each branch → verify with coverage tool. Never modify source code. One test covers many branches on the same execution path.
Core Process
1. Survey & Map Branches (NO writing yet)
Scan project, sort by branch density (most branches first), read full source. Skip: POJOs, pure delegation, empty classes. For each method, list every distinct path:
| Pattern | Paths to Cover |
|---|---|
if/else, ternary, &&/||, early return |
Both true and false outcomes |
switch with N cases |
N+1 paths (include default) |
for/while loop |
0, 1, many iterations |
try/catch |
Success + each exception type |
2. Plan Minimal Tests
Group branches by execution path — one test hits multiple branches if they share the same flow:
process(x):
if (x == null) return "empty"; // guard
if (x < 0) return "negative"; // early exit
return "positive"; // normal
→ 3 tests (not 6): null, -1, 1 — each activates a different set of branches.
Goal: minimum tests, maximum unique branch coverage.
3. Write Tests
- Mock I/O and external systems only — never refactor source to "make testable"
- Test private methods through public callers — never increase visibility
- Use parameterized tests for same-logic-different-inputs
- Assert the specific output each branch produces (not just
assertNotNull)
4. Verify & Trim
# Run coverage tool — NEVER claim "done" without it:
mvn test jacoco:report # Java
pytest --cov=src --cov-report=term-missing # Python
jest --coverage # JS/TS
go test -coverprofile=coverage.out && go tool cover -html=coverage.out # Go
- Red/yellow lines → add missing test
- For each test: "If I delete this, does another test still cover these branches?" — if yes, delete it.
Quick Reference
| Situation | Approach |
|---|---|
| Private method with logic | Test via public callers (all paths) |
| Void methods | Assert side effects (DB writes, state changes) |
| Exception paths | assertThrows + verify message |
| Deeply nested if | Drill one level deeper per test, innermost first |
| Switch with enum | One test per value + default |
Common Mistakes
- Modifying source → Never. Mock or use reflection as last resort.
- Over-mocking → Mock only I/O. Test real logic through real call chains.
- Under-asserting →
assertNotNull(result)proves nothing. Assert the specific branch outcome. - Claiming coverage without running tool → Always run the tool. Always.
- Skipping "hard to reach" branches → If you can't reach it, document it as dead code.
Red Flags — STOP
- "I'll just make this private method public for testing"
- "Let me refactor this first, then test"
- "This branch is too hard to reach, I'll skip it"
- Writing a test without knowing which branch it covers
All of these mean: Stop. Re-read the source. Map the branch. Write the test.
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 针对单元测试覆盖率提升这一高频开发痛点,提供系统化方法论
- 适用于多语言生态,具有广泛实用价值
Highlights
- 触发词精准完整,边界清晰,覆盖多种变体
Highlights
- 结构清晰,步骤明确,包含端到端示例和具体命令
Highlights
- 提供主流语言覆盖率验证命令,强调不可跳过工具验证
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.