提交 71affb88 编写于 作者: C chengxingzhen
上级 a387f71f
...@@ -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 'hypium/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import commonEvent from "@ohos.commonEvent" import commonEvent from "@ohos.commonEvent"
......
...@@ -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 'hypium/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import commonEvent from "@ohos.commonEvent" import commonEvent from "@ohos.commonEvent"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test' import testsuite from '../test/List.test'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
......
...@@ -13,39 +13,39 @@ ...@@ -13,39 +13,39 @@
* limitations under the License. * limitations under the License.
*/ */
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function abilityTest() { export default function abilityTest() {
describe('ACTS_AACommand_01_3', function () { describe('ACTS_AACommand_01_3', function () {
/** /**
* @tc.number: ACTS_AACommand_printSync_0100 * @tc.number: ACTS_AACommand_printSync_01_0100
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid,
* The printSync information includes Chinese, special characters, etc. * The printSync 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 * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through
* the test command. * the test command.
*/ */
it('ACTS_AACommand_printSync_0100', 0, async function (done) { it('ACTS_AACommand_printSync_01_0100', 0, async function (done) {
console.log("ACTS_AACommand_printSync_0100 start ====> " ) console.log("ACTS_AACommand_printSync_01_0100 start ====> " )
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146' var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
globalThis.abilityDelegator.printSync(msg); globalThis.abilityDelegator.printSync(msg);
console.log("ACTS_AACommand_printSync_0100 printSync end ====> " ) console.log("ACTS_AACommand_printSync_01_0100 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_0100 end' var finishmsg = 'ACTS_AACommand_printSync_01_0100 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then((data)=>{ globalThis.abilityDelegator.finishTest(finishmsg, 1).then((data)=>{
console.log("ACTS_AACommand_printSync_0100 finishTest test end ========> callback " ) console.log("ACTS_AACommand_printSync_01_0100 finishTest test end ========> callback " )
console.log("ACTS_AACommand_printSync_0100 finishTest test end " + console.log("ACTS_AACommand_printSync_01_0100 finishTest test end " +
"========> callback data: "+JSON.stringify(data)) "========> callback data: "+JSON.stringify(data))
done() done()
}) })
}) })
/** /**
* @tc.number: ACTS_AACommand_printSync_0200 * @tc.number: ACTS_AACommand_printSync_01_0200
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid,
* The length of the printSync message is 1000 characters. * The length of the printSync message is 1000 characters.
* @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through
* the test command. * the test command.
*/ */
it('ACTS_AACommand_printSync_0200', 0, async function (done) { it('ACTS_AACommand_printSync_01_0200', 0, async function (done) {
var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' + 'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
...@@ -58,22 +58,22 @@ export default function abilityTest() { ...@@ -58,22 +58,22 @@ export default function abilityTest() {
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
globalThis.abilityDelegator.printSync(msg); globalThis.abilityDelegator.printSync(msg);
console.log("ACTS_AACommand_printSync_0200 printSync end ====> " ) console.log("ACTS_AACommand_printSync_01_0200 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_0200 end' var finishmsg = 'ACTS_AACommand_printSync_01_0200 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{
console.log("ACTS_AACommand_printSync_0200 print test end ========> callback " ) console.log("ACTS_AACommand_printSync_01_0200 print test end ========> callback " )
done() done()
}) })
}) })
/** /**
* @tc.number: ACTS_AACommand_printSync_0300 * @tc.number: ACTS_AACommand_printSync_01_0300
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid
* The length of the printSync message is greater than 1000 characters. * The length of the printSync message is greater than 1000 characters.
* @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through
* the test command. * the test command.
*/ */
it('ACTS_AACommand_printSync_0300', 0, async function (done) { it('ACTS_AACommand_printSync_01_0300', 0, async function (done) {
var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' + 'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
...@@ -87,27 +87,27 @@ export default function abilityTest() { ...@@ -87,27 +87,27 @@ export default function abilityTest() {
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' +
'fffffffffff' 'fffffffffff'
globalThis.abilityDelegator.printSync(msg); globalThis.abilityDelegator.printSync(msg);
console.log("ACTS_AACommand_printSync_0300 printSync end ====> " ) console.log("ACTS_AACommand_printSync_01_0300 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_0300 end' var finishmsg = 'ACTS_AACommand_printSync_01_0300 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{
console.log("ACTS_AACommand_printSync_0300 print test end ========> callback " ) console.log("ACTS_AACommand_printSync_01_0300 print test end ========> callback " )
done() done()
}) })
}) })
/** /**
* @tc.number: ACTS_AACommand_printSync_0400 * @tc.number: ACTS_AACommand_printSync_01_0400
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid,
* printSync information is null. * printSync information is null.
* @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through
* the test command. * the test command.
*/ */
it('ACTS_AACommand_printSync_0400', 0, async function (done) { it('ACTS_AACommand_printSync_01_0400', 0, async function (done) {
globalThis.abilityDelegator.printSync(null); globalThis.abilityDelegator.printSync(null);
console.log("ACTS_AACommand_printSync_0300 printSync end ====> " ) console.log("ACTS_AACommand_printSync_01_0300 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_0400 end' var finishmsg = 'ACTS_AACommand_printSync_01_0400 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{
console.log("ACTS_AACommand_printSync_0400 print test end ========> callback " ) console.log("ACTS_AACommand_printSync_01_0400 print test end ========> callback " )
done() done()
}) })
}) })
......
...@@ -14,20 +14,11 @@ ...@@ -14,20 +14,11 @@
*/ */
import Ability from '@ohos.application.Ability' 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 MainAbility extends Ability { export default class MainAbility extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
globalThis.abilityContext = this.context; globalThis.abilityContext = this.context;
console.log('MainAbility onCreate') console.log('MainAbility onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
} }
onDestroy() { onDestroy() {
...@@ -36,7 +27,7 @@ export default class MainAbility extends Ability { ...@@ -36,7 +27,7 @@ export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
console.log('MainAbility onWindowStageCreate') console.log('MainAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) windowStage.setUIContent(this.context, 'pages/index', null)
} }
......
/*
* 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('MainAbility 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
...@@ -13,17 +13,103 @@ ...@@ -13,17 +13,103 @@
* limitations under the License. * limitations under the License.
*/ */
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
@Entry @Entry
@Component @Component
struct Index { struct Index {
@State message: string = 'Hello World' aboutToAppear() {
console.info('MainAbility index aboutToAppear')
console.info('start run testcase!!!')
let cmd: any
let abilityDelegatorArguments: any
let abilityDelegator: any
function sleep(delay) {
let start = (new Date()).getTime();
while ((new Date()).getTime() - start < delay) {
continue;
}
}
function test(time) {
sleep(time);
}
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
cmd = 'aa test -b com.example.aacommandprintsync -m entry_test -s class ' +
'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0100 -s unittest OpenHarmonyTestRunner'
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log('ACTS_AACommand_printSync_01_0100 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_printSync_01_0100 stdResult = ' + data.stdResult)
globalThis.stdResult1 = data.stdResult;
console.log('ACTS_AACommand_printSync_01_0100 - executeShellCommand: end ')
})
test(3000)
cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' +
'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0200 -s unittest OpenHarmonyTestRunner'
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log('ACTS_AACommand_printSync_01_0200 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_printSync_01_0200 stdResult = ' + data.stdResult)
globalThis.stdResult2 = data.stdResult;
console.log('ACTS_AACommand_printSync_01_0200 - executeShellCommand: end ')
})
test(3000)
cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' +
'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0300 -s unittest OpenHarmonyTestRunner'
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log('ACTS_AACommand_printSync_01_0300 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_printSync_01_0300 stdResult = ' + data.stdResult)
globalThis.stdResult3 = data.stdResult;
console.log('ACTS_AACommand_printSync_01_0300 - executeShellCommand: end ')
})
test(3000)
cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' +
'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0400 -s unittest OpenHarmonyTestRunner'
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log('ACTS_AACommand_printSync_01_0400 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_printSync_01_0400 stdResult = ' + data.stdResult)
globalThis.stdResult4 = data.stdResult;
console.log('ACTS_AACommand_printSync_01_0400 - executeShellCommand: end ')
})
test(3000)
setTimeout(() => {
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, 15000)
}
@State message: string = 'Hello World'
build() { build() {
Row() { Row() {
Column() { Column() {
Text(this.message) Text(this.message)
.fontSize(50) .fontSize(50)
.fontWeight(FontWeight.Bold) .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%') .width('100%')
} }
......
...@@ -14,21 +14,10 @@ ...@@ -14,21 +14,10 @@
*/ */
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import appManager from '@ohos.application.appManager';
const DELAY = 3000 let msg: any
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
export default function abilityTest() { export default function abilityTest() {
describe('ActsAbilityTest', function () { describe('ActsAbilityTest', function () {
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
function checkRunningProcess(name, dataInfo) {
for (let i = 0, len = dataInfo.length; i < len; i++) {
if (dataInfo[i].processName == name) {
return true;
}
}
return false;
}
/** /**
* @tc.number: ACTS_AACommand_printSync_0100 * @tc.number: ACTS_AACommand_printSync_0100
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid
...@@ -37,27 +26,10 @@ export default function abilityTest() { ...@@ -37,27 +26,10 @@ export default function abilityTest() {
* the test command. * the test command.
*/ */
it('ACTS_AACommand_printSync_0100', 0, async function (done) { it('ACTS_AACommand_printSync_0100', 0, async function (done) {
console.log("ACTS_AACommand_printSync_0100 --- start") console.log('ACTS_AACommand_printSync_0100 --- start')
var cmd = 'aa test -b com.example.aacommandprintsync -m entry_test -s class ' + msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0100 -s unittest OpenHarmonyTestRunner' expect(globalThis.stdResult1).assertContain(msg)
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146' done()
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log('ACTS_AACommand_printSync_0100 - executeShellCommand: start ')
console.log('ACTS_AACommand_printSync_0100 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf(msg);
console.log('ACTS_AACommand_printSync_0100 query string i = ' + i);
expect(i == -1).assertEqual(false);
console.log('ACTS_AACommand_printSync_0100 - executeShellCommand: end')
})
setTimeout(async() => {
var procrssinfo = await appManager.getProcessRunningInfos()
console.log('ACTS_AACommand_printSync_0100 getProcessRunningInfos ======> '
+ JSON.stringify(procrssinfo));
var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo)
console.log("====>ACTS_AACommand_printSync_0100====>infores = " + infores)
expect(infores==false).assertEqual(true);
done();
}, DELAY )
}) })
/** /**
...@@ -68,37 +40,20 @@ export default function abilityTest() { ...@@ -68,37 +40,20 @@ export default function abilityTest() {
* the test command. * the test command.
*/ */
it('ACTS_AACommand_printSync_0200', 0, async function (done) { it('ACTS_AACommand_printSync_0200', 0, async function (done) {
console.log("ACTS_AACommand_printSync_0200 --- start") console.log('ACTS_AACommand_printSync_0200 --- start')
var cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0200 -s unittest OpenHarmonyTestRunner' 'aaaaaaaaaa' +
var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + expect(globalThis.stdResult2).assertContain(msg);
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' done();
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log('ACTS_AACommand_printSync_0200 - executeShellCommand: start ')
console.log('ACTS_AACommand_printSync_0200 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf(msg);
console.log('ACTS_AACommand_printSync_0200 query string i = ' + i);
expect(i == -1).assertEqual(false);
console.log('ACTS_AACommand_printSync_0200 - executeShellCommand: end')
})
setTimeout(async() => {
var procrssinfo = await appManager.getProcessRunningInfos()
console.log('ACTS_AACommand_printSync_0200 getProcessRunningInfos ======> ' +
'' + JSON.stringify(procrssinfo));
var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo)
console.log("====>ACTS_AACommand_printSync_0200====>infores = " + infores)
expect(infores).assertEqual(false);
done();
}, DELAY )
}) })
/** /**
...@@ -109,41 +64,21 @@ export default function abilityTest() { ...@@ -109,41 +64,21 @@ export default function abilityTest() {
* the test command. * the test command.
*/ */
it('ACTS_AACommand_printSync_0300', 0, async function (done) { it('ACTS_AACommand_printSync_0300', 0, async function (done) {
console.log("ACTS_AACommand_printSync_0300 --- start") console.log('ACTS_AACommand_printSync_0300 --- start')
var cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + msg = '0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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' done()
var msgcopy = 'fffffffffff'
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log('ACTS_AACommand_printSync_0300 - executeShellCommand: start ')
console.log('ACTS_AACommand_printSync_0300 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf(msg);
console.log('ACTS_AACommand_printSync_0300 query string i = ' + i);
expect(i == -1).assertEqual(false);
var j = data.stdResult.indexOf(msgcopy);
console.log('ACTS_AACommand_printSync_0300 === query string j = ' + j);
expect(j == -1).assertEqual(true);
console.log('ACTS_AACommand_printSync_0300 - executeShellCommand: end')
})
setTimeout(async() => {
var procrssinfo = await appManager.getProcessRunningInfos()
console.log('ACTS_AACommand_printSync_0300 getProcessRunningInfos ======> '
+ JSON.stringify(procrssinfo));
var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo)
console.log("====>ACTS_AACommand_printSync_0300====>infores = " + infores)
expect(infores).assertEqual(false);
done();
}, DELAY )
}) })
/** /**
...@@ -154,24 +89,10 @@ export default function abilityTest() { ...@@ -154,24 +89,10 @@ export default function abilityTest() {
* the test command. * the test command.
*/ */
it('ACTS_AACommand_printSync_0400', 0, async function (done) { it('ACTS_AACommand_printSync_0400', 0, async function (done) {
console.log("ACTS_AACommand_printSync_0400 --- start") console.log('ACTS_AACommand_printSync_0400 --- start')
var cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + msg = 'start ability successfully';
'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0400 -s unittest OpenHarmonyTestRunner' expect(globalThis.stdResult4).assertContain(msg);
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { done();
console.log('ACTS_AACommand_printSync_0400 - executeShellCommand: start ')
console.log('ACTS_AACommand_printSync_0400 stdResult = ' + data.stdResult)
expect(data.stdResult.indexOf('start ability successfully')==-1).assertEqual(false);
console.log('ACTS_AACommand_printSync_0400 - executeShellCommand: end')
})
setTimeout(async() => {
var procrssinfo = await appManager.getProcessRunningInfos()
console.log('ACTS_AACommand_printSync_0400 getProcessRunningInfos ======> '
+ JSON.stringify(procrssinfo));
var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo)
console.log("====>ACTS_AACommand_printSync_0400====>infores = ")
expect(infores).assertEqual(false);
done();
}, DELAY )
}) })
}) })
} }
\ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test' import testsuite from '../test/List.test'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test' import testsuite from '../test/List.test'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
......
...@@ -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 'hypium/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
export default function abilityTest() { export default function abilityTest() {
describe('ACTS_AACommand_01_3', function () { describe('ACTS_AACommand_01_3', function () {
......
...@@ -14,19 +14,10 @@ ...@@ -14,19 +14,10 @@
*/ */
import Ability from '@ohos.application.Ability' 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 MainAbility extends Ability { export default class MainAbility extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
console.log('MainAbility onCreate') console.log('MainAbility onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
} }
onDestroy() { onDestroy() {
...@@ -35,7 +26,7 @@ export default class MainAbility extends Ability { ...@@ -35,7 +26,7 @@ export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
console.log('MainAbility onWindowStageCreate') console.log('MainAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) windowStage.setUIContent(this.context, 'pages/index', null)
globalThis.abilityContext = this.context; globalThis.abilityContext = this.context;
} }
......
/*
* 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('MainAbility 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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册