From cdb1e17108053c2dae863c5346a68ee61f4ab345 Mon Sep 17 00:00:00 2001 From: zenggaofeng Date: Sun, 8 Oct 2023 14:25:35 +0800 Subject: [PATCH] =?UTF-8?q?XTS=20-=20ArkTs=E8=AA=9E=E6=B3=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zenggaofeng --- entry/src/ohosTest/ets/test/Ability.test.ets | 12 ++++++------ entry/src/ohosTest/ets/testability/TestAbility.ets | 10 ++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/entry/src/ohosTest/ets/test/Ability.test.ets b/entry/src/ohosTest/ets/test/Ability.test.ets index db47a86..2f5748d 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 5521feb..bf11fb8 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() { -- Gitee