Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e6953c87
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看板
提交
e6953c87
编写于
7月 25, 2022
作者:
X
xuchenghua09
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
codex
Signed-off-by:
N
xuchenghua09
<
xuchenghua09@huawei.com
>
上级
9f64f660
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
1321 addition
and
0 deletion
+1321
-0
ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility/pages/index.ets
...tyusertest/entry/src/main/ets/MainAbility/pages/index.ets
+15
-0
ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index.ets
...me/actsabilityusertest/entry/src/main/ets/pages/index.ets
+15
-0
ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index2.ets
...e/actsabilityusertest/entry/src/main/ets/pages/index2.ets
+15
-0
ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index3.ets
...e/actsabilityusertest/entry/src/main/ets/pages/index3.ets
+15
-0
ability/ability_runtime/actsabilityusertest/entry/src/main/ets/test/List.test.ets
...actsabilityusertest/entry/src/main/ets/test/List.test.ets
+15
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/app.json
...est/ActskillProcessWithAccountCloseTest/AppScope/app.json
+21
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/resources/base/element/string.json
...ountCloseTest/AppScope/resources/base/element/string.json
+8
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/resources/base/media/app_icon.png
...countCloseTest/AppScope/resources/base/media/app_icon.png
+0
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/BUILD.gn
...ionalitytest/ActskillProcessWithAccountCloseTest/BUILD.gn
+45
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/Test.json
...onalitytest/ActskillProcessWithAccountCloseTest/Test.json
+11
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/Application/AbilityStage.ts
...tCloseTest/entry/src/main/ets/Application/AbilityStage.ts
+21
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/MainAbility/MainAbility.ts
...ntCloseTest/entry/src/main/ets/MainAbility/MainAbility.ts
+53
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/MainAbility/pages/index.ets
...tCloseTest/entry/src/main/ets/MainAbility/pages/index.ets
+48
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+72
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/pages/index.ets
...ssWithAccountCloseTest/entry/src/main/ets/pages/index.ets
+31
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/test/Ability.test.ets
...AccountCloseTest/entry/src/main/ets/test/Ability.test.ets
+27
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/test/List.test.ets
...ithAccountCloseTest/entry/src/main/ets/test/List.test.ets
+19
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/module.json
...illProcessWithAccountCloseTest/entry/src/main/module.json
+36
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/resources/base/element/string.json
...oseTest/entry/src/main/resources/base/element/string.json
+24
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/resources/base/media/icon.png
...untCloseTest/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/signature/openharmony_sx.p7b
...lProcessWithAccountCloseTest/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/BUILD.gn
...bility_runtime/actsshellcommandfunctionalitytest/BUILD.gn
+24
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/app.json
...ndfunctionalitytest/ExecuteShellCommand/AppScope/app.json
+21
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/resources/base/element/string.json
...eShellCommand/AppScope/resources/base/element/string.json
+8
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/resources/base/media/app_icon.png
...teShellCommand/AppScope/resources/base/media/app_icon.png
+0
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/BUILD.gn
...hellcommandfunctionalitytest/ExecuteShellCommand/BUILD.gn
+41
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/Test.json
...ellcommandfunctionalitytest/ExecuteShellCommand/Test.json
+27
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/Application/AbilityStage.ts
...ellCommand/entry/src/main/ets/Application/AbilityStage.ts
+21
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/MainAbility/MainAbility.ts
...hellCommand/entry/src/main/ets/MainAbility/MainAbility.ts
+53
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/MainAbility/pages/index.ets
...ellCommand/entry/src/main/ets/MainAbility/pages/index.ets
+48
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...nd/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+73
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/pages/index.ets
...st/ExecuteShellCommand/entry/src/main/ets/pages/index.ets
+31
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/test/Ability.test.ets
...cuteShellCommand/entry/src/main/ets/test/Ability.test.ets
+343
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/test/List.test.ets
...ExecuteShellCommand/entry/src/main/ets/test/List.test.ets
+19
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/module.json
...nalitytest/ExecuteShellCommand/entry/src/main/module.json
+36
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/resources/base/element/string.json
...Command/entry/src/main/resources/base/element/string.json
+24
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/resources/base/media/icon.png
...ShellCommand/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/signature/openharmony_sx.p7b
...litytest/ExecuteShellCommand/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility/pages/index.ets
...runnertest/entry/src/main/ets/MainAbility/pages/index.ets
+15
-0
ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index.ets
...me/actsstartrunnertest/entry/src/main/ets/pages/index.ets
+15
-0
ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index2.ets
...e/actsstartrunnertest/entry/src/main/ets/pages/index2.ets
+1
-0
ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index3.ets
...e/actsstartrunnertest/entry/src/main/ets/pages/index3.ets
+15
-0
ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/test/List.test.ets
...actsstartrunnertest/entry/src/main/ets/test/List.test.ets
+15
-0
未找到文件。
ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility/pages/index.ets
浏览文件 @
e6953c87
/*
* 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
...
...
ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index.ets
浏览文件 @
e6953c87
/*
* 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 {
...
...
ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index2.ets
浏览文件 @
e6953c87
/*
* 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 {
...
...
ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index3.ets
浏览文件 @
e6953c87
/*
* 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 {
...
...
ability/ability_runtime/actsabilityusertest/entry/src/main/ets/test/List.test.ets
浏览文件 @
e6953c87
/*
* 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 abilityTest from './Ability.test'
export default function testsuite() {
...
...
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/app.json
0 → 100644
浏览文件 @
e6953c87
{
"app"
:
{
"bundleName"
:
"com.example.actskillprocesswithaccountclosetest"
,
"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/ActskillProcessWithAccountCloseTest/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
e6953c87
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"ActskillProcessWithAccountCloseTest"
}
]
}
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
e6953c87
6.6 KB
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/BUILD.gn
0 → 100644
浏览文件 @
e6953c87
# 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_hap("ActSkillProcessWithAccountCloseTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
hap_name = "ActSkillProcessWithAccountCloseTest"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":actskillprocesswithaccountclosetest_js_assets",
":actskillprocesswithaccountclosetest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
}
ohos_app_scope("actskillprocesswithaccountclosetest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actskillprocesswithaccountclosetest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actskillprocesswithaccountclosetest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actskillprocesswithaccountclosetest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/Test.json
0 → 100644
浏览文件 @
e6953c87
{
"description"
:
"Configuration for aceceshi Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"600000"
,
"bundle-name"
:
"com.example.actskillprocesswithaccountclosetest"
,
"module-name"
:
"entry"
,
"shell-timeout"
:
"600000"
}
}
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/Application/AbilityStage.ts
0 → 100644
浏览文件 @
e6953c87
/*
* 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
AbilityStage
from
"
@ohos.application.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
"
[Demo] MyAbilityStage onCreate
"
)
}
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/MainAbility/MainAbility.ts
0 → 100644
浏览文件 @
e6953c87
/*
* 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
hypium/index
'
import
testsuite
from
'
../test/List.test
'
export
default
class
TestAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
TestAbility onCreate
'
)
var
abilityDelegator
:
any
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
:
any
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
}
onDestroy
()
{
console
.
log
(
'
TestAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
TestAbility onWindowStageCreate
'
)
windowStage
.
setUIContent
(
this
.
context
,
'
TestAbility/pages/index
'
,
null
)
globalThis
.
abilityContext
=
this
.
context
;
}
onWindowStageDestroy
()
{
console
.
log
(
'
TestAbility onWindowStageDestroy
'
)
}
onForeground
()
{
console
.
log
(
'
TestAbility onForeground
'
)
}
onBackground
()
{
console
.
log
(
'
TestAbility onBackground
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/MainAbility/pages/index.ets
0 → 100644
浏览文件 @
e6953c87
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
e6953c87
/*
* 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
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/pages/index.ets
0 → 100644
浏览文件 @
e6953c87
/*
* 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
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/test/Ability.test.ets
0 → 100644
浏览文件 @
e6953c87
/*
* 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
export default function abilityTest() {
describe('ActsAbilityTest', function () {
it('assertContain',0, function () {
console.info("it begin")
let a = 'abc'
let b = 'b'
expect(a).assertContain(b)
expect(a).assertEqual(a)
})
})
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
e6953c87
/*
* 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 abilityTest from './Ability.test'
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/module.json
0 → 100644
浏览文件 @
e6953c87
{
"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"
]
}
]
}
]
}
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
e6953c87
{
"string"
:
[
{
"name"
:
"entry_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"app_name"
,
"value"
:
"ActskillProcessWithAccountCloseTest"
},
{
"name"
:
"description_application"
,
"value"
:
"demo for test"
}
]
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
e6953c87
6.6 KB
ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
e6953c87
文件已添加
ability/ability_runtime/actsshellcommandfunctionalitytest/BUILD.gn
0 → 100644
浏览文件 @
e6953c87
# 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.
import("//test/xts/tools/build/suite.gni")
group("actsshellcommandfunctionalitytest") {
testonly = true
if (is_standard_system) {
deps = [
"ActskillProcessWithAccountCloseTest:ActSkillProcessWithAccountCloseTest",
"ExecuteShellCommand:ExecuteShellCommand",
]
}
}
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/app.json
0 → 100644
浏览文件 @
e6953c87
{
"app"
:
{
"bundleName"
:
"com.example.executeshellcommand"
,
"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/ExecuteShellCommand/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
e6953c87
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"ExecuteShellCommand"
}
]
}
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
e6953c87
6.6 KB
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/BUILD.gn
0 → 100644
浏览文件 @
e6953c87
# 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("ExecuteShellCommand") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":executeshellcommand_js_assets",
":executeshellcommand_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ExecuteShellCommand"
}
ohos_app_scope("executeshellcommand_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("executeshellcommand_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("executeshellcommand_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":executeshellcommand_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/Test.json
0 → 100644
浏览文件 @
e6953c87
{
"description"
:
"Configuration for aceceshi Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"600000"
,
"bundle-name"
:
"com.example.executeshellcommand"
,
"module-name"
:
"entry"
,
"shell-timeout"
:
"600000"
},
"kits"
:
[
{
"type"
:
"PushKit"
,
"push"
:
[
"ActSkillProcessWithAccountCloseTest.hap->/data/ActSkillProcessWithAccountCloseTest.hap"
]
},
{
"test-file-name"
:
[
"ActSkillProcessWithAccountCloseTest.hap"
,
"ExecuteShellCommand.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/Application/AbilityStage.ts
0 → 100644
浏览文件 @
e6953c87
/*
* 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
AbilityStage
from
"
@ohos.application.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
"
[Demo] MyAbilityStage onCreate
"
)
}
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/MainAbility/MainAbility.ts
0 → 100644
浏览文件 @
e6953c87
/*
* 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
hypium/index
'
import
testsuite
from
'
../test/List.test
'
export
default
class
TestAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
TestAbility onCreate
'
)
var
abilityDelegator
:
any
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
:
any
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
}
onDestroy
()
{
console
.
log
(
'
MainAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
MainAbility onWindowStageCreate
'
)
windowStage
.
setUIContent
(
this
.
context
,
'
MainAbility/pages/index
'
,
null
)
globalThis
.
abilityContext
=
this
.
context
;
}
onWindowStageDestroy
()
{
console
.
log
(
'
MainAbility onWindowStageDestroy
'
)
}
onForeground
()
{
console
.
log
(
'
MainAbility onForeground
'
)
}
onBackground
()
{
console
.
log
(
'
MainAbility onBackground
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/MainAbility/pages/index.ets
0 → 100644
浏览文件 @
e6953c87
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
e6953c87
/*
* 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
()
globalThis
.
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
MainAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
let
lMonitor
=
{
abilityName
:
MainAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
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/ExecuteShellCommand/entry/src/main/ets/pages/index.ets
0 → 100644
浏览文件 @
e6953c87
/*
* 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
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/test/Ability.test.ets
0 → 100644
浏览文件 @
e6953c87
/*
* 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import appManager from '@ohos.application.AppManager';
export default function abilityTest() {
describe('ACTS_ExecuteShellCommandTest', function () {
/**
* @tc.number: ACTS_ExecuteShellCommand_Callback_0100
* @tc.name: Execute a shell command without arguments (AsyncCallback).
* @tc.desc: Verify that the interface executes the Shell command successfully.
*/
it('ACTS_ExecuteShellCommand_Callback_0100', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Callback_0100 --- start")
var cmd = 'aa help'
var escresult = 'usage: aa <command> <options>'
globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.log('ACTS_ExecuteShellCommand_Callback_0100 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Callback_0100 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf(escresult);
console.log('ACTS_ExecuteShellCommand_Callback_0100 query string i = ' + i);
expect(i == -1).assertEqual(false);
console.log('ACTS_ExecuteShellCommand_Callback_0100 exitCode = ' + data.exitCode)
expect(data.exitCode).assertEqual(0);
console.log('ACTS_ExecuteShellCommand_Callback_0100 - executeShellCommand: end')
done()
})
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Callback_0200
* @tc.name: Execute shell command with timeout parameter (AsyncCallback)
* @tc.desc: Verify that the interface executes the Shell command successfully.
*/
it('ACTS_ExecuteShellCommand_Callback_0200', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Callback_0200 --- start")
var cmd = 'aa start -a MainAbility -b com.example.actskillprocesswithaccountclosetest'
globalThis.abilityDelegator.executeShellCommand(cmd, 1,(err, data) => {
console.log('ACTS_ExecuteShellCommand_Callback_0200 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Callback_0200 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf('start ability successfully.');
console.log('ACTS_ExecuteShellCommand_Callback_0200 query string i = ' + i);
expect(i == -1).assertEqual(false);
console.log('ACTS_ExecuteShellCommand_Callback_0200 exitCode = ' + data.exitCode)
expect(data.exitCode).assertEqual(0);
console.log('ACTS_ExecuteShellCommand_Callback_0200 - executeShellCommand: end')
done()
})
setTimeout(async() => {
appManager.killProcessWithAccount('com.example.actskillProcessWithAccountclosetest', 100).then(() => {
console.log('ACTS_ExecuteShellCommand_Callback_0200 killProcess ======> start');
})
}, 3000 )
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Callback_0300
* @tc.name: Execute non-existing shell command (AsyncCallback).
* @tc.desc: Failed to execute shell command on authentication interface.
*/
it('ACTS_ExecuteShellCommand_Callback_0300', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Callback_0300 --- start")
var cmd = 'ppwd -L'
globalThis.abilityDelegator.executeShellCommand(cmd, 1,(err, data) => {
console.log('ACTS_ExecuteShellCommand_Callback_0300 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Callback_0300 stdResult = ' + data.stdResult)
var i = data.stdResult.length
console.log('ACTS_ExecuteShellCommand_Callback_0300 query string i = ' + i);
expect(i == 0).assertEqual(true);
console.log('ACTS_ExecuteShellCommand_Callback_0300 exitCode = ' + data.exitCode)
expect(data.exitCode == 0).assertEqual(false);
console.log('ACTS_ExecuteShellCommand_Callback_0300 - executeShellCommand: end')
done();
})
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Callback_0400
* @tc.name: Execute shell command timeout (AsyncCallback)
* @tc.desc: The authentication interface executes the shell command timed out.
*/
it('ACTS_ExecuteShellCommand_Callback_0400', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Callback_0400 --- start")
var cmd = 'aa help'
var escresult = 'usage: aa <command> <options>'
globalThis.abilityDelegator.executeShellCommand(cmd,0, (err, data) => {
console.log('ACTS_ExecuteShellCommand_Callback_0400 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Callback_0400 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf(escresult);
console.log('ACTS_ExecuteShellCommand_Callback_0400 query string i = ' + i);
expect(i == -1).assertEqual(false);
console.log('ACTS_ExecuteShellCommand_Callback_0100 exitCode = ' + data.exitCode)
expect(data.exitCode).assertEqual(0);
console.log('ACTS_ExecuteShellCommand_Callback_0400 - executeShellCommand: end')
done();
})
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Callback_0500
* @tc.name: Invalid timeout parameter for executing shell command (AsyncCallback)
* @tc.desc: The timeout parameter for executing shell commands on the authentication interface is invalid.
*/
it('ACTS_ExecuteShellCommand_Callback_0500', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Callback_0500 --- start")
var cmd = 'aa help'
var escresult = 'usage: aa <command> <options>'
globalThis.abilityDelegator.executeShellCommand(cmd,-1, (err, data) => {
console.log('ACTS_ExecuteShellCommand_Callback_0500 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Callback_0500 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf(escresult);
console.log('ACTS_ExecuteShellCommand_Callback_0500 query string i = ' + i);
expect(i == -1).assertEqual(false);
console.log('ACTS_ExecuteShellCommand_Callback_0500 exitCode = ' + data.exitCode)
expect(data.exitCode).assertEqual(0);
console.log('ACTS_ExecuteShellCommand_Callback_0500 - executeShellCommand: end')
done();
})
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Callback_0600
* @tc.name: The executed shell command parameter is null (AsyncCallback)
* @tc.desc: Failed to execute shell command on authentication interface.
*/
it('ACTS_ExecuteShellCommand_Callback_0600', 0, async function (done) {
let flag=true;
console.log("ACTS_ExecuteShellCommand_Callback_0600 --- start")
globalThis.abilityDelegator.executeShellCommand("",1,(err, data) => {
console.log('ACTS_ExecuteShellCommand_Callback_0600 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Callback_0600 - executeShellCommand:data'+JSON.stringify(data))
expect(data).assertEqual(undefined);
console.log('ACTS_ExecuteShellCommand_Callback_0600 - executeShellCommand: end')
flag=false;
done();
})
setTimeout(()=>{
if(flag==true){
console.log('ACTS_ExecuteShellCommand_Callback_0600 timeout')
expect().assertFail();
done();
}
},5000)
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Callback_0700
* @tc.name: The timeout parameter of the execution is null (AsyncCallback)
* @tc.desc: Verify that the interface executes the Shell command successfully.
*/
it('ACTS_ExecuteShellCommand_Callback_0700', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_0700 --- start")
var cmd = 'aa help'
var code = null
setTimeout(() => {
console.log('ACTS_ExecuteShellCommand_Callback_0700 code:'+JSON.stringify(code))
if(code!=undefined){
expect().assertFail();
}
done();
}, 3000)
code = globalThis.abilityDelegator.executeShellCommand(cmd,null,() => {
console.log('ACTS_ExecuteShellCommand_Callback_0700 fail:')
expect().assertFail();
})
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Promise_0100
* @tc.name: Execute a shell command without arguments (Promise).
* @tc.desc: Verify that the interface executes the Shell command successfully.
*/
it('ACTS_ExecuteShellCommand_Promise_0100', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Promise_0100 --- start")
var cmd = 'aa help'
var escresult = 'usage: aa <command> <options>'
globalThis.abilityDelegator.executeShellCommand(cmd, 1).then((data) => {
console.log('ACTS_ExecuteShellCommand_Promise_0100 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Promise_0100 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf(escresult);
console.log('ACTS_ExecuteShellCommand_Promise_0100 query string i = ' + i);
expect(i == -1).assertEqual(false);
console.log('ACTS_ExecuteShellCommand_Promise_0100 exitCode = ' + data.exitCode)
expect(data.exitCode).assertEqual(0);
done();
})
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Promise_0200
* @tc.name: Execute shell command with timeout parameter (Promise)
* @tc.desc: Verify that the interface executes the Shell command successfully.
*/
it('ACTS_ExecuteShellCommand_Promise_0200', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Promise_0200 --- start")
var cmd = 'aa start -d 0 -a MainAbility -b com.example.actskillprocesswithaccountclosetest'
globalThis.abilityDelegator.executeShellCommand(cmd, 1).then((data) => {
console.log('ACTS_ExecuteShellCommand_Promise_0200 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Promise_0200 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf('start ability successfully.');
console.log('ACTS_ExecuteShellCommand_Promise_0200 query string i = ' + i);
expect(i == -1).assertEqual(false);
console.log('ACTS_ExecuteShellCommand_Promise_0200 exitCode = ' + data.exitCode)
expect(data.exitCode).assertEqual(0);
console.log('ACTS_ExecuteShellCommand_Promise_0200 - executeShellCommand: end')
done()
})
setTimeout(async() => {
appManager.killProcessWithAccount('com.example.actskillProcessWithAccountclosetest', 100).then(() => {
console.log('ACTS_ExecuteShellCommand_Promise_0200 killProcess ======> start');
})
}, 3000 )
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Promise_0300
* @tc.name: Execute non-existing shell command (Promise).
* @tc.desc: Failed to execute shell command on authentication interface.
*/
it('ACTS_ExecuteShellCommand_Promise_0300', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Promise_0300 --- start")
var cmd = 'ppwd -L'
globalThis.abilityDelegator.executeShellCommand(cmd, 1).then((data) => {
console.log('ACTS_ExecuteShellCommand_Promise_0300 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Promise_0300 stdResult = ' + data.stdResult)
var i = data.stdResult.length
console.log('ACTS_ExecuteShellCommand_Promise_0300 query string i = ' + i);
expect(i == 0).assertEqual(true);
console.log('ACTS_ExecuteShellCommand_Promise_0300 exitCode = ' + data.exitCode)
expect(data.exitCode == 0).assertEqual(false);
console.log('ACTS_ExecuteShellCommand_Promise_0300 - executeShellCommand: end')
done();
})
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Promise_0400
* @tc.name: Execute shell command timeout (Promise)
* @tc.desc: The authentication interface executes the shell command timed out.
*/
it('ACTS_ExecuteShellCommand_Promise_0400', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Promise_0400 --- start")
var cmd = 'aa help'
var escresult = 'usage: aa <command> <options>'
globalThis.abilityDelegator.executeShellCommand(cmd, 0).then((data) => {
console.log('ACTS_ExecuteShellCommand_Promise_0400 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Promise_0400 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf(escresult);
console.log('ACTS_ExecuteShellCommand_Promise_0400 query string i = ' + i);
expect(data.exitCode).assertEqual(0);
console.log('ACTS_ExecuteShellCommand_Promise_0400 - executeShellCommand: end')
done();
})
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Promise_0500
* @tc.name: Invalid timeout parameter for executing shell command (Promise)
* @tc.desc: The timeout parameter for executing shell commands on the authentication interface is invalid.
*/
it('ACTS_ExecuteShellCommand_Promise_0500', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Promise_0500 --- start")
var cmd = 'aa help'
var escresult = 'usage: aa <command> <options>'
globalThis.abilityDelegator.executeShellCommand(cmd, -1).then((data) => {
console.log('ACTS_ExecuteShellCommand_Promise_0500 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Promise_0500 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf(escresult);
console.log('ACTS_ExecuteShellCommand_Promise_0500 query string i = ' + i);
expect(data.exitCode).assertEqual(0);
console.log('ACTS_ExecuteShellCommand_Promise_0500 - executeShellCommand: end')
done();
})
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Promise_0600
* @tc.name: The executed shell command parameter is null (Promise)
* @tc.desc: Failed to execute shell command on authentication interface.
*/
it('ACTS_ExecuteShellCommand_Promise_0600', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Promise_0600 --- start")
let flag = true;
globalThis.abilityDelegator.executeShellCommand("",1).then((data) => {
console.log('ACTS_ExecuteShellCommand_Promise_0600 - executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Promise_0600 - executeShellCommand:data'+JSON.stringify(data))
expect(data).assertEqual(undefined);
console.log('ACTS_ExecuteShellCommand_Callback_0600 - executeShellCommand: end')
flag=false;
done();
},(data) => {
console.log('ACTS_ExecuteShellCommand_Promise_0600 -2 executeShellCommand: start ')
console.log('ACTS_ExecuteShellCommand_Promise_0600 -2 executeShellCommand:data'+JSON.stringify(data))
expect(data.code).assertEqual(-1);
console.log('ACTS_ExecuteShellCommand_Callback_0600 -2 executeShellCommand: end')
flag=false;
done();
}).catch((err) => {
console.log('ACTS_ExecuteShellCommand_Promise_0600 -2 executeShellCommand:err'+JSON.stringify(err))
})
setTimeout(()=>{
if(flag==true){
console.log('ACTS_ExecuteShellCommand_Callback_0600 timeout')
expect().assertFail();
done();
}
},5000)
})
/**
* @tc.number: ACTS_ExecuteShellCommand_Promise_0700
* @tc.name: The timeout parameter of the execution is null (Promise)
* @tc.desc: Verify that the interface executes the Shell command successfully.
*/
it('ACTS_ExecuteShellCommand_Promise_0700', 0, async function (done) {
console.log("ACTS_ExecuteShellCommand_Promise_0700 --- start")
var cmd = 'aa help'
var code = null
code = globalThis.abilityDelegator.executeShellCommand(cmd, null)
setTimeout(() => {
console.log('ACTS_ExecuteShellCommand_Callback_0700 code:'+JSON.stringify(code))
if(code!=undefined){
expect().assertFail();
}
done();
}, 3000)
})
})
};
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
e6953c87
/*
* 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 abilityTest from './Ability.test'
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/module.json
0 → 100644
浏览文件 @
e6953c87
{
"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"
]
}
]
}
]
}
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
e6953c87
{
"string"
:
[
{
"name"
:
"entry_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"app_name"
,
"value"
:
"ExecuteShellCommand"
},
{
"name"
:
"description_application"
,
"value"
:
"demo for test"
}
]
}
\ No newline at end of file
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
e6953c87
6.6 KB
ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
e6953c87
文件已添加
ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility/pages/index.ets
浏览文件 @
e6953c87
/*
* 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 '@system.router';
import file from '@system.file';
@Entry
...
...
ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index.ets
浏览文件 @
e6953c87
/*
* 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 {
...
...
ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index2.ets
浏览文件 @
e6953c87
actsstartrunnertest/entry/src/main/ets/pages/index3.ets
@Entry
@Component
struct Index {
...
...
ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index3.ets
浏览文件 @
e6953c87
/*
* 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 {
...
...
ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/test/List.test.ets
浏览文件 @
e6953c87
/*
* 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 abilityTest from './Ability.test'
export default function testsuite() {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录