提交 9b4503c4 编写于 作者: F FondMemoryVVV

Merge branch 'master' of gitee.com:openharmony/xts_acts into toolchain824

# Conflicts:
#	test_packages.gni
Signed-off-by: NFondMemoryVVV <mashuai53@huawei.com>

要显示的变更太多。

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -16,6 +16,9 @@ import("//build/ohos_var.gni")
group("ability") {
testonly = true
if (is_standard_system) {
deps = [ "ability_runtime:ability_runtime" ]
deps = [
"ability_runtime:ability_runtime",
"dmsfwk:dmsfwk",
]
}
}
......@@ -17,13 +17,11 @@ group("ability_runtime") {
testonly = true
if (is_standard_system) {
deps = [
"TestApi:Testapi",
"aacommand:aacommand",
"abilitymanager:actsabilitymanagertest",
"abilitymontior:AbilityMonitorTest",
"abilitymontior:ActsAbilityMonitorTest",
"abilitymultiinstance:abilitymultiinstance",
"actsabilitydelegatorcase:ActsAbilityDelegatorCaseTest",
"actsabilitylifecyclestatenew:ActsAbilityLifecycleStateNewTest",
"actsabilitymanageretstest:ActsAbilityManagerEtsTest",
"actsabilityusertest:ActsAbilityuserTest",
"actscalltest:actscalltest",
......@@ -33,17 +31,20 @@ group("ability_runtime") {
"actsshellcommandfunctionalitytest:actsshellcommandfunctionalitytest",
"actsstartrunnertest:ActsStartRunnerTest",
"actsstserviceabilityclientcase:ActsStServiceAbilityClientCaseTest",
"actssupportfunction:actssupportfunction",
"actsusers:actsusers",
"amscontextualinforquery:amscontextualinforquery",
"amsdatauriutils:ActsAmsDataUriUtilsTest",
"amsdisplayIdtest:amsdisplayIdtest",
"amsgetabilityprocessinfo:amsgetabilityprocessinfo",
"apicover:apicover",
"apitest:ActsApiTest",
"context:context",
"fa:fa",
"faapicover:faapicover",
"featureability:featureability",
"formmanager:formmanager",
"freeinstalltest:freeinstalltest",
"killprocesswithaccountstage:killprocesswithaccountstage",
"newwant:newwant",
"non_concurrent:non_concurrent",
......
{
"app": {
"bundleName": "com.example.testapi",
"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
}
}
}
{
"string": [
{
"name": "app_name",
"value": "Testapi"
}
]
}
# 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("Testapi") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":testapi_js_assets",
":testapi_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "Testapi"
}
ohos_app_scope("testapi_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("testapi_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("testapi_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":testapi_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for aceceshi Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.testapi",
"module-name": "entry",
"shell-timeout": "600000",
"testcase-timeout":"30000"
},
"kits": [
{
"test-file-name": [
"Testapi.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
/*
* 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 commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack ACTS_DoAbilityForeground_0100_Event====>");
setTimeout(()=>{
globalThis.abilityContext.terminateSelf();
console.debug("====>MainAbility2 terminateSelf succese====>")
},2000)
}
export default class MainAbility2 extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility2 onCreate")
globalThis.abilityContext = this.context
}
onDestroy() {
console.log("[Demo] MainAbility2 onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility2 onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility2 onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility2 onForeground")
commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne);
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility2 onBackground")
}
};
/*
* 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 commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack ACTS_DoAbilityForeground_0300_Event====>");
globalThis.abilityContext.terminateSelf().then(()=>{
console.debug("====>MainAbility3 terminateSelf====>");
});
}
export default class MainAbility3 extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility3 onCreate")
globalThis.abilityContext = this.context
}
onDestroy() {
console.log("[Demo] MainAbility3 onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility3 onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility3 onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility3 onForeground")
globalThis.abilitydelegator.getCurrentTopAbility().then((data)=>{
globalThis.ability3 = data
console.debug("====>MainAbility getCurrentTopAbility:====>" + JSON.stringify(globalThis.ability3));
commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne);
})
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility3 onBackground")
}
};
/*
* 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 commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack Event====>");
}
export default class MainAbility4 extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility4 onCreate")
globalThis.abilityContext = this.context
setTimeout(()=> {
commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne);
}, 500)
}
onDestroy() {
console.log("[Demo] MainAbility4 onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility4 onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility4 onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility4 onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility4 onBackground")
}
};
/*
* 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 commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack Event====>");
}
export default class MainAbility5 extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility5 onCreate")
globalThis.abilityContext = this.context
setTimeout(()=> {
commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne);
}, 500)
}
onDestroy() {
console.log("[Demo] MainAbility5 onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility5 onWindowStageCreate")
windowStage.setUIContent(this.context, "pages/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility5 onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility5 onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility5 onBackground")
}
};
/*
* 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)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "entry",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:entry_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
},
{
"name": "MainAbility2",
"srcEntrance": "./ets/MainAbility2/MainAbility2.ts",
"description": "$string:MainAbility2_desc",
"icon": "$media:icon",
"label": "$string:MainAbility2_label",
"visible": true
},
{
"name": "MainAbility3",
"srcEntrance": "./ets/MainAbility3/MainAbility3.ts",
"description": "$string:MainAbility3_desc",
"icon": "$media:icon",
"label": "$string:MainAbility3_label",
"visible": true
},
{
"name": "MainAbility4",
"srcEntrance": "./ets/MainAbility4/MainAbility4.ts",
"description": "$string:MainAbility4_desc",
"icon": "$media:icon",
"label": "$string:MainAbility4_label"
},
{
"name": "MainAbility5",
"srcEntrance": "./ets/MainAbility5/MainAbility5.ts",
"description": "$string:MainAbility5_desc",
"icon": "$media:icon",
"label": "$string:MainAbility5_label"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "MainAbility1_desc",
"value": "description"
},
{
"name": "MainAbility1_label",
"value": "label"
},
{
"name": "MainAbility2_desc",
"value": "description"
},
{
"name": "MainAbility2_label",
"value": "label"
},
{
"name": "MainAbility3_desc",
"value": "description"
},
{
"name": "MainAbility3_label",
"value": "label"
},
{
"name": "MainAbility4_desc",
"value": "description"
},
{
"name": "MainAbility4_label",
"value": "label"
},
{
"name": "MainAbility5_desc",
"value": "description"
},
{
"name": "MainAbility5_label",
"value": "label"
},
{
"name": "app_name",
"value": "Testapi"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
......@@ -13,13 +13,11 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("AACommand07") {
ohos_hap_assist_suite("AACommand07") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "AACommand07"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":aacommand07_js_assets",
......@@ -27,6 +25,9 @@ ohos_hap("AACommand07") {
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("aacommand07_app_profile") {
......
......@@ -13,7 +13,7 @@
* 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 commonEvent from "@ohos.commonEvent"
......
......@@ -13,13 +13,11 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("AACommand08") {
ohos_hap_assist_suite("AACommand08") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "AACommand08"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":aacommand08_js_assets",
......@@ -27,6 +25,9 @@ ohos_hap("AACommand08") {
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("aacommand08_app_profile") {
......
......@@ -13,7 +13,7 @@
* 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 commonEvent from "@ohos.commonEvent"
......
......@@ -13,13 +13,11 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("AACommandPrintSync") {
ohos_hap_assist_suite("AACommandPrintSync") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "AACommandPrintSync"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":aacommandprintsync_js_assets",
......@@ -27,6 +25,9 @@ ohos_hap("AACommandPrintSync") {
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("aacommandprintsync_app_profile") {
......
......@@ -15,7 +15,7 @@
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class MainAbility extends Ability {
......
......@@ -13,39 +13,39 @@
* 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() {
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,
* 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
* the test command.
*/
it('ACTS_AACommand_printSync_0100', 0, async function (done) {
console.log("ACTS_AACommand_printSync_0100 start ====> " )
it('ACTS_AACommand_printSync_01_0100', 0, async function (done) {
console.log("ACTS_AACommand_printSync_01_0100 start ====> " )
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
globalThis.abilityDelegator.printSync(msg);
console.log("ACTS_AACommand_printSync_0100 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_0100 end'
console.log("ACTS_AACommand_printSync_01_0100 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_01_0100 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then((data)=>{
console.log("ACTS_AACommand_printSync_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 " )
console.log("ACTS_AACommand_printSync_01_0100 finishTest test end " +
"========> callback data: "+JSON.stringify(data))
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,
* 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
* 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' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
......@@ -58,22 +58,22 @@ export default function abilityTest() {
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
globalThis.abilityDelegator.printSync(msg);
console.log("ACTS_AACommand_printSync_0200 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_0200 end'
console.log("ACTS_AACommand_printSync_01_0200 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_01_0200 end'
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()
})
})
/**
* @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
* 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
* 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' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
......@@ -87,27 +87,27 @@ export default function abilityTest() {
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' +
'fffffffffff'
globalThis.abilityDelegator.printSync(msg);
console.log("ACTS_AACommand_printSync_0300 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_0300 end'
console.log("ACTS_AACommand_printSync_01_0300 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_01_0300 end'
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()
})
})
/**
* @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,
* printSync information is null.
* @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_printSync_0400', 0, async function (done) {
it('ACTS_AACommand_printSync_01_0400', 0, async function (done) {
globalThis.abilityDelegator.printSync(null);
console.log("ACTS_AACommand_printSync_0300 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_0400 end'
console.log("ACTS_AACommand_printSync_01_0300 printSync end ====> " )
var finishmsg = 'ACTS_AACommand_printSync_01_0400 end'
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()
})
})
......
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("AACommandPrintSyncTest") {
ohos_js_hap_suite("ActsAACommandPrintSyncTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
......@@ -22,7 +22,9 @@ ohos_js_hap_suite("AACommandPrintSyncTest") {
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "AACommandPrintSyncTest"
hap_name = "ActsAACommandPrintSyncTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("aacommandprintsynctest_app_profile") {
......
......@@ -24,7 +24,7 @@
},
{
"test-file-name": [
"AACommandPrintSyncTest.hap",
"ActsAACommandPrintSyncTest.hap",
"AACommandPrintSync.hap"
],
"type": "AppInstallKit",
......
......@@ -14,20 +14,11 @@
*/
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 {
onCreate(want, launchParam) {
globalThis.abilityContext = this.context;
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() {
......@@ -36,7 +27,7 @@ export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
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
......@@ -22,7 +22,8 @@ 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 level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
......
......@@ -13,17 +13,103 @@
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
@Entry
@Component
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() {
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%')
}
......
......@@ -13,22 +13,11 @@
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import appManager from '@ohos.application.appManager';
const DELAY = 3000
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
let msg: any
export default function abilityTest() {
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.name: The -b, -p, -s, -w and other parameters of the test command are valid
......@@ -37,27 +26,10 @@ export default function abilityTest() {
* the test command.
*/
it('ACTS_AACommand_printSync_0100', 0, async function (done) {
console.log("ACTS_AACommand_printSync_0100 --- start")
var cmd = 'aa test -b com.example.aacommandprintsync -m entry_test -s class ' +
'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0100 -s unittest OpenHarmonyTestRunner'
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
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 )
console.log('ACTS_AACommand_printSync_0100 --- start')
msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
expect(globalThis.stdResult1).assertContain(msg)
done()
})
/**
......@@ -68,37 +40,20 @@ export default function abilityTest() {
* the test command.
*/
it('ACTS_AACommand_printSync_0200', 0, async function (done) {
console.log("ACTS_AACommand_printSync_0200 --- start")
var cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' +
'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0200 -s unittest OpenHarmonyTestRunner'
var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
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 )
console.log('ACTS_AACommand_printSync_0200 --- start')
msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
expect(globalThis.stdResult2).assertContain(msg);
done();
})
/**
......@@ -109,41 +64,21 @@ export default function abilityTest() {
* the test command.
*/
it('ACTS_AACommand_printSync_0300', 0, async function (done) {
console.log("ACTS_AACommand_printSync_0300 --- start")
var cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' +
'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0300 -s unittest OpenHarmonyTestRunner'
var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
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 )
console.log('ACTS_AACommand_printSync_0300 --- start')
msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
expect(globalThis.stdResult3).assertContain(msg);
done()
})
/**
......@@ -154,24 +89,10 @@ export default function abilityTest() {
* the test command.
*/
it('ACTS_AACommand_printSync_0400', 0, async function (done) {
console.log("ACTS_AACommand_printSync_0400 --- start")
var cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' +
'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0400 -s unittest OpenHarmonyTestRunner'
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => {
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 )
console.log('ACTS_AACommand_printSync_0400 --- start')
msg = 'start ability successfully';
expect(globalThis.stdResult4).assertContain(msg);
done();
})
})
}
\ No newline at end of file
......@@ -13,13 +13,11 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("AACommandRelyHap") {
ohos_hap_assist_suite("AACommandRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "AACommandRelyHap"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":aacommandrelyhap_js_assets",
......@@ -27,6 +25,9 @@ ohos_hap("AACommandRelyHap") {
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("aacommandrelyhap_app_profile") {
......
......@@ -15,7 +15,7 @@
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class MainAbility extends Ability {
......
......@@ -13,13 +13,11 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("AACommandpackage") {
ohos_hap_assist_suite("AACommandpackage") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "AACommandpackage"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":actsaacommandtestatest_js_assets",
......@@ -27,6 +25,9 @@ ohos_hap("AACommandpackage") {
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsaacommandtestatest_app_profile") {
......
......@@ -15,7 +15,7 @@
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default class MainAbility extends Ability {
......
......@@ -13,7 +13,7 @@
* 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'
export default function abilityTest() {
describe('ACTS_AACommand_01_3', function () {
......
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("AACommandtest") {
ohos_js_hap_suite("ActsAACommandTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
......@@ -22,7 +22,9 @@ ohos_js_hap_suite("AACommandtest") {
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "AACommandtest"
hap_name = "ActsAACommandTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("aacommandtest_app_profile") {
......
......@@ -19,7 +19,7 @@
},
{
"test-file-name": [
"AACommandtest.hap",
"ActsAACommandTest.hap",
"AACommand07.hap",
"AACommand08.hap",
"AACommandpackage.hap",
......
......@@ -14,19 +14,10 @@
*/
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 {
onCreate(want, launchParam) {
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() {
......@@ -35,7 +26,7 @@ export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('MainAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null)
windowStage.setUIContent(this.context, 'pages/index', null)
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
......@@ -22,7 +22,8 @@ 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 level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
......
......@@ -20,10 +20,10 @@ group("aacommand") {
"AACommand07:AACommand07",
"AACommand08:AACommand08",
"AACommandPrintSync:AACommandPrintSync",
"AACommandPrintSyncTest:AACommandPrintSyncTest",
"AACommandPrintSyncTest:ActsAACommandPrintSyncTest",
"AACommandRelyHap:AACommandRelyHap",
"AACommandpackage:AACommandpackage",
"AACommandtest:AACommandtest",
"AACommandtest:ActsAACommandTest",
]
}
}
......@@ -21,6 +21,9 @@ ohos_js_hap_suite("ActsAmsCallBackFifthSceneTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsCallBackFifthSceneTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
......
......@@ -115,9 +115,6 @@ export default function ActsAmsCallBackFifthScene() {
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it('Acts_Ams_test_6600', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
appManager.getProcessRunningInfos(
(error, info) => {
console.info('Acts_Ams_test_6600 getProcessRunningInfos error.code \
......@@ -141,5 +138,37 @@ export default function ActsAmsCallBackFifthScene() {
}
);
})
/*
* @tc.number : Acts_Ams_test_6700
* @tc.name : getProcessRunningInformation : Get All Running Processes Information
* @tc.desc : Get All Running Processes Information(by CallBack)
*/
it('Acts_Ams_test_6700', 0, async function (done) {
appManager.getProcessRunningInformation(
(error, info) => {
console.info('Acts_Ams_test_6700 getProcessRunningInformation error.code \
' + error.code + ', data length [' + info.length + ']');
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (let i = 0; i < info.length; i++) {
console.info('Acts_Ams_test_6700 getProcessRunningInformation[' + i + "]: \
" + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
}
);
})
})
}
\ No newline at end of file
......@@ -21,6 +21,9 @@ ohos_js_hap_suite("ActsAmsCallBackFirstSceneTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsCallBackFirstSceneTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
......
......@@ -35,6 +35,7 @@ export default function ActsAmsCallBackFirstScene() {
' + error.code + ', data length [' + data.length + ']');
}
);
sleep(500);
done();
});
......@@ -59,9 +60,6 @@ export default function ActsAmsCallBackFirstScene() {
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it('Acts_Ams_test_0200', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
appManager.getProcessRunningInfos(
(error, info) => {
console.info('Acts_Ams_test_0200 getProcessRunningInfos error.code \
......@@ -84,5 +82,36 @@ export default function ActsAmsCallBackFirstScene() {
done();
});
})
/*
* @tc.number : Acts_Ams_test_0300
* @tc.name : getProcessRunningInformation : Get All Running Processes Information
* @tc.desc : Get All Running Processes Information(by CallBack)
*/
it('Acts_Ams_test_0300', 0, async function (done) {
appManager.getProcessRunningInformation(
(error, info) => {
console.info('Acts_Ams_test_0300 getProcessRunningInformation error.code \
' + error.code + ', data length [' + info.length + ']');
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
console.info('Acts_Ams_test_0200 getProcessRunningInformation[' + i + "]: \
" + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
});
})
})
}
\ No newline at end of file
......@@ -21,6 +21,9 @@ ohos_js_hap_suite("ActsAmsCallBackFourthSceneTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsCallBackFourthSceneTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
......
......@@ -86,6 +86,7 @@ export default function ActsAmsCallBackFourthScene() {
' + error.code + ', data length [' + data.length + ']');
}
);
sleep(500);
done();
});
......@@ -110,9 +111,6 @@ export default function ActsAmsCallBackFourthScene() {
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it('Acts_Ams_test_5000', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
appManager.getProcessRunningInfos(
(error, info) => {
console.info('Acts_Ams_test_5000 getProcessRunningInfos error.code \
......@@ -135,5 +133,36 @@ export default function ActsAmsCallBackFourthScene() {
done();
});
})
/*
* @tc.number : Acts_Ams_test_5100
* @tc.name : getProcessRunningInformation : Get All Running Processes Information
* @tc.desc : Get All Running Processes Information(by CallBack)
*/
it('Acts_Ams_test_5100', 0, async function (done) {
appManager.getProcessRunningInformation(
(error, info) => {
console.info('Acts_Ams_test_5100 getProcessRunningInformation error.code \
' + error.code + ', data length [' + info.length + ']');
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (let i = 0; i < info.length; i++) {
console.info('Acts_Ams_test_5100 getProcessRunningInformation[' + i + "]: \
" + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
});
})
})
}
\ No newline at end of file
......@@ -21,6 +21,9 @@ ohos_js_hap_suite("ActsAmsCallBackSecondSceneTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsCallBackSecondSceneTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
......
......@@ -52,6 +52,7 @@ export default function ActsAmsCallBackSecondScene() {
' + error.code + ', data length [' + data.length + ']');
}
);
sleep(500);
done();
});
......@@ -76,9 +77,6 @@ export default function ActsAmsCallBackSecondScene() {
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it('Acts_Ams_test_1800', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
appManager.getProcessRunningInfos(
(error, info) => {
console.info('Acts_Ams_test_1800 getProcessRunningInfos error.code \
......@@ -101,5 +99,36 @@ export default function ActsAmsCallBackSecondScene() {
done();
});
})
/*
* @tc.number : Acts_Ams_test_1900
* @tc.name : getProcessRunningInformation : Get All Running Processes Information
* @tc.desc : Get All Running Processes Information(by CallBack)
*/
it('Acts_Ams_test_1900', 0, async function (done) {
appManager.getProcessRunningInformation(
(error, info) => {
console.info('Acts_Ams_test_1900 getProcessRunningInformation error.code \
' + error.code + ', data length [' + info.length + ']');
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (let i = 0; i < info.length; i++) {
console.info('Acts_Ams_test_1900 getProcessRunningInformation[' + i + "]: \
" + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
});
})
})
}
\ No newline at end of file
......@@ -21,6 +21,9 @@ ohos_js_hap_suite("ActsAmsCallBackThirdSceneTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsCallBackThirdSceneTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
......
......@@ -52,6 +52,7 @@ export default function ActsAmsCallBackThirdScene() {
' + error.code + ', data length [' + data.length + ']');
}
);
sleep(500);
done();
});
......@@ -70,9 +71,6 @@ export default function ActsAmsCallBackThirdScene() {
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it('Acts_Ams_test_3400', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
appManager.getProcessRunningInfos(
(error, info) => {
console.info('Acts_Ams_test_3400 getProcessRunningInfos error.code \
......@@ -95,5 +93,36 @@ export default function ActsAmsCallBackThirdScene() {
done();
});
})
/*
* @tc.number : Acts_Ams_test_3500
* @tc.name : getProcessRunningInformation : Get All Running Processes Information
* @tc.desc : Get All Running Processes Information(by CallBack)
*/
it('Acts_Ams_test_3500', 0, async function (done) {
appManager.getProcessRunningInformation(
(error, info) => {
console.info('Acts_Ams_test_3500 getProcessRunningInformation error.code \
' + error.code + ', data length [' + info.length + ']');
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (let i = 0; i < info.length; i++) {
console.info('Acts_Ams_test_3500 getProcessRunningInformation[' + i + "]: \
" + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
});
})
})
}
\ No newline at end of file
......@@ -20,6 +20,9 @@ ohos_js_hap_suite("ActsAmsTestFifthSceneTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsTestFifthSceneTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
......
......@@ -106,6 +106,7 @@ export default function ActsAmsTestFifthScene() {
' + error.code + ', data length [' + data.length + ']');
}
);
sleep(500);
done();
});
......@@ -130,9 +131,6 @@ export default function ActsAmsTestFifthScene() {
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it('Acts_Ams_test_0100', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
let info = await appManager.getProcessRunningInfos();
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
......@@ -151,5 +149,32 @@ export default function ActsAmsTestFifthScene() {
}
done();
})
/*
* @tc.number : Acts_Ams_test_0200
* @tc.name : getProcessRunningInformation : Get All Running Processes Information
* @tc.desc : Get All Running Processes Information(by Promise)
*/
it('Acts_Ams_test_0200', 0, async function (done) {
let info = await appManager.getProcessRunningInformation();
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (let i = 0; i < info.length; i++) {
console.info('Acts_Ams_test_0200 getProcessRunningInformation[' + i + "]: \
" + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
})
})
}
\ No newline at end of file
......@@ -20,6 +20,9 @@ ohos_js_hap_suite("ActsAmsTestFirstSceneTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsTestFirstSceneTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
......
......@@ -40,6 +40,7 @@ export default function ActsAmsTestFirstScene() {
' + error.code + ', data length [' + data.length + ']');
}
);
sleep(500);
done();
});
......@@ -64,9 +65,6 @@ export default function ActsAmsTestFirstScene() {
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it('Acts_Ams_test_0100', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
var info = await appManager.getProcessRunningInfos();
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
......@@ -85,5 +83,32 @@ export default function ActsAmsTestFirstScene() {
}
done();
})
/*
* @tc.number : Acts_Ams_test_0200
* @tc.name : getProcessRunningInformation : Get All Running Processes Information
* @tc.desc : Get All Running Processes Information(by Promise)
*/
it('Acts_Ams_test_0200', 0, async function (done) {
var info = await appManager.getProcessRunningInformation();
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
console.info('Acts_Ams_test_0200 getProcessRunningInformation[' + i + "]: \
" + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
})
})
}
\ No newline at end of file
......@@ -21,6 +21,9 @@ ohos_js_hap_suite("ActsAmsTestFourthSceneTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsTestFourthSceneTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
......
......@@ -106,6 +106,7 @@ export default function ActsAmsTestFourthScene() {
' + error.code + ', data length [' + data.length + ']');
}
);
sleep(500);
done();
});
......@@ -131,7 +132,7 @@ export default function ActsAmsTestFourthScene() {
*/
it('Acts_Ams_test_1700', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
sleep(2000);
console.info("sleep end");
var info = await appManager.getProcessRunningInfos();
expect(Array.isArray(info)).assertEqual(true);
......@@ -151,5 +152,35 @@ export default function ActsAmsTestFourthScene() {
}
done();
})
/*
* @tc.number : Acts_Ams_test_1800
* @tc.name : getProcessRunningInformation : Get All Running Processes Information
* @tc.desc : Get All Running Processes Information(by Promise)
*/
it('Acts_Ams_test_1800', 0, async function (done) {
console.info("sleep begin");
sleep(2000);
console.info("sleep end");
var info = await appManager.getProcessRunningInformation();
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
console.info('Acts_Ams_test_1800 getProcessRunningInformation[' + i + "]: \
" + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
})
})
}
\ No newline at end of file
......@@ -20,6 +20,9 @@ ohos_js_hap_suite("ActsAmsTestSecondSceneTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsTestSecondSceneTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
......
......@@ -62,6 +62,7 @@ export default function ActsAmsTestSecondScene() {
' + error.code + ', data length [' + data.length + ']');
}
);
sleep(500);
done();
});
......@@ -86,9 +87,6 @@ export default function ActsAmsTestSecondScene() {
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it('Acts_Ams_test_1700', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
var info = await appManager.getProcessRunningInfos();
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
......@@ -107,5 +105,32 @@ export default function ActsAmsTestSecondScene() {
}
done();
})
/*
* @tc.number : Acts_Ams_test_1800
* @tc.name : getProcessRunningInformation : Get All Running Processes Information
* @tc.desc : Get All Running Processes Information(by Promise)
*/
it('Acts_Ams_test_1800', 0, async function (done) {
var info = await appManager.getProcessRunningInformation();
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
console.info('Acts_Ams_test_1800 getProcessRunningInformation[' + i + "]: \
" + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
})
})
}
\ No newline at end of file
......@@ -20,6 +20,9 @@ ohos_js_hap_suite("ActsAmsTestThirdSceneTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsTestThirdSceneTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
......
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"type": "OHJSUnitTest",
"test-timeout": "300000",
"bundle-name": "com.example.actsamstestthirdscene",
"package-name": "com.example.actsamstestthirdscene",
......
......@@ -63,6 +63,7 @@ export default function ActsAmsTestThirdScene() {
' + error.code + ', data length [' + data.length + ']');
}
);
sleep(500);
done();
});
......@@ -87,9 +88,6 @@ export default function ActsAmsTestThirdScene() {
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it('Acts_Ams_test_3300', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
var info = await appManager.getProcessRunningInfos();
console.info('Acts_Ams_test_3300 getProcessRunningInfos JSON String: ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
......@@ -109,5 +107,34 @@ export default function ActsAmsTestThirdScene() {
}
done();
})
/*
* @tc.number : Acts_Ams_test_3400
* @tc.name : getProcessRunningInformation : Get All Running Processes Information
* @tc.desc : Get All Running Processes Information(by Promise)
*/
it('Acts_Ams_test_3400', 0, async function (done) {
var info = await appManager.getProcessRunningInformation();
console.info('Acts_Ams_test_3400 getProcessRunningInformation JSON String: \
' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
console.info('Acts_Ams_test_3400 getProcessRunningInformation[' + i + "]: \
" + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
})
})
}
\ No newline at end of file
......@@ -12,19 +12,20 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("simulateEAbility") {
ohos_hap_assist_suite("simulateEAbility") {
hap_profile = "./src/main/config.json"
js_build_mode = "debug"
hap_name = "simulateEAbility"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
......
......@@ -12,19 +12,20 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("simulateFAbilityFir") {
ohos_hap_assist_suite("simulateFAbilityFir") {
hap_profile = "./src/main/config.json"
js_build_mode = "debug"
hap_name = "simulateFAbilityFir"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
......
......@@ -12,19 +12,20 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("simulateFAbilitySed") {
ohos_hap_assist_suite("simulateFAbilitySed") {
hap_profile = "./src/main/config.json"
js_build_mode = "debug"
hap_name = "simulateFAbilitySed"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
......
......@@ -12,19 +12,20 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("verifyAAbility") {
ohos_hap_assist_suite("verifyAAbility") {
hap_profile = "./src/main/config.json"
js_build_mode = "debug"
hap_name = "verifyAAbility"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
......
......@@ -12,19 +12,20 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("verifyIAbility") {
ohos_hap_assist_suite("verifyIAbility") {
hap_profile = "./src/main/config.json"
js_build_mode = "debug"
hap_name = "verifyIAbility"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
......
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("AbilityMonitorTest") {
ohos_js_hap_suite("ActsAbilityMonitorTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
......@@ -22,7 +22,9 @@ ohos_js_hap_suite("AbilityMonitorTest") {
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "AbilityMonitorTest"
hap_name = "ActsAbilityMonitorTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("abilitymonitortest_app_profile") {
......
......@@ -11,7 +11,7 @@
"kits": [
{
"test-file-name": [
"AbilityMonitorTest.hap"
"ActsAbilityMonitorTest.hap"
],
"type": "AppInstallKit",
"run-command": [
......
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("ActsAmsAbilityMultiinstanceHapARelyHap") {
ohos_hap_assist_suite("ActsAmsAbilityMultiinstanceHapARelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
......@@ -23,10 +23,10 @@ ohos_hap("ActsAmsAbilityMultiinstanceHapARelyHap") {
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsAbilityMultiinstanceHapARelyHap"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsamsabilitymultiinstancehapa_app_profile") {
......
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("ActsAmsAbilityMultiinstanceHapBRelyHap") {
ohos_hap_assist_suite("ActsAmsAbilityMultiinstanceHapBRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
......@@ -23,10 +23,10 @@ ohos_hap("ActsAmsAbilityMultiinstanceHapBRelyHap") {
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsAbilityMultiinstanceHapBRelyHap"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsamsabilitymultiinstancehapb_app_profile") {
......
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("ActsAmsAbilityMultiinstanceHapCRelyHap") {
ohos_hap_assist_suite("ActsAmsAbilityMultiinstanceHapCRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
......@@ -23,10 +23,10 @@ ohos_hap("ActsAmsAbilityMultiinstanceHapCRelyHap") {
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsAbilityMultiinstanceHapCRelyHap"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsamsabilitymultiinstancehapc_app_profile") {
......
......@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("ActsAmsAbilityMultiinstanceHapDRelyHap") {
ohos_hap_assist_suite("ActsAmsAbilityMultiinstanceHapDRelyHap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
......@@ -23,10 +23,10 @@ ohos_hap("ActsAmsAbilityMultiinstanceHapDRelyHap") {
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsAbilityMultiinstanceHapDRelyHap"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsamsabilitymultiinstancehapd_app_profile") {
......
......@@ -12,19 +12,19 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("ActsAmsAbilityMultiinstanceHapERelyHap") {
ohos_hap_assist_suite("ActsAmsAbilityMultiinstanceHapERelyHap") {
hap_name = "ActsAmsAbilityMultiinstanceHapERelyHap"
js_build_mode = "debug"
hap_profile = "./src/main/config.json"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
......
......@@ -23,6 +23,8 @@ ohos_js_hap_suite("ActsAmsAbilityMultiinstanceTest") {
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsAbilityMultiinstanceTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsamsabilitymultiinstance_app_profile") {
......
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "500000",
"package": "com.example.abilitymultiinstance",
"shell-timeout": "300000"
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.abilitymultiinstance",
"module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout":"30000"
},
"kits": [
{
......
/*
* 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.abilitymultiinstance.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
/*
* 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 file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
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'] = 10000;
configService.setConfig(globalThis.abilityWant.parameters)
testsuite(globalThis.abilityContext)
core.execute()
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Test App')
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
......@@ -12,34 +12,21 @@
* 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.ets"
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../test/List.test'
@Entry
@Component
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()
let abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
build() {
......
......@@ -12,7 +12,7 @@
* 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 commonEvent from '@ohos.commonEvent'
let subscriberInfoMultiInstance = {
......@@ -100,7 +100,6 @@ export default function abilityTest(abilityContext) {
console.log('ACTS_AbilityMultiInstance_Single_0100====<begin');
let subscriber;
let id;
let result;
let checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId1", "AppB:onCreateonForeground",
"AppA:onForegroundonAcceptWantCalledId1"];
let checkIndex = 0;
......
......@@ -15,8 +15,8 @@
import abilityTest from './Ability.test.ets'
export default function testsuite(context) {
export default function testsuite() {
abilityTest(context)
abilityTest(globalThis.abilityContext)
}
\ No newline at end of file
......@@ -21,11 +21,15 @@ ohos_js_hap_suite("ActsAbilityDelegatorCaseTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAbilityDelegatorCaseTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
js2abc = true
hap_profile = "./entry/src/main/config.json"
source_dir = "./entry/src/main/js"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.amsst.actsabilitydelegatorcasetest",
"shell-timeout": "60000"
"type": "OHJSUnitTest",
"test-timeout": "300000",
"bundle-name": "com.amsst.actsabilitydelegatorcasetest",
"package-name": "com.amsst.actsabilitydelegatorcasetest",
"shell-timeout": "300000",
"testcase-timeout":"30000"
},
"kits": [
{
......
......@@ -37,12 +37,27 @@
}
],
"name": "com.amsst.actsabilitydelegatorcasetest.MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "singleton"
}
],
"reqPermissions": [
......@@ -85,7 +100,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
}
/*
* 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.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('====onShow finish====<')
},
onReady() {
},
}
\ 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
/*
* Copyright (c) 2021 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<!--
Copyright (c) 2021 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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* 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.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* 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 file from '@system.file'
import app from '@system.app'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('====onShow finish====<')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "StSeAbClient"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册