diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/app.json b/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c9eab3ccb3777a3e9c37126cafe03e962c9375a3 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.aacommandprintonetest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7a1e60df49d818c68d318759bfab1d84ea794c50 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommandPrintSyncTest" + } + ] +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/BUILD.gn b/ability/ability_runtime/aacommand/AACommandPrintOneTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8aff8efd0e5ccd0c4bbedc1f073ad2ba0854ecc0 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAACommandPrintOneTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":aacommandprintonetest_js_assets", + ":aacommandprintonetest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAACommandPrintOneTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("aacommandprintonetest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("aacommandprintonetest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("aacommandprintonetest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":aacommandprintonetest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/Test.json b/ability/ability_runtime/aacommand/AACommandPrintOneTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..01bf0c4589a60f2e1e32f0abf0e7c92f14963b83 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/Test.json @@ -0,0 +1,28 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.aacommandprintonetest", + "module-name": "entry_test", + "shell-timeout": "600000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + " hilog -Q pidoff", + "hilog -Q domainoff", + "hilog -b D" + ] + }, + { + "test-file-name": [ + "ActsAACommandPrintOneTest.hap", + "AACommandRelyHap.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8d70b1cf1cd684ad5b315a5c920feafebcb118d4 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + async onCreate(want, launchParam) { + globalThis.abilityContext = this.context; + console.log('MainAbility onCreate') + let cmd: any + let abilityDelegatorArguments: any + let abilityDelegator: any + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + + cmd = 'aa test -b com.example.aacommandrelyhap -m entry_test -s class ACTS_AACommand_01_3#ACTS_AACo' + + 'mmand_print_01_0100 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0100 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0100 stdResult = ' + data.stdResult) + globalThis.stdResult3 = data.stdResult; + console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: end') + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' + + 'and_print_01_0200 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0200 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0200 stdResult = ' + data.stdResult) + globalThis.stdResult4 = data.stdResult; + console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: end') + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_' + + 'AACommand_print_01_0300 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0300 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0300 stdResult = ' + data.stdResult) + globalThis.stdResult5 = data.stdResult; + console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: end') + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComma' + + 'nd_print_01_0400 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0400 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0400 stdResult = ' + data.stdResult) + globalThis.stdResult6 = data.stdResult; + console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: end') + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' + + 'and_print_01_0500 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0500 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0500 stdResult = ' + data.stdResult) + globalThis.stdResult7 = data.stdResult; + console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: end') + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AA' + + 'Command_print_01_0600 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0600 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0600 stdResult = ' + data.stdResult) + globalThis.stdResult8 = data.stdResult; + console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: end') + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_print_01_0700 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0700 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0700 stdResult = ' + data.stdResult) + globalThis.stdResult9 = data.stdResult; + console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: end') + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_print_01_0800 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0800 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0800 stdResult = ' + data.stdResult) + globalThis.stdResult10 = data.stdResult; + console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: end') + }) + + setTimeout(() => { + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + + }, 5000) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'pages/index', null) + + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1762cda6dd8f03996989e42dfeb364161e91c0b7 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..83cc6acd855717c6f038570f27469d87775999ff --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(() => { + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2fac5ed2fe30c841f1a6e75a145d217b399b31e --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +let msg: any +let msgcopy: any + +export default function abilityTest() { + describe('ActsAACommandPrinOneTest', function () { + /** + * @tc.number: ACTS_AACommand_print_0100 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in AsyncCallback mode. The print information includes Chinese, special characters, etc. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0100', 0, async function (done) { + console.log("ACTS_AACommand_print_0100 --- start") + msg = '测试日志!@#$%^&*()_+QWE{}|?> setTimeout(resolve, ms)); +} export default function abilityTest() { describe('ACTS_AACommand_01_3', function () { /** @@ -29,6 +32,7 @@ export default function abilityTest() { var msg = '测试日志!@#$%^&*()_+QWE{}|?> " ) + await sleep(1000) var finishmsg = 'ACTS_AACommand_printSync_01_0100 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then((data)=>{ console.log("ACTS_AACommand_printSync_01_0100 finishTest test end ========> callback " ) @@ -59,6 +63,7 @@ export default function abilityTest() { '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' globalThis.abilityDelegator.printSync(msg); console.log("ACTS_AACommand_printSync_01_0200 printSync end ====> " ) + await sleep(1000) var finishmsg = 'ACTS_AACommand_printSync_01_0200 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_printSync_01_0200 print test end ========> callback " ) @@ -88,6 +93,7 @@ export default function abilityTest() { 'fffffffffff' globalThis.abilityDelegator.printSync(msg); console.log("ACTS_AACommand_printSync_01_0300 printSync end ====> " ) + await sleep(1000) var finishmsg = 'ACTS_AACommand_printSync_01_0300 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_printSync_01_0300 print test end ========> callback " ) @@ -105,6 +111,7 @@ export default function abilityTest() { it('ACTS_AACommand_printSync_01_0400', 0, async function (done) { globalThis.abilityDelegator.printSync(null); console.log("ACTS_AACommand_printSync_01_0300 printSync end ====> " ) + await sleep(1000) var finishmsg = 'ACTS_AACommand_printSync_01_0400 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_printSync_01_0400 print test end ========> callback " ) diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets index 584d97bdba4d6a8e11e02f6a39c82851444b414e..7b3dc3d2071e69e7ba2b20ed67ec85fd53ef8237 100644 --- a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets @@ -15,6 +15,10 @@ */ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} export default function abilityTest() { describe('ACTS_AACommand_01_3', function () { /** @@ -32,6 +36,7 @@ export default function abilityTest() { console.log("ACTS_AACommand_print_01_0100 print test end ========> callback err: "+JSON.stringify(err) ) console.log("ACTS_AACommand_print_01_0100 print test end ========> callback data: "+JSON.stringify(data)) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0100 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then((data)=>{ console.log("ACTS_AACommand_print_01_0100 finishTest test end ========> callback " ) @@ -62,6 +67,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg,()=>{ console.log("print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0200 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0200 print test end ========> callback " ) @@ -91,6 +97,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg,()=>{ console.log("print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0300 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0300 print test end ========> callback " ) @@ -109,6 +116,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(null,()=>{ console.log("print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0400 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0400 print test end ========> callback " ) @@ -128,6 +136,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg).then(()=>{ console.log("ACTS_AACommand_print_01_0500 print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0500 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0500 print test end ========> callback " ) @@ -156,6 +165,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg).then(()=>{ console.log("ACTS_AACommand_print_01_0600 print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0600 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0600 2 print test end ========> callback " ) @@ -185,6 +195,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg).then(()=>{ console.log("ACTS_AACommand_print_01_0700 print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0700 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0700 2 print test end ========> callback " ) @@ -220,6 +231,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_0100', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_0100 finishTest test end ========> callback " ) done() @@ -275,6 +287,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_0400', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_0400 finishTest test end ========> callback " ) done() @@ -290,6 +303,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_0500', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_0500 finishTest test end ========> callback " ) done() @@ -306,6 +320,7 @@ export default function abilityTest() { it('ACTS_AACommand_finish_01_0600', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_0600 finishTest test end ========> callback " ) done() @@ -321,6 +336,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_0700', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_0700 finishTest test end ========> callback " ) done() @@ -358,6 +374,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_0900', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?> { console.log("ACTS_AACommand_finish_01_0900 finishTest test end ========> callback " ) done() @@ -409,6 +426,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_1200', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_1200 finishTest test end ========> callback " ) done() @@ -424,6 +442,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_1300', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_1300 finishTest test end ========> callback " ) done() @@ -439,6 +458,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_1400', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_1400 finishTest test end ========> callback " ) done() @@ -454,6 +474,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_1500', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_1500 finishTest test end ========> callback " ) done() diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts index 71eb66e8dfe940080c927d6d5d34efb2b6c16930..a08ae41d25c439f5c695ae759dbfb30c25cf36a2 100644 --- a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -32,8 +32,6 @@ export default class MainAbility extends Ability { abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - await sleep(500) - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0700 -s unittest OpenHarmonyTestRunner' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -43,7 +41,7 @@ export default class MainAbility extends Ability { console.log('ACTS_AACommand_finish_01_0700 - executeShellCommand: end ') }) - await sleep(3000) + await sleep(4000) cmd = 'aa dump -a' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -55,102 +53,6 @@ export default class MainAbility extends Ability { await sleep(2000) - cmd = 'aa test -b com.example.aacommandrelyhap -m entry_test -s class ACTS_AACommand_01_3#ACTS_AACo' + - 'mmand_print_01_0100 -s unittest OpenHarmonyTestRunner' - abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0100 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0100 stdResult = ' + data.stdResult) - globalThis.stdResult3 = data.stdResult; - console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: end') - }) - - await sleep(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' + - 'and_print_01_0200 -s unittest OpenHarmonyTestRunner' - abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0200 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0200 stdResult = ' + data.stdResult) - globalThis.stdResult4 = data.stdResult; - console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: end') - }) - - await sleep(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_' + - 'AACommand_print_01_0300 -s unittest OpenHarmonyTestRunner' - abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0300 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0300 stdResult = ' + data.stdResult) - globalThis.stdResult5 = data.stdResult; - console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: end') - }) - - await sleep(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComma' + - 'nd_print_01_0400 -s unittest OpenHarmonyTestRunner' - abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0400 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0400 stdResult = ' + data.stdResult) - globalThis.stdResult6 = data.stdResult; - console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: end') - }) - - await sleep(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' + - 'and_print_01_0500 -s unittest OpenHarmonyTestRunner' - abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0500 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0500 stdResult = ' + data.stdResult) - globalThis.stdResult7 = data.stdResult; - console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: end') - }) - - await sleep(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AA' + - 'Command_print_01_0600 -s unittest OpenHarmonyTestRunner' - abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0600 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0600 stdResult = ' + data.stdResult) - globalThis.stdResult8 = data.stdResult; - console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: end') - }) - - await sleep(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_print_01_0700 -s unittest OpenHarmonyTestRunner' - abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0700 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0700 stdResult = ' + data.stdResult) - globalThis.stdResult9 = data.stdResult; - console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: end') - }) - - await sleep(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_print_01_0800 -s unittest OpenHarmonyTestRunner' - abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0800 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0800 stdResult = ' + data.stdResult) - globalThis.stdResult10 = data.stdResult; - console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: end') - }) - - await sleep(3000) - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + 'ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0400 -s unittest OpenHarmonyTestRunner' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -161,7 +63,7 @@ export default class MainAbility extends Ability { console.log('ACTS_AACommand_finish_01_0400 - executeShellCommand: end') }) - await sleep(3000) + await sleep(4000) cmd = 'aa dump -a' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -183,7 +85,7 @@ export default class MainAbility extends Ability { console.log('ACTS_AACommand_finish_01_0100 - executeShellCommand: end') }) - await sleep(3000) + await sleep(4000) cmd = 'aa dump -a' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -205,7 +107,7 @@ export default class MainAbility extends Ability { console.log('ACTS_AACommand_finish_01_0500 - executeShellCommand: end') }) - await sleep(3000) + await sleep(4000) cmd = 'aa dump -a' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -227,7 +129,7 @@ export default class MainAbility extends Ability { console.log('ACTS_AACommand_finish_01_0600 - executeShellCommand: end') }) - await sleep(3000) + await sleep(4000) cmd = 'aa dump -a' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -249,7 +151,7 @@ export default class MainAbility extends Ability { console.log('ACTS_AACommand_finish_01_0900 - executeShellCommand: end') }) - await sleep(3000) + await sleep(4000) cmd = 'aa dump -a' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -271,7 +173,7 @@ export default class MainAbility extends Ability { console.log('ACTS_AACommand_finish_01_1200 - executeShellCommand: end') }) - await sleep(3000) + await sleep(4000) cmd = 'aa dump -a' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -293,7 +195,7 @@ export default class MainAbility extends Ability { console.log('ACTS_AACommand_finish_01_1300 - executeShellCommand: end') }) - await sleep(3000) + await sleep(4000) cmd = 'aa dump -a' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -315,7 +217,7 @@ export default class MainAbility extends Ability { console.log('ACTS_AACommand_finish_01_1400 - executeShellCommand: end') }) - await sleep(3000) + await sleep(4000) cmd = 'aa dump -a' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -337,7 +239,7 @@ export default class MainAbility extends Ability { console.log('ACTS_AACommand_finish_01_1500 - executeShellCommand: end') }) - await sleep(3000) + await sleep(4000) cmd = 'aa dump -a' abilityDelegator.executeShellCommand(cmd, (err, data) => { @@ -358,7 +260,7 @@ export default class MainAbility extends Ability { console.log('ACTS_AACommand_finish_01_0200 - executeShellCommand: end') }) - await sleep(3000) + await sleep(4000) cmd = 'aa dump -a' abilityDelegator.executeShellCommand(cmd, (err, data) => { diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets index 126f4f69765a423d326c7727f42e3c0505653482..558191899eb4f11d519fe7fa948aaacef978f9a2 100644 --- a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets @@ -202,165 +202,6 @@ export default function abilityTest() { }) }) - /** - * @tc.number: ACTS_AACommand_print_0100 - * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is - * called in AsyncCallback mode. The print information includes Chinese, special characters, etc. - * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through - * the test command. - */ - it('ACTS_AACommand_print_0100', 0, async function (done) { - console.log("ACTS_AACommand_print_0100 --- start") - msg = '测试日志!@#$%^&*()_+QWE{}|?>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); subscriber0100 = data; - await commonEvent.subscribe(subscriber0100, async (err, data) => { + commonEvent.subscribe(subscriber0100, async (err, data) => { console.debug("=ACTS_JsServiceAbility_0100 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") @@ -176,12 +179,12 @@ describe('ActsStServiceAbilityTest', function () { it('ACTS_JsServiceAbility_0200', 0, async function (done) { console.debug('ACTS_JsServiceAbility_0200==== { + await commonEvent.createSubscriber(CommonEventSubscribeInfo0200).then(async (data) => { console.debug("=ACTS_JsServiceAbility_0200 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); subscriber0200 = data; - await commonEvent.subscribe(subscriber0200, async (err, data) => { + commonEvent.subscribe(subscriber0200, async (err, data) => { console.debug("=ACTS_JsServiceAbility_0200 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") @@ -193,7 +196,7 @@ describe('ActsStServiceAbilityTest', function () { done() }); }) - await featureAbility.startAbility( + featureAbility.startAbility( { want: { @@ -223,12 +226,12 @@ describe('ActsStServiceAbilityTest', function () { it('ACTS_JsServiceAbility_0300', 0, async function (done) { console.debug('ACTS_JsServiceAbility_0300==== { + await commonEvent.createSubscriber(CommonEventSubscribeInfo0300).then(async (data) => { console.debug("=ACTS_JsServiceAbility_0300 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); subscriber0300 = data; - await commonEvent.subscribe(subscriber0300, async (err, data) => { + commonEvent.subscribe(subscriber0300, async (err, data) => { console.debug("=ACTS_JsServiceAbility_0300 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") @@ -296,12 +299,12 @@ describe('ActsStServiceAbilityTest', function () { it('ACTS_JsServiceAbility_0400', 0, async function (done) { console.debug('ACTS_JsServiceAbility_0400==== { + await commonEvent.createSubscriber(CommonEventSubscribeInfo0400).then(async (data) => { console.debug("=ACTS_JsServiceAbility_0400 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); subscriber0400 = data; - await commonEvent.subscribe(subscriber0400, async (err, data) => { + commonEvent.subscribe(subscriber0400, async (err, data) => { console.debug("=ACTS_JsServiceAbility_0400 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") @@ -364,12 +367,12 @@ describe('ActsStServiceAbilityTest', function () { console.log('ACTS_JsServiceAbility_0500==== { + await commonEvent.createSubscriber(CommonEventSubscribeInfo0500).then(async (data) => { console.debug("=ACTS_JsServiceAbility_0500 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); subscriber0500 = data; - await commonEvent.subscribe(subscriber0500, async (err, data) => { + commonEvent.subscribe(subscriber0500, async (err, data) => { console.debug("=ACTS_JsServiceAbility_0500 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") @@ -441,12 +444,12 @@ describe('ActsStServiceAbilityTest', function () { try { var currentAlertTimeout; var mConnIdJsAsyncCallback; - commonEvent.createSubscriber(CommonEventSubscribeInfo0600).then(async (data) => { + await commonEvent.createSubscriber(CommonEventSubscribeInfo0600).then(async (data) => { console.debug("=ACTS_JsServiceAbility_0600 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); subscriber0600 = data; - await commonEvent.subscribe(subscriber0600, async (err, data) => { + commonEvent.subscribe(subscriber0600, async (err, data) => { console.debug("=ACTS_JsServiceAbility_0600 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") @@ -526,23 +529,25 @@ describe('ActsStServiceAbilityTest', function () { it('ACTS_JsServiceAbility_0900', 0, async function (done) { console.debug('ACTS_JsServiceAbility_0900==== { + await commonEvent.createSubscriber(CommonEventSubscribeInfo0900).then(async (data) => { console.debug("=ACTS_JsServiceAbility_0900 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); subscriber0900 = data; - await commonEvent.subscribe(subscriber0900, async (err, data) => { + commonEvent.subscribe(subscriber0900, async (err, data) => { console.debug("=ACTS_JsServiceAbility_0900 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); expect("ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_0900").assertEqual( data.event); + await sleep(1000) unsubscribe("ACTS_JsServiceAbility_0900_unsubscribe", subscriber0900); console.debug('ACTS_JsServiceAbility_0900==== { + await commonEvent.createSubscriber(CommonEventSubscribeInfo1000).then(async (data) => { console.debug("=ACTS_JsServiceAbility_1000 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); subscriber1000 = data; - await commonEvent.subscribe(subscriber1000, async (err, data) => { + commonEvent.subscribe(subscriber1000, async (err, data) => { console.debug("=ACTS_JsServiceAbility_1000 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); expect("ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_1000").assertEqual( data.event); + await sleep(1000) unsubscribe("ACTS_JsServiceAbility_1000_unsubscribe", subscriber1000); console.debug('ACTS_JsServiceAbility_1000==== { + await commonEvent.createSubscriber(CommonEventSubscribeInfo1300).then(async (data) => { console.debug("=ACTS_JsServiceAbility_1300 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); subscriber1300 = data; - await commonEvent.subscribe(subscriber1300, async (err, data) => { + commonEvent.subscribe(subscriber1300, async (err, data) => { console.debug("=ACTS_JsServiceAbility_1300 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") @@ -703,12 +710,12 @@ describe('ActsStServiceAbilityTest', function () { try { var currentAlertTimeout; var mConnIdJsAsyncCallback; - commonEvent.createSubscriber(CommonEventSubscribeInfo1400).then(async (data) => { + await commonEvent.createSubscriber(CommonEventSubscribeInfo1400).then(async (data) => { console.debug("=ACTS_JsServiceAbility_1400 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); subscriber1400 = data; - await commonEvent.subscribe(subscriber1400, async (err, data) => { + commonEvent.subscribe(subscriber1400, async (err, data) => { console.debug("=ACTS_JsServiceAbility_1400 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") @@ -784,12 +791,12 @@ describe('ActsStServiceAbilityTest', function () { console.log('ACTS_JsServiceAbility_1500==== { + await commonEvent.createSubscriber(CommonEventSubscribeInfo1500).then(async (data) => { console.debug("=ACTS_JsServiceAbility_1500 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); subscriber1500 = data; - await commonEvent.subscribe(subscriber1500, async (err, data) => { + commonEvent.subscribe(subscriber1500, async (err, data) => { console.debug("=ACTS_JsServiceAbility_1500 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets index e565491bc46ce2e45a13ebee915798feb705af83..c1d73cf616c06add264353866c6d4146f7d68c4c 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets @@ -32,7 +32,7 @@ export default function ConnectAbilityTest1() { return new Promise((resolve) => setTimeout(resolve, time)) } - describe('FreeInstall_FA_ConnectAbility', function () { + describe('FreeInstall_FA_ConnectAbilityOne', function () { beforeAll(async function (done) { console.info("FreeInstall_FA_ConnectAbility before all called"); abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()