Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4b3ece1f
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4b3ece1f
编写于
1月 28, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 28, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7179 xts-shell命令管控新增用例
Merge pull request !7179 from chengxingzhen/master
上级
9de0dd03
3c47d5e9
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
429 addition
and
0 deletion
+429
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/BUILD.gn
...bility_runtime/actsshellcommandfunctionalitytest/BUILD.gn
+1
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/AppScope/app.json
...onalitytest/actsshellcommandcontroltest/AppScope/app.json
+21
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/AppScope/resources/base/element/string.json
...ndcontroltest/AppScope/resources/base/element/string.json
+8
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/AppScope/resources/base/media/app_icon.png
...andcontroltest/AppScope/resources/base/media/app_icon.png
+0
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/BUILD.gn
...andfunctionalitytest/actsshellcommandcontroltest/BUILD.gn
+43
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/Test.json
...ndfunctionalitytest/actsshellcommandcontroltest/Test.json
+21
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/Application/MyAbilityStage.ts
...troltest/entry/src/main/ets/Application/MyAbilityStage.ts
+23
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/MainAbility/MainAbility.ts
...controltest/entry/src/main/ets/MainAbility/MainAbility.ts
+61
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+75
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/pages/index/index.ets
...mmandcontroltest/entry/src/main/ets/pages/index/index.ets
+40
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/test/List.test.ets
...lcommandcontroltest/entry/src/main/ets/test/List.test.ets
+20
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/test/ShellCommandControl.test.ets
...test/entry/src/main/ets/test/ShellCommandControl.test.ets
+60
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/module.json
...st/actsshellcommandcontroltest/entry/src/main/module.json
+27
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/resources/base/element/string.json
...roltest/entry/src/main/resources/base/element/string.json
+24
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/resources/base/media/icon.png
...dcontroltest/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+5
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/signature/openharmony_sx.p7b
.../actsshellcommandcontroltest/signature/openharmony_sx.p7b
+0
-0
未找到文件。
ability/ability_runtime/actsshellcommandfunctionalitytest/BUILD.gn
浏览文件 @
4b3ece1f
...
...
@@ -19,6 +19,7 @@ group("actsshellcommandfunctionalitytest") {
deps = [
"ActsExecuteShellCommandTest:ActsExecuteShellCommandTest",
"ActsKillProcessWithAccountCloseRelyHap:ActsKillProcessWithAccountCloseRelyHap",
"actsshellcommandcontroltest:ActsShellCommandControlTest",
]
}
}
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/AppScope/app.json
0 → 100644
浏览文件 @
4b3ece1f
{
"app"
:
{
"bundleName"
:
"com.acts.shellcommandcontroltest"
,
"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
}
}
}
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
4b3ece1f
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"AbilityStageMonitor"
}
]
}
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
4b3ece1f
6.6 KB
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/BUILD.gn
0 → 100644
浏览文件 @
4b3ece1f
# Copyright (c) 2023 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("ActsShellCommandControlTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":shellcommandcontrol_js_assets",
":shellcommandcontrol_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsShellCommandControlTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("shellcommandcontrol_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("shellcommandcontrol_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("shellcommandcontrol_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":shellcommandcontrol_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/Test.json
0 → 100644
浏览文件 @
4b3ece1f
{
"description"
:
"Configuration for ShellCommand Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"600000"
,
"bundle-name"
:
"com.acts.shellcommandcontroltest"
,
"module-name"
:
"entry_test"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
"15000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsShellCommandControlTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/Application/MyAbilityStage.ts
0 → 100644
浏览文件 @
4b3ece1f
/*
* Copyright (c) 2023 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
AbilityStage
from
"
@ohos.app.ability.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
info
(
"
MyAbilityStageMonitor onCreate
"
);
globalThis
.
abilityStageContext
=
this
.
context
;
}
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/MainAbility/MainAbility.ts
0 → 100644
浏览文件 @
4b3ece1f
/*
* Copyright (c) 2023 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.app.ability.UIAbility
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
// Ability is creating, initialize resources for this ability
console
.
log
(
"
ActsShellCommandControlTest MainAbility onCreate
"
);
globalThis
.
abilityWant
=
want
;
globalThis
.
abilityContext
=
this
.
context
;
let
abilityDelegator
:
any
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
let
abilityDelegatorArguments
:
any
;
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
();
console
.
info
(
'
start run testcase!!!
'
);
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
);
}
onDestroy
()
{
// Ability is destroying, release resources for this ability
console
.
log
(
"
ActsShellCommandControlTest MainAbility onDestroy
"
);
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
ActsShellCommandControlTest MainAbility onWindowStageCreate
"
);
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/index
"
,
null
);
console
.
log
(
"
ActsShellCommandControlTest MainAbility onWindowStageCreate finish
"
);
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
console
.
log
(
"
ActsShellCommandControlTest MainAbility onWindowStageDestroy
"
);
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
ActsShellCommandControlTest MainAbility onForeground
"
);
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
ActsShellCommandControlTest MainAbility onBackground
"
);
}
};
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
4b3ece1f
/*
* Copyright (c) 2023 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
'
let
abilityDelegator
=
undefined
;
let
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
();
globalThis
.
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
let
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
;
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
);
let
cmd
=
'
aa start -d 0 -a MainAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
;
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
);
console
.
info
(
'
cmd :
'
+
cmd
);
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
);
}
};
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/pages/index/index.ets
0 → 100644
浏览文件 @
4b3ece1f
/*
* Copyright (c) 2023 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 {
build() {
Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('MainAbility Hello World')
.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
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
4b3ece1f
/*
* Copyright (c) 2023 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 shellCommandControlTest from './ShellCommandControl.test'
export default function testsuite() {
shellCommandControlTest();
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/ets/test/ShellCommandControl.test.ets
0 → 100644
浏览文件 @
4b3ece1f
/*
* Copyright (c) 2023 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 { describe, it, expect } from '@ohos/hypium'
let TAG;
export default function shellCommandControlTest() {
describe('ShellCommandControlTest', function () {
/**
* @tc.number: Acts_Ability_ShellCommandControl__0100
* @tc.name: Verify that the aa command aa help can be executed
* @tc.desc: Error code 0 is returned
* @tc.level 0
*/
it('Acts_Ability_ShellCommandControl__0100', 0, async function (done) {
TAG = 'Acts_Ability_ShellCommandControl__0100';
console.log(`${TAG} --- start`);
let cmd = 'aa help'
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log(`${TAG} stdResult = ${data.stdResult}`);
console.log(`${TAG} stdResult = ${JSON.stringify(err)}`);
expect(data.exitCode).assertEqual(0);
console.log(`${TAG} --- end`);
done();
})
})
/**
* @tc.number: Acts_Ability_ShellCommandControl__0200
* @tc.name: Verify that the aa command ls -l cannot be executed
* @tc.desc: Error code -1 is returned
* @tc.level 3
*/
it('Acts_Ability_ShellCommandControl__0200', 0, async function (done) {
TAG = 'Acts_Ability_ShellCommandControl__0200';
console.log(`${TAG} --- start`);
let cmd = 'ls -l';
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log(`${TAG} stdResult = ${data.stdResult}`);
console.log(`${TAG} stdResult = ${JSON.stringify(err)}`);
expect(data.exitCode).assertEqual(-1);
console.log(`${TAG} --- end`);
done();
})
})
})
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/module.json
0 → 100644
浏览文件 @
4b3ece1f
{
"module"
:
{
"name"
:
"entry_test"
,
"type"
:
"entry"
,
"srcEntrance"
:
"./ets/Application/MyAbilityStage.ts"
,
"description"
:
"$string:entry_test_desc"
,
"mainElement"
:
"MainAbility"
,
"deviceTypes"
:
[
"default"
,
"tablet"
],
"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
}
]
}
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
4b3ece1f
{
"string"
:
[
{
"name"
:
"entry_test_desc"
,
"value"
:
"description"
},
{
"name"
:
"app_name"
,
"value"
:
"ActsShellCommandControlTest"
},
{
"name"
:
"description_application"
,
"value"
:
"demo for test"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"entry_MainAbility"
}
]
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
4b3ece1f
6.6 KB
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/entry/src/main/resources/base/profile/main_pages.json
0 → 100644
浏览文件 @
4b3ece1f
{
"src"
:
[
"pages/index/index"
]
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/actsshellcommandcontroltest/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
4b3ece1f
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录