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
Added on

NPX Install

npx skill4agent add re2zero/deepin-skills qt-unittest-build

SKILL.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

  1. Use built-in resources: stub-ext source code comes from
    resources/stub/
    , no external downloads allowed
  2. Generate autotests/ directory: Keep consistent with the original qt-cpp-unittest-framework skill
  3. Call built-in sub-Agents: Directly read sub-Agents from the Skill's
    agent/
    directory, do not install them into the project
  4. Sub-Agent permissions: Sub-Agents must have
    bash: true
    and
    write: allow
    permissions
  5. 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 script

Step 2: Copy dependencies

Copy all source files from
resources/stub/
to
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/
:
  • run-ut.sh
    : Test run script (set execution permissions)
  • UnitTestUtils.cmake
    : CMake tool (write to
    autotests/cmake/
    )

Step 4: Call built-in sub-Agent

Directly use the Skill's built-in sub-Agent (read from
agent/qt-unittest-builder.md
), no installation required:
Calling method: Execute the content of the Skill's
agent/qt-unittest-builder.md
as the prompt for the sub-Agent.
Tasks completed by the sub-Agent:
  1. Analyze project structure (CMakeLists.txt, source code directories, dependencies)
  2. Generate autotests/CMakeLists.txt
  3. Generate test subdirectories and test files
  4. Generate test documentation (README.md)
  5. Verify build: Run cmake configuration and compilation to ensure the testing framework can run normally

Step 5: Copy report generator

Copy the
resources/report_generator/
directory (complete report generation module) to
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
    bash: false
    or
    write: 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 scripts
Key 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 inquiry

Common Errors

ErrorCauseFix
Sub-Agent has no execution permissionsConfiguration errorSet
bash: true, write: allow
Asks user for confirmationUsed the ask toolDelete all ask calls
Installs sub-Agent into the projectUnnecessary stepUse the built-in sub-Agent directly
Incorrect directory nameGenerated tests/Must generate autotests/
Documentation is too longContains excessive detailsCompress to <500 words

Rationalization Counter

RationalizationTruthCountermeasure
"Detailed documentation helps with understanding"Users just want to get it done quicklyKeep it concise, <500 words
"Multiple scripts provide flexibility"Increases complexityFixed scripts + dynamic AI
"Asking the user ensures safety"Wastes timeExecute directly, sub-Agent has write: allow
"Install sub-Agent into the project"Adds extra stepsUse the Skill's built-in version directly
"Reminders of precautions highlight important points"Redundant and repetitiveUse Iron Laws and Red Flags