ohtest

Generate OpenHarmony unit tests from TypeScript declarations and UI tests from ArkUI pages.

Updated Sep 29, 2023
One-click install
npx skills add https://github.com/eclipse-oniro-mirrors/napi_generator --skill ohtest-eclipse-oniro-mirrors
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ohtest
Source: https://github.com/eclipse-oniro-mirrors/napi_generator/tree/main/src/skills/ohtest
Command: npx skills add https://github.com/eclipse-oniro-mirrors/napi_generator --skill ohtest-eclipse-oniro-mirrors

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

OpenHarmony 项目中单元测试与 UI 测试往往需要从 .d.ts 与 .ets 文件手动生成,过程繁琐且易出错。本技能通过自动化工具链为这两类测试生成完整的 ohosTest 套件与 UITest 套件,显著提升测试覆盖率与开发效率。

Core Features & Use Cases

  • 自动根据 .d.ts 导出生成 OHOS 单元测试用例,基于 ohtest.py。
  • 根据 .ets 页面定义生成 UITest 套件,使用 uitest_gen.py。
  • 提供一致的代码结构、常量模板(constant.ets)及 List.test.ets 集成,简化日常工作流程。

Quick Start

Run the ohtest.py tool to generate unit tests from a .d.ts and the UITest generator to create UI tests from an .ets page.

Frequently Asked Questions about ohtest

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

FAQPage Schema
How do I auto-generate OpenHarmony unit tests from TypeScript declarations?

You can auto-generate OpenHarmony unit tests from .d.ts files by running the ohtest.py tool, which produces complete ohosTest suites and automates test case registration to accelerate your testing workflow.

Can I generate UI tests directly from ArkUI pages in an OpenHarmony project?

Yes, you can generate UITest suites directly from ArkUI pages by running the uitest_gen.py tool, which parses .ets page definitions and outputs the corresponding UI test code for your OpenHarmony application.

What is the best way to automate ohosTest suite creation for NAPI interfaces?

The best way to automate ohosTest suite creation for NAPI interfaces is using a template-based workflow that reads TypeScript declarations and integrates generated cases into a List.test.ets file for unified test registration.

Do I need to manually register generated test cases in OpenHarmony?

No, manual registration is not needed because the generation workflow automatically integrates test suites into List.test.ets and provides a consistent code structure with constant templates like constant.ets to streamline the process.

Does this automated test generation approach work with standard ETS files?

Yes, the automated test generation works with standard ETS files by parsing ArkUI page definitions to create UITest suites, specifically targeting OpenHarmony projects that utilize ETS and OHOS frameworks.