鸿蒙语言基础类库:【@ohos.application.testRunner (TestRunner)】 测试

TestRunner

TestRunner模块提供了框架测试的能力。包括准备单元测试环境、运行测试用例。

如果您想实现自己的单元测试框架,您必须继承这个类并覆盖它的所有方法。

说明:
开发前请熟悉鸿蒙开发指导文档gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md点击或者复制转到。
本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

导入模块

import TestRunner from '@ohos.application.testRunner'

TestRunner.onPrepare

onPrepare(): void

为运行测试用例准备单元测试环境

系统能力: SystemCapability.Ability.AbilityRuntime.Core

示例:

export default class UserTestRunner implements TestRunner {
    onPrepare() {
        console.log("Trigger onPrepare")
    }
onRun(){}
};

在这里插入图片描述

TestRunner.onRun

onRun(): void

运行测试用例

系统能力: SystemCapability.Ability.AbilityRuntime.Core

示例:

export default class UserTestRunner implements TestRunner {
    onPrepare() {
       console.log("Trigger onRun")
    }
onRun(){}
};

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-12 13:32:01       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-12 13:32:01       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-12 13:32:01       58 阅读
  4. Python语言-面向对象

    2024-07-12 13:32:01       69 阅读

热门阅读

  1. 使用sklearn的基本流程

    2024-07-12 13:32:01       20 阅读
  2. qt udp 只创建服务端链接

    2024-07-12 13:32:01       24 阅读
  3. 开发不认可bug策略

    2024-07-12 13:32:01       22 阅读
  4. 深入理解sklearn中的模型参数优化技术

    2024-07-12 13:32:01       23 阅读
  5. Android C++系列:Linux守护进程

    2024-07-12 13:32:01       20 阅读
  6. hive中reverse函数

    2024-07-12 13:32:01       21 阅读
  7. 03-NoSQL之Redis配置与优化

    2024-07-12 13:32:01       15 阅读
  8. 编程是学什么:探索编程世界的四大核心领域

    2024-07-12 13:32:01       19 阅读
  9. npm error code 1

    2024-07-12 13:32:01       18 阅读
  10. npm link,npm unlink调试本地开发npm包

    2024-07-12 13:32:01       18 阅读
  11. Dubbo之SPI、Adaptive机制详解

    2024-07-12 13:32:01       21 阅读
  12. linux上mmm和mm指令的区别

    2024-07-12 13:32:01       23 阅读
  13. docker 常用命令

    2024-07-12 13:32:01       25 阅读
  14. Redis的五种数据类型 #系统架构设计师#

    2024-07-12 13:32:01       25 阅读