未验证 提交 b616c116 编写于 作者: O openharmony_ci 提交者: Gitee

!5994 测试框架 actsshellcommandfunctionalitytest 修改

Merge pull request !5994 from xinking129/master
...@@ -13,31 +13,31 @@ ...@@ -13,31 +13,31 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ExecuteShellCommand") { ohos_js_hap_suite("ActsExecuteShellCommandTest") {
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
js_build_mode = "debug" js_build_mode = "debug"
deps = [ deps = [
":executeshellcommand_js_assets", ":actsexecuteshellcommandtest_js_assets",
":executeshellcommand_resources", ":actsexecuteshellcommandtest_resources",
] ]
ets2abc = true ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ExecuteShellCommand" hap_name = "ActsExecuteShellCommandTest"
subsystem_name = "ability" subsystem_name = "ability"
part_name = "ability_runtime" part_name = "ability_runtime"
} }
ohos_app_scope("executeshellcommand_app_profile") { ohos_app_scope("actsexecuteshellcommandtest_app_profile") {
app_profile = "AppScope/app.json" app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ] sources = [ "AppScope/resources" ]
} }
ohos_js_assets("executeshellcommand_js_assets") { ohos_js_assets("actsexecuteshellcommandtest_js_assets") {
source_dir = "entry/src/main/ets" source_dir = "entry/src/main/ets"
} }
ohos_resources("executeshellcommand_resources") { ohos_resources("actsexecuteshellcommandtest_resources") {
sources = [ "entry/src/main/resources" ] sources = [ "entry/src/main/resources" ]
deps = [ ":executeshellcommand_app_profile" ] deps = [ ":actsexecuteshellcommandtest_app_profile" ]
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
} }
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
{ {
"type": "PushKit", "type": "PushKit",
"push": [ "push": [
"ActSkillProcessWithAccountCloseTest.hap->/data/ActSkillProcessWithAccountCloseTest.hap" "ActsKillProcessWithAccountCloseRelyHap.hap->/data/ActsKillProcessWithAccountCloseRelyHap.hap"
] ]
}, },
{ {
"test-file-name": [ "test-file-name": [
"ActSkillProcessWithAccountCloseTest.hap", "ActsKillProcessWithAccountCloseRelyHap.hap",
"ExecuteShellCommand.hap" "ActsExecuteShellCommandTest.hap"
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
......
...@@ -13,33 +13,33 @@ ...@@ -13,33 +13,33 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActSkillProcessWithAccountCloseTest") { ohos_hap_assist_suite("ActsKillProcessWithAccountCloseRelyHap") {
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
js_build_mode = "debug" js_build_mode = "debug"
hap_name = "ActSkillProcessWithAccountCloseTest"
testonly = true testonly = true
deps = [ deps = [
":actskillprocesswithaccountclosetest_js_assets", ":actskillprocesswithaccountcloserelyhap_js_assets",
":actskillprocesswithaccountclosetest_resources", ":actskillprocesswithaccountcloserelyhap_resources",
] ]
ets2abc = true ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsKillProcessWithAccountCloseRelyHap"
subsystem_name = "ability" subsystem_name = "ability"
part_name = "ability_runtime" part_name = "ability_runtime"
} }
ohos_app_scope("actskillprocesswithaccountclosetest_app_profile") { ohos_app_scope("actskillprocesswithaccountcloserelyhap_app_profile") {
app_profile = "AppScope/app.json" app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ] sources = [ "AppScope/resources" ]
} }
ohos_js_assets("actskillprocesswithaccountclosetest_js_assets") { ohos_js_assets("actskillprocesswithaccountcloserelyhap_js_assets") {
source_dir = "entry/src/main/ets" source_dir = "entry/src/main/ets"
} }
ohos_resources("actskillprocesswithaccountclosetest_resources") { ohos_resources("actskillprocesswithaccountcloserelyhap_resources") {
sources = [ "entry/src/main/resources" ] sources = [ "entry/src/main/resources" ]
deps = [ ":actskillprocesswithaccountclosetest_app_profile" ] deps = [ ":actskillprocesswithaccountcloserelyhap_app_profile" ]
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
} }
{
"description": "Configuration for aceceshi Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.actskillprocesswithaccountclosetest",
"module-name": "entry",
"shell-timeout": "600000"
}
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log("onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info("OpenHarmonyTestRunner OnPrepare ")
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
...@@ -17,8 +17,8 @@ group("actsshellcommandfunctionalitytest") { ...@@ -17,8 +17,8 @@ group("actsshellcommandfunctionalitytest") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"ActskillProcessWithAccountCloseTest:ActSkillProcessWithAccountCloseTest", "ActsExecuteShellCommandTest:ActsExecuteShellCommandTest",
"ExecuteShellCommand:ExecuteShellCommand", "ActsKillProcessWithAccountCloseRelyHap:ActsKillProcessWithAccountCloseRelyHap",
] ]
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册