鸿蒙语言基础类库:【@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(){}
};
  • 8
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值