diff --git a/entry/src/ohosTest/ets/test/Ability.test.ets b/entry/src/ohosTest/ets/test/Ability.test.ets index db47a8662db89b0dd876c7f95ddc601b2af38130..2f5748d86c4605345fc51195b43b4cf42dcac150 100644 --- a/entry/src/ohosTest/ets/test/Ability.test.ets +++ b/entry/src/ohosTest/ets/test/Ability.test.ets @@ -18,29 +18,29 @@ import { PullToRefresh, PullToRefreshConfigurator } from '@ohos/pulltorefresh' export default function abilityTest() { - describe('ActsAbilityTest', function () { + describe('ActsAbilityTest', ()=> { // Defines a test suite. Two parameters are supported: test suite name and test suite function. - beforeAll(function () { + beforeAll(()=> { // Presets an action, which is performed only once before all test cases of the test suite start. // This API supports only one parameter: preset action function. }) - beforeEach(function () { + beforeEach(()=> { // Presets an action, which is performed before each unit test case starts. // The number of execution times is the same as the number of test cases defined by **it**. // This API supports only one parameter: preset action function. }) - afterEach(function () { + afterEach(()=> { // Presets a clear action, which is performed after each unit test case ends. // The number of execution times is the same as the number of test cases defined by **it**. // This API supports only one parameter: clear action function. }) - afterAll(function () { + afterAll(()=> { // Presets a clear action, which is performed after all test cases of the test suite end. // This API supports only one parameter: clear action function. }) - it('TestPullToRefreshConfigurator', 0, function () { + it('TestPullToRefreshConfigurator', 0, ()=> { let refreshConfigurator: PullToRefreshConfigurator = new PullToRefreshConfigurator(); // 设置属性 refreshConfigurator diff --git a/entry/src/ohosTest/ets/testability/TestAbility.ets b/entry/src/ohosTest/ets/testability/TestAbility.ets index 5521febde3a7a76ee63951038bf0cb9506cd751f..bf11fb8b2fdc3bb3efe252f01473a798d381e290 100644 --- a/entry/src/ohosTest/ets/testability/TestAbility.ets +++ b/entry/src/ohosTest/ets/testability/TestAbility.ets @@ -13,6 +13,8 @@ * limitations under the License. */ import UIAbility from '@ohos.app.ability.UIAbility'; +import Want from '@ohos.app.ability.Want'; +import AbilityConstant from '@ohos.app.ability.AbilityConstant'; import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; import hilog from '@ohos.hilog'; import { Hypium } from '@ohos/hypium'; @@ -20,16 +22,12 @@ import testsuite from '../test/List.test'; import window from '@ohos.window'; export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { + onCreate(want:Want, launchParam:AbilityConstant.LaunchParam) { hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + Hypium.hypiumTest(AbilityDelegatorRegistry.getAbilityDelegator(), AbilityDelegatorRegistry.getArguments(), testsuite) } onDestroy() {