2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
The TestRunner module provides framework testing capabilities, including preparing unit test environments and running test cases.
If you want to implement your own unit testing framework, you must inherit from this class and override all its methods.
illustrate:
Please familiarize yourself with the Hongmeng development guide before development:gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md
Click or copy to go.
The first batch of interfaces in this module are supported starting from API version 8. For new interfaces in subsequent versions, the starting version of the interface is marked with a superscript.
import TestRunner from '@ohos.application.testRunner'
onPrepare(): void
Prepare the unit test environment for running test cases
System capabilities: SystemCapability.Ability.AbilityRuntime.Core
Example:
export default class UserTestRunner implements TestRunner {
onPrepare() {
console.log("Trigger onPrepare")
}
onRun(){}
};
onRun(): void
Running Test Cases
System capabilities: SystemCapability.Ability.AbilityRuntime.Core
Example:
export default class UserTestRunner implements TestRunner {
onPrepare() {
console.log("Trigger onRun")
}
onRun(){}
};