ohtest

Generate Hypium-compatible unit-test suites from .d.ts typings for OpenHarmony.

Updated Oct 28, 2024
One-click install
npx skills add https://github.com/openharmony/napi_generator --skill ohtest
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ohtest
Source: https://github.com/openharmony/napi_generator/tree/main/src/skills/ohtest
Command: npx skills add https://github.com/openharmony/napi_generator --skill ohtest

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

OpenHarmony developers face the challenge of turning .d.ts interface definitions into ready-to-run unit tests; this skill automates that workflow to save time and reduce human error.

Core Features & Use Cases

  • Automatically generates Hypium-compatible test suites from .d.ts typings under ohosTest/ets.
  • For each interface, creates a test module with four boundary cases (normal, max, min, stress) and registers it to List.test.ets.
  • Keeps test suites in sync by updating List.test.ets to import and run the new suite.

Quick Start

Run python3 ohtest.py --dts /path/to/Index.d.ts --test-dir /path/to/ohosTest/ets to generate a new test suite.

Frequently Asked Questions about ohtest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate OpenHarmony unit tests from .d.ts interface definitions?

To generate OpenHarmony unit tests from .d.ts files, run the Python script with the path to your .d.ts file and the OHOS test directory. It analyzes interface exports and outputs Hypium-compatible test suites under ohosTest/ets.

Can I automatically create boundary case test modules for OpenHarmony interfaces?

Yes, you can automatically create boundary case test modules for OpenHarmony interfaces. The tool analyzes each interface export from your .d.ts file and generates a test module with four boundary cases: normal, max, min, and stress.

Does generating Hypium test suites automatically update List.test.ets in OpenHarmony projects?

Generating Hypium test suites automatically updates List.test.ets in OpenHarmony projects. The script registers each newly generated test suite by updating List.test.ets to import and run the new tests.

What do I need to run automated .d.ts to ETS test suite generation for OpenHarmony?

To run automated .d.ts to ETS test suite generation for OpenHarmony, you need Python installed on your system. You must provide the script with the exact path to your .d.ts typings file and the path to your ohosTest/ets directory.

Why write manual Hypium tests for OpenHarmony APIs instead of generating them?

Writing manual Hypium tests for OpenHarmony APIs introduces human error and takes significant time. Generating them automatically from .d.ts definitions ensures interface coverage, standardizes boundary cases, and keeps test suites in sync.

When should I use automated test generation for OpenHarmony .d.ts files?

You should use automated test generation for OpenHarmony .d.ts files when you have interface definitions and need ready-to-run unit tests quickly. It is ideal for reducing manual coding effort and standardizing test coverage across exported APIs.