oh-ut-generator

Official

Generate OpenHarmony C++ unit tests with required coverage.

Authoropenharmonyinsight
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill eliminates the slow and error-prone process of writing OpenHarmony C++ unit tests by automatically generating HWTEST_F-compliant test code that matches existing patterns and branch logic.

Core Features & Use Cases

  • OpenHarmony C++ UT generation: Produce comprehensive tests for normal, exception, and boundary scenarios using HWTEST_F conventions.
  • Mocking that actually works: Generate and wire mock objects with proper EXPECT_CALL/ON_CALL usage so tests validate interactions instead of leaving mocks unused.
  • Correct BUILD.gn integration: Align deps/include_dirs/external_deps/defines to the source code target configuration.
  • Coverage and style guardrails: Enforce mandatory 75%+ coverage targets and maintain code style consistency with existing tests (>=70% consistency threshold).
  • Special interface support: Handle NDK interfaces (OH_xxx) with create/destroy lifecycle pairing and NAPI functions (napi_xxx) with correct napi_* patterns, plus CJSON test patterns and memory management.

Quick Start

Use the oh-ut-generator skill to generate unit tests for the provided OpenHarmony C++ source file and return a complete HWTEST_F test file with matching BUILD.gn configuration.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: oh-ut-generator
Download link: https://github.com/openharmonyinsight/openharmony-skills/archive/main.zip#oh-ut-generator

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.