ohos-test-ut-generation

Official

Generate OpenHarmony C/C++ unit tests that pass gate checks.

Authoropenharmonyinsight
Version1.0.0
Installs0

System Documentation

What problem does it solve?

It solves the time-consuming and error-prone work of writing OpenHarmony testfwk_developer_test-compliant HWTEST/HWTEST_F unit tests for C/C++ code, including correct macro usage, test levels, naming, and BUILD.gn wiring.

Core Features & Use Cases

  • Scaffold compliant unit test files: Produces test plans and code that follow OpenHarmony’s HWTEST rules (including mandatory using namespace testing::ext;, TestSize.Level*, and proper @tc.* annotations).
  • Design test cases from source: Helps analyze target source APIs and derive a structured set of scenarios (normal, exception, boundary, state).
  • Generate GN build configuration: Guides creation of ohos_unittest targets (imports, deps, module output path format, and cflags_cc for private/protected access).
  • Optional style alignment from existing tests: When there are existing tests, it leverages analysis to match local macro usage, naming, comment style, and Level formatting.

Example use case: You are asked to write new HWTEST/HWTEST_F cases for a subsystem module that has public APIs plus some private logic; you want deterministic, gate-compliant tests and a correct test/unittest/BUILD.gn setup.

Quick Start

Tell the assistant the exact OpenHarmony module/function(s) you need to test and the intended output location under test/unittest/, and ask it to generate HWTEST/HWTEST_F test cases plus the corresponding BUILD.gn target.

Dependency Matrix

Required Modules

None required

Components

scriptsreferences

💻 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: ohos-test-ut-generation
Download link: https://github.com/openharmonyinsight/openharmony-skills/archive/main.zip#ohos-test-ut-generation

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.