提交 70121b7d 编写于 作者: J jiyong_sd

Adapt to the new framework

Signed-off-by: Njiyong_sd <jiyong@huawei.com>
Change-Id: I2cd3a19825a893b98dd98fd11326b5d4a9bf932d
上级 f050e16a
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "120000", "test-timeout": "180000",
"package": "com.example.startabilityforresult", "bundle-name": "com.example.startabilityforresult",
"shell-timeout": "60000" "module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 70000
}, },
"kits": [ "kits": [
{ {
......
...@@ -30,7 +30,7 @@ export default class MainAbility extends Ability { ...@@ -30,7 +30,7 @@ export default class MainAbility extends Ability {
// Main window is created, set main page for this ability // Main window is created, set main page for this ability
console.log("MainAbility onWindowStageCreate") console.log("MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null) windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null)
} }
onWindowStageDestroy() { onWindowStageDestroy() {
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import file from '@system.file'; import router from '@ohos.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" import { Hypium } from '@ohos/hypium'
import testsuite from "../../test/List.test.ets" import testsuite from '../../../test/List.test'
var testTime = 0; var testTime = 0;
@Entry @Entry
...@@ -25,22 +25,12 @@ struct Index { ...@@ -25,22 +25,12 @@ struct Index {
aboutToAppear(){ aboutToAppear(){
console.info("start run testcase!!!!") console.info("start run testcase!!!!")
if(testTime++==0){ if(testTime++==0){
const core = Core.getInstance() var abilityDelegator: any
const expectExtend = new ExpectExtend({ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
'id': 'extend' var abilityDelegatorArguments: any
}) abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
core.addService('expect', expectExtend) console.info('start run testcase!!!')
const reportExtend = new ReportExtend(file) Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
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()
} }
} }
......
...@@ -51,7 +51,7 @@ export default class MainAbility extends Ability { ...@@ -51,7 +51,7 @@ export default class MainAbility extends Ability {
// Main window is created, set main page for this ability // Main window is created, set main page for this ability
console.log("MainAbility2 onWindowStageCreate") console.log("MainAbility2 onWindowStageCreate")
globalThis.abilityContext = this.context globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/second/second", null) windowStage.setUIContent(this.context, "MainAbility/pages/second/second", null)
} }
onWindowStageDestroy() { onWindowStageDestroy() {
......
/*
* 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 TestAbility extends Ability {
onCreate(want, launchParam) {
console.log('TestAbility onCreate')
}
onDestroy() {
console.log('TestAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate')
windowStage.loadContent("TestAbility/pages/index", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
});
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
/*
* 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
/*
* 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()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a com.example.startabilityforresult.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
if (debug == 'true')
{
cmd += ' -D'
}
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
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent'
var subscriberInfo_MainAbility = { var subscriberInfo_MainAbility = {
...@@ -21,7 +21,7 @@ var subscriberInfo_MainAbility = { ...@@ -21,7 +21,7 @@ var subscriberInfo_MainAbility = {
const START_ABILITY_TIMEOUT = 5000; const START_ABILITY_TIMEOUT = 5000;
console.debug("====>in Ability.test====>"); console.debug("====>in Ability.test====>");
export default function abilityTest(abilityContext) { export default function abilityTest() {
describe('ActsGetDisplayIdStartAbilityForResultTest', function () { describe('ActsGetDisplayIdStartAbilityForResultTest', function () {
console.debug("====>in ActsGetDisplayIdStartAbilityForResultTest====>"); console.debug("====>in ActsGetDisplayIdStartAbilityForResultTest====>");
...@@ -57,7 +57,7 @@ export default function abilityTest(abilityContext) { ...@@ -57,7 +57,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_startAbilityForResult_0100 Create Subscriber====>"); console.debug("====>ACTS_startAbilityForResult_0100 Create Subscriber====>");
subscriber = data; subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack); commonEvent.subscribe(subscriber, subscribeCallBack);
await abilityContext.startAbilityForResult( await globalThis.abilityContext.startAbilityForResult(
{ {
bundleName: 'com.example.startabilityforresult', bundleName: 'com.example.startabilityforresult',
abilityName: 'com.example.startabilityforresult.MainAbility2', abilityName: 'com.example.startabilityforresult.MainAbility2',
...@@ -115,7 +115,7 @@ export default function abilityTest(abilityContext) { ...@@ -115,7 +115,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_startAbilityForResult_0200 Create Subscriber====>"); console.debug("====>ACTS_startAbilityForResult_0200 Create Subscriber====>");
subscriber = data; subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack); commonEvent.subscribe(subscriber, subscribeCallBack);
await abilityContext.startAbilityForResult( await globalThis.abilityContext.startAbilityForResult(
{ {
bundleName: 'com.example.startabilityforresult', bundleName: 'com.example.startabilityforresult',
abilityName: 'com.example.startabilityforresult.MainAbility2', abilityName: 'com.example.startabilityforresult.MainAbility2',
...@@ -176,7 +176,7 @@ export default function abilityTest(abilityContext) { ...@@ -176,7 +176,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_startAbilityForResult_0300 Create Subscriber====>"); console.debug("====>ACTS_startAbilityForResult_0300 Create Subscriber====>");
subscriber = data; subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack); commonEvent.subscribe(subscriber, subscribeCallBack);
await abilityContext.startAbilityForResult( await globalThis.abilityContext.startAbilityForResult(
{ {
bundleName: 'com.example.startabilityforresult', bundleName: 'com.example.startabilityforresult',
abilityName: 'com.example.startabilityforresult.MainAbility2', abilityName: 'com.example.startabilityforresult.MainAbility2',
...@@ -235,7 +235,7 @@ export default function abilityTest(abilityContext) { ...@@ -235,7 +235,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_startAbilityForResult_0400_Create Subscriber====>"); console.debug("====>ACTS_startAbilityForResult_0400_Create Subscriber====>");
subscriber = data; subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack); await commonEvent.subscribe(subscriber, subscribeCallBack);
connId = await abilityContext.connectAbility( connId = await globalThis.abilityContext.connectAbility(
{ {
bundleName: "com.example.startabilityforresult", bundleName: "com.example.startabilityforresult",
abilityName: "com.example.startabilityforresult.ServiceAbility", abilityName: "com.example.startabilityforresult.ServiceAbility",
...@@ -246,7 +246,7 @@ export default function abilityTest(abilityContext) { ...@@ -246,7 +246,7 @@ export default function abilityTest(abilityContext) {
}) })
function unSubscribeCallback() { function unSubscribeCallback() {
abilityContext.disconnectAbility( globalThis.abilityContext.disconnectAbility(
connId, connId,
(error, data) => { (error, data) => {
console.log('startAbilityForResult_0400 Disconnect result errCode : ' + error.code + " data: " + data) console.log('startAbilityForResult_0400 Disconnect result errCode : ' + error.code + " data: " + data)
...@@ -258,7 +258,7 @@ export default function abilityTest(abilityContext) { ...@@ -258,7 +258,7 @@ export default function abilityTest(abilityContext) {
function timeout() { function timeout() {
expect().assertFail(); expect().assertFail();
abilityContext.disconnectAbility( globalThis.abilityContext.disconnectAbility(
connId, connId,
(error, data) => { (error, data) => {
console.log('DisconnectAbility_0400 result errCode : ' + error.code + " data: " + data) console.log('DisconnectAbility_0400 result errCode : ' + error.code + " data: " + data)
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
import abilityTest from './Ability.test.ets' import abilityTest from './Ability.test.ets'
export default function testsuite(context) { export default function testsuite() {
abilityTest(context) abilityTest()
} }
\ No newline at end of file
{ {
"src": [ "src": [
"pages/index/index", "MainAbility/pages/index/index",
"pages/second/second" "MainAbility/pages/second/second"
] ]
} }
\ No newline at end of file
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "120000", "test-timeout": "180000",
"package": "com.example.newwanttest", "bundle-name": "com.example.newwanttest",
"shell-timeout": "60000" "module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 70000
}, },
"kits": [ "kits": [
{ {
......
...@@ -32,7 +32,7 @@ export default class MainAbility extends Ability { ...@@ -32,7 +32,7 @@ export default class MainAbility extends Ability {
// Main window is created, set main page for this ability // Main window is created, set main page for this ability
console.log("MainAbility onWindowStageCreate") console.log("MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null) windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null)
} }
onWindowStageDestroy() { onWindowStageDestroy() {
......
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
import file from '@system.file'; import router from '@ohos.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" import { Hypium } from '@ohos/hypium'
import testsuite from "../../test/List.test.ets" import testsuite from '../../../test/List.test'
@Entry @Entry
...@@ -25,22 +25,12 @@ struct Index { ...@@ -25,22 +25,12 @@ struct Index {
aboutToAppear(){ aboutToAppear(){
console.info("start run testcase!!!!") console.info("start run testcase!!!!")
const core = Core.getInstance() var abilityDelegator: any
const expectExtend = new ExpectExtend({ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
'id': 'extend' var abilityDelegatorArguments: any
}) abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
core.addService('expect', expectExtend) console.info('start run testcase!!!')
const reportExtend = new ReportExtend(file) Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
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() { build() {
......
/*
* 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 TestAbility extends Ability {
onCreate(want, launchParam) {
console.log('TestAbility onCreate')
}
onDestroy() {
console.log('TestAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate')
windowStage.loadContent("TestAbility/pages/index", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
});
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
/*
* 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
/*
* 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()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a com.example.newwanttest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
if (debug == 'true')
{
cmd += ' -D'
}
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
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * 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 commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent'
let subscriberInfo = { let subscriberInfo = {
...@@ -35,7 +35,7 @@ let subscriberInfo = { ...@@ -35,7 +35,7 @@ let subscriberInfo = {
let flagNewWant = false; let flagNewWant = false;
export default function abilityTest(abilityContext) { export default function abilityTest() {
describe('ActsNewWantTest', function () { describe('ActsNewWantTest', function () {
/** /**
...@@ -57,7 +57,7 @@ export default function abilityTest(abilityContext) { ...@@ -57,7 +57,7 @@ export default function abilityTest(abilityContext) {
await commonEvent.subscribe(Subscriber, SubscribeCallBack); await commonEvent.subscribe(Subscriber, SubscribeCallBack);
}) })
abilityContext.startAbility({ globalThis.abilityContext.startAbility({
bundleName: "com.example.newwanthap", bundleName: "com.example.newwanthap",
abilityName: "com.example.newwanthapa.MainAbility" abilityName: "com.example.newwanthapa.MainAbility"
}, (error, data) => { }, (error, data) => {
...@@ -127,7 +127,7 @@ export default function abilityTest(abilityContext) { ...@@ -127,7 +127,7 @@ export default function abilityTest(abilityContext) {
await commonEvent.subscribe(Subscriber, SubscribeCallBack); await commonEvent.subscribe(Subscriber, SubscribeCallBack);
}) })
abilityContext.startAbility({ globalThis.abilityContext.startAbility({
bundleName: "com.example.newwanthap", bundleName: "com.example.newwanthap",
abilityName: "com.example.newwanthapa.SecondAbility" abilityName: "com.example.newwanthapa.SecondAbility"
}, (error, data) => { }, (error, data) => {
...@@ -196,7 +196,7 @@ export default function abilityTest(abilityContext) { ...@@ -196,7 +196,7 @@ export default function abilityTest(abilityContext) {
await commonEvent.subscribe(Subscriber, SubscribeCallBack); await commonEvent.subscribe(Subscriber, SubscribeCallBack);
}) })
abilityContext.startAbility({ globalThis.abilityContext.startAbility({
bundleName: "com.example.newwanthap", bundleName: "com.example.newwanthap",
abilityName: "com.example.newwanthapa.MainAbility", abilityName: "com.example.newwanthapa.MainAbility",
action: "startStandard0300" action: "startStandard0300"
...@@ -266,7 +266,7 @@ export default function abilityTest(abilityContext) { ...@@ -266,7 +266,7 @@ export default function abilityTest(abilityContext) {
await commonEvent.subscribe(Subscriber, SubscribeCallBack); await commonEvent.subscribe(Subscriber, SubscribeCallBack);
}) })
abilityContext.startAbility({ globalThis.abilityContext.startAbility({
bundleName: "com.example.newwanthap", bundleName: "com.example.newwanthap",
abilityName: "com.example.newwanthapa.SecondAbility", abilityName: "com.example.newwanthapa.SecondAbility",
action: "startSingleton0400" action: "startSingleton0400"
...@@ -338,7 +338,7 @@ export default function abilityTest(abilityContext) { ...@@ -338,7 +338,7 @@ export default function abilityTest(abilityContext) {
await commonEvent.subscribe(Subscriber, SubscribeCallBack); await commonEvent.subscribe(Subscriber, SubscribeCallBack);
}) })
abilityContext.startAbility({ globalThis.abilityContext.startAbility({
bundleName: "com.example.newwanthap", bundleName: "com.example.newwanthap",
abilityName: "com.example.newwanthapb.MainAbility", abilityName: "com.example.newwanthapb.MainAbility",
action: "startHapB" action: "startHapB"
...@@ -410,7 +410,7 @@ export default function abilityTest(abilityContext) { ...@@ -410,7 +410,7 @@ export default function abilityTest(abilityContext) {
await commonEvent.subscribe(Subscriber, SubscribeCallBack); await commonEvent.subscribe(Subscriber, SubscribeCallBack);
}) })
abilityContext.startAbility({ globalThis.abilityContext.startAbility({
bundleName: "com.example.newwanthapa", bundleName: "com.example.newwanthapa",
abilityName: "com.example.newwanthapc.MainAbility", abilityName: "com.example.newwanthapc.MainAbility",
action: "startHapC" action: "startHapC"
...@@ -482,7 +482,7 @@ export default function abilityTest(abilityContext) { ...@@ -482,7 +482,7 @@ export default function abilityTest(abilityContext) {
await commonEvent.subscribe(Subscriber, SubscribeCallBack); await commonEvent.subscribe(Subscriber, SubscribeCallBack);
}) })
abilityContext.startAbility({ globalThis.abilityContext.startAbility({
bundleName: "com.example.newwanthap", bundleName: "com.example.newwanthap",
abilityName: "com.example.newwanthapa.SecondAbility", abilityName: "com.example.newwanthapa.SecondAbility",
action: "startSecondAbility0700" action: "startSecondAbility0700"
...@@ -553,7 +553,7 @@ export default function abilityTest(abilityContext) { ...@@ -553,7 +553,7 @@ export default function abilityTest(abilityContext) {
await commonEvent.subscribe(Subscriber, SubscribeCallBack); await commonEvent.subscribe(Subscriber, SubscribeCallBack);
}) })
abilityContext.startAbility({ globalThis.abilityContext.startAbility({
bundleName: "com.example.newwanthap", bundleName: "com.example.newwanthap",
abilityName: "com.example.newwanthapa.MainAbility", abilityName: "com.example.newwanthapa.MainAbility",
action: "startMainAbility0800" action: "startMainAbility0800"
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
import abilityTest from './Ability.test.ets' import abilityTest from './Ability.test.ets'
export default function testsuite(context) { export default function testsuite() {
abilityTest(context) abilityTest()
} }
\ No newline at end of file
{ {
"src": [ "src": [
"pages/index/index", "MainAbility/pages/index/index",
"pages/second/second" "MainAbility/pages/second/second"
] ]
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册