diff --git a/barrierfree/accessibilityconfig/Test.json b/barrierfree/accessibilityconfig/Test.json index c6b592b959dcf69c48fce927bff917c804e03fb0..eea8e56d74290ba0f190a2f86e276942793ccd45 100644 --- a/barrierfree/accessibilityconfig/Test.json +++ b/barrierfree/accessibilityconfig/Test.json @@ -1,10 +1,12 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", - "test-timeout": "180000", - "package": "com.example.accessibilityconfig", - "shell-timeout": "180000" + "type": "OHJSUnitTest", + "test-timeout": "240000", + "bundle-name": "com.example.accessibilityconfig", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 70000 }, "kits": [ { diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/MainAbility.ts index e9c126eb7f2bb41f03a0bfc91f68a8568e38c8f8..f9014b87a17cf7c30fb45d2f0455ac8e783a64f7 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/MainAbility.ts @@ -1,3 +1,17 @@ +/* + * 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' export default class MainAbility extends Ability { @@ -18,7 +32,7 @@ export default class MainAbility extends Ability { //globalThis.windowStage = windowStage //globalThis.abilityStorage = this.storage globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) } onWindowStageDestroy() { diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/pages/index/index.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/pages/index/index.ets similarity index 52% rename from barrierfree/accessibilityconfig/entry/src/main/ets/pages/index/index.ets rename to barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/pages/index/index.ets index d45c30711626494a6cf3dae2aa6f3f5bfa94f044..51bf7178e8c554cc5f4fb4ad6359e9356f97aadc 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/ets/pages/index/index.ets +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -12,10 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import file from '@system.file'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" -import testsuite from "../../test/List.test" +import router from '@ohos.router'; @Entry @Component @@ -24,22 +21,6 @@ struct Index { aboutToAppear(){ console.info("start run testcase!!!!"); - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)); - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters); - testsuite(globalThis.abilityContext); - core.execute(); } build() { diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/TestAbility.ts b/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..a8203eae937701d9c837e8c5096c4d880e5ebbcc --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,53 @@ +/* + * 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 'hypium/index' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'TestAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/pages/index.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b93567f962921124b282f78c8ef123965d1460c9 --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * 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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @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/barrierfree/accessibilityconfig/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/barrierfree/accessibilityconfig/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..c56fa98f7a9cc8d48bfe0b87072ef613ba1ab785 --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,72 @@ +/* + * 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' + ]) + 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() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -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/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets index a30566f31afe041cdbd7cad02f665bbfac429242..71ead2c9de5b96c9184627a52de7ce843dc2fd76 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets @@ -12,10 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import config from '@ohos.accessibility.config' -export default function abilityTest(abilityContext) { +export default function abilityTest() { describe('AccessibilityConfigTest', function () { beforeEach(async function (done) { diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/test/List.test.ets index ee66692b52255bc69ddec15a3f8919a8caaa4898..8cfe3dd44fdfca24d897039ddab1dc4dfb52d7e9 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/ets/test/List.test.ets +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/test/List.test.ets @@ -14,6 +14,6 @@ */ import abilityTest from './AccessibilityConfig.test.ets' -export default function testsuite(abilityContext) { - abilityTest(abilityContext) +export default function testsuite() { + abilityTest() } \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/module.json b/barrierfree/accessibilityconfig/entry/src/main/module.json index 69501f617c648474e7cfadad8f5fdb64fdc73f7c..716634826d1e04d1e1fc943f51b7bbc6b247a2e8 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/module.json +++ b/barrierfree/accessibilityconfig/entry/src/main/module.json @@ -13,8 +13,8 @@ "uiSyntax": "ets", "pages": "$profile:main_pages", "abilities": [{ - "name": "com.example.accessibilityconfig.MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "name": "TestAbility", + "srcEntrance": "./ets/TestAbility/TestAbility.ts", "description": "$string:phone_entry_main", "icon": "$media:icon", "label": "$string:entry_label", diff --git a/barrierfree/accessibilityconfig/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibilityconfig/entry/src/main/resources/base/profile/main_pages.json index 360bf0b466d749ca4f3bb1c37f14d8e6427222eb..43f5bb10ddb7e3fc4aa0b71a76818b8b48cc5bc2 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/resources/base/profile/main_pages.json +++ b/barrierfree/accessibilityconfig/entry/src/main/resources/base/profile/main_pages.json @@ -1,5 +1,5 @@ { "src": [ - "pages/index/index" + "TestAbility/pages/index" ] } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json index 3ede21fabcd5774b96de0564a7d2ba723b3194b5..e565426f0d39470bcb38bdc4e6be7fc187ab3d8f 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json @@ -1,10 +1,12 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "180000", - "package": "ohos.acts.bundle.stage.test", - "shell-timeout": "600000" + "bundle-name": "ohos.acts.bundle.stage.test", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 70000 }, "kits": [ { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/MainAbility.ts b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/MainAbility.ts index 72b03d747b3e2e8bdf18ea37c54c789bebb767bb..87b6463a2283b59f971ffea6a3011377c55bc1f3 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -16,7 +16,7 @@ export default class MainAbility extends Ability { // Main window is created, set main page for this ability console.log("[Demo] MainAbility onWindowStageCreate") globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) } onWindowStageDestroy() { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/index/index.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/pages/index/index.ets similarity index 60% rename from bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/index/index.ets rename to bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/pages/index/index.ets index 37b86f5096f1273b71299ee08e085211c5add410..f172d89b07521c2a1991ab441e99479f72823209 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/index/index.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -12,10 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import file from '@system.file'; +import router from '@ohos.router'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" -import testsuite from "../../test/List.test.ets" +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../../test/List.test' @Entry @@ -24,22 +25,12 @@ struct Index { aboutToAppear(){ console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) - core.execute() + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } build() { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/second/second.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/pages/second/second.ets similarity index 100% rename from bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/second/second.ets rename to bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/pages/second/second.ets diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/TestAbility.ts b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..fb7ef2b1e9e7573f5679e287d371c8acab61d2e8 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,30 @@ +import Ability from '@ohos.application.Ability' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'TestAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/pages/index.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b93567f962921124b282f78c8ef123965d1460c9 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * 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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @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/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..3149248aff33bcf98aa3bd3c3f65c003ab80df38 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,58 @@ +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' + ]) + 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() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ohos.acts.bundle.stage.test.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/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets index 0e54eaaebf86a7202373171db98d3e84c8d86a57..4d53d13b00964c93a4416e0771a9938fac3ac35d 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets @@ -14,7 +14,7 @@ */ import bundle from '@ohos.bundle'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" const MODULE_NAME = "phone" const MODULE_NAME_TEST = "phone1" @@ -26,7 +26,7 @@ const METADATA_NAME1 = "ohos.ability.form1" const METADATA_NAME2 = "ohos.ability.form2" const METADATA_NAME3 = "ohos.ability.form3" const METADATA_NAME_TEST = "ohos.test.form" -const PROFILE_JSON_STRING = "{\"src\":[\"pages/index/index\",\"pages/second/second\"]}" +const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainAbility/pages/second/second\"]}" export default function getProfileByAbility() { describe('getProfileByAbility', function () { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets index cc9a2b7e6bc2e60b956bf5a6825fad05b40aa785..1f96904892aaf4470b4f4084c14c9944265b215f 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets @@ -14,7 +14,7 @@ */ import bundle from '@ohos.bundle'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" const MODULE_NAME = "phone" const MODULE_NAME_TEST = "phone1" @@ -26,7 +26,7 @@ const METADATA_NAME1 = "ohos.extension.form1" const METADATA_NAME2 = "ohos.extension.form2" const METADATA_NAME3 = "ohos.extension.form3" const METADATA_NAME_TEST = "ohos.test.form" -const PROFILE_JSON_STRING = "{\"src\":[\"pages/index/index\",\"pages/second/second\"]}" +const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainAbility/pages/second/second\"]}" export default function getProfileByExtensionAbility() { describe('getProfileByExtensionAbility', function () { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/List.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/List.test.ets index 0f706c4b4fd04fb5b80569ac2dcb25851cb0c9a5..9f75ecfa43762ceaab1ac9c2b3211e1908e8d02e 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/List.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/List.test.ets @@ -16,7 +16,7 @@ import getProfileByAbility from './GetProfileByAbility.test.ets'; import getProfileByExtensionAbility from './GetProfileByExtensionAbility.test.ets'; -export default function testsuite(context) { +export default function testsuite() { getProfileByAbility(); getProfileByExtensionAbility(); } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config.json index 10d2c96da1a13b5f2988bb3fea216cde795b58d6..e892d44722d9e5b09ff78cb069ccc15d1fac872e 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config.json @@ -1,6 +1,6 @@ { "src": [ - "pages/index/index", - "pages/second/second" + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" ] } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/main_pages.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/main_pages.json index 6898b31d2085f478ee1ed9d933a5910cbf901d92..02221db61d317863114ff0ca4dd2b33586abff12 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/main_pages.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/main_pages.json @@ -1,6 +1,6 @@ { "src": [ - "pages/index/index", - "pages/second/second" + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" ] } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/shortcuts_config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/shortcuts_config.json index 96b478210df9884592229ae2db6f6bb7f86c14f4..010134e5cdcb46ef62097816f127dac0bb93a398 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/shortcuts_config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/shortcuts_config.json @@ -1,6 +1,6 @@ { "src": [ - "pages/index/index", - "pages/second/second" + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" ] } \ No newline at end of file