qt-unittest-build
Original:🇨🇳 Chinese
Translated
14 scripts
Generate a unit testing framework for Qt projects. Includes complete dependencies, sub-Agents, and fixed scripts to generate the autotests testing framework with one click.
3installs
Sourcere2zero/deepin-skills
Added on
NPX Install
npx skill4agent add re2zero/deepin-skills qt-unittest-buildTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →You are an expert in building Qt unit testing frameworks. Generate a complete autotests unit testing infrastructure for projects.
Iron Laws
- Use built-in resources: stub-ext source code comes from , no external downloads allowed
resources/stub/ - Generate autotests/ directory: Keep consistent with the original qt-cpp-unittest-framework skill
- Call built-in sub-Agents: Directly read sub-Agents from the Skill's directory, do not install them into the project
agent/ - Sub-Agent permissions: Sub-Agents must have and
bash: truepermissionswrite: allow - Execute directly: Do not use the ask tool to query the user, copy and write directly
Execution Process
Step 1: Prepare directory structure
Create the autotests/ directory structure:
autotests/
├── 3rdparty/stub/ # stub-ext source code
├── cmake/ # CMake tools
└── run-ut.sh # Test run scriptStep 2: Copy dependencies
Copy all source files from to :
resources/stub/autotests/3rdparty/stub/- stub.h, addr_any.h, addr_pri.h, elfio.hpp
- stubext.h, stub-shadow.h, stub-shadow.cpp
Step 3: Generate fixed scripts
Generate from :
resources/scripts/- : Test run script (set execution permissions)
run-ut.sh - : CMake tool (write to
UnitTestUtils.cmake)autotests/cmake/
Step 4: Call built-in sub-Agent
Directly use the Skill's built-in sub-Agent (read from ), no installation required:
agent/qt-unittest-builder.mdCalling method:
Execute the content of the Skill's as the prompt for the sub-Agent.
agent/qt-unittest-builder.mdTasks completed by the sub-Agent:
- Analyze project structure (CMakeLists.txt, source code directories, dependencies)
- Generate autotests/CMakeLists.txt
- Generate test subdirectories and test files
- Generate test documentation (README.md)
- Verify build: Run cmake configuration and compilation to ensure the testing framework can run normally
Step 5: Copy report generator
Copy the directory (complete report generation module) to :
resources/report_generator/autotests/report_generator/- main.py: Main report generator
- parsers/: Test and coverage parsers
- generators/: HTML and CSV generators
- utils/: Utility functions (ui_utils, file_utils)
Red Flags
Stop execution immediately in the following cases:
- ❌ The user requests to generate a tests/ directory (must be autotests/)
- ❌ Requests to use external stub-ext source code
- ❌ Documentation exceeds 500 words
- ❌ Uses the ask tool to request user confirmation (wastes time)
- ❌ Attempts to install sub-Agents into the project (use built-in directly)
- ❌ Sub-Agent permissions are or
bash: falsewrite: ask
Quick Reference
Directory structure:
qt-unittest-build/
├── SKILL.md
├── README.md
├── agent/qt-unittest-builder.md # Sub-Agent
└── resources/
├── stub/ # Full version of stub-ext source code
└── scripts/ # Fixed scriptsKey paths:
- Stub source code:
resources/stub/ - Sub-Agent:
agent/qt-unittest-builder.md - Run script:
resources/scripts/generate-runner.sh - CMake tool:
resources/scripts/generate-cmake-utils.sh
Sub-Agent permissions:
yaml
tools:
bash: true # Allow command execution
write: true
permission:
write: allow # Write directly, no inquiryCommon Errors
| Error | Cause | Fix |
|---|---|---|
| Sub-Agent has no execution permissions | Configuration error | Set |
| Asks user for confirmation | Used the ask tool | Delete all ask calls |
| Installs sub-Agent into the project | Unnecessary step | Use the built-in sub-Agent directly |
| Incorrect directory name | Generated tests/ | Must generate autotests/ |
| Documentation is too long | Contains excessive details | Compress to <500 words |
Rationalization Counter
| Rationalization | Truth | Countermeasure |
|---|---|---|
| "Detailed documentation helps with understanding" | Users just want to get it done quickly | Keep it concise, <500 words |
| "Multiple scripts provide flexibility" | Increases complexity | Fixed scripts + dynamic AI |
| "Asking the user ensures safety" | Wastes time | Execute directly, sub-Agent has write: allow |
| "Install sub-Agent into the project" | Adds extra steps | Use the Skill's built-in version directly |
| "Reminders of precautions highlight important points" | Redundant and repetitive | Use Iron Laws and Red Flags |