提交 edd9f5f5 编写于 作者: X xinking129 提交者: Gitee

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

Signed-off-by: Nxinking129 <xinxin13@huawei.com>

要显示的变更太多。

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -343,9 +343,22 @@ OpenHarmony支持如下几种系统类型:
}
```
5. 测试套件编译命令。
5. 测试套件编译命令_两种编译方式
随版本编译,debug版本编译时会同步编译acts测试套件
方式一:
```
./test/xts/tools/lite/build.sh product=wifiiot xts=acts
```
方式二:
```
hb set
选择 设备类型
hb build --gn-args build_xts=true
(注):若不追加--gn-args build_xts=true,不会编译acts测试套件。
```
>![](figures/icon-note.gif) **说明:**
>acts测试套件编译中间件为静态库,最终链接到版本镜像中 。
......@@ -447,7 +460,7 @@ OpenHarmony支持如下几种系统类型:
sources = [
"src/TestDemo.cpp"
]
include_dirs = [
"src",
...
......@@ -457,7 +470,7 @@ OpenHarmony支持如下几种系统类型:
]
cflags = [ "-Wno-error" ]
}
```
4. acts目录下增加编译选项(BUILD.gn)样例:
......@@ -476,9 +489,31 @@ OpenHarmony支持如下几种系统类型:
}
```
5. 测试套件编译命令。
5. 测试套件编译命令_两种编译方式。
L1_LiteOS:
```
方式一:
python3 build.py -p ipcamera_hispark_taurus@hisilicon --gn-args build_xts=true
方式二:
hb set
选择 设备类型
hb build --gn-args build_xts=true
(注):若不追加--gn-args build_xts=true,不会编译acts测试套件。
```
L1_Linux:
随版本编译,debug版本编译时会同步编译acts测试套件
```
方式一:
python3 build.py -p ipcamera_hispark_taurus_linux@hisilicon --gn-args build_xts=true
方式二:
hb set
选择 设备类型
hb build --gn-args build_xts=true
(注):若不追加--gn-args build_xts=true,不会编译acts测试套件。
```
>![](figures/icon-note.gif) **说明:**
>小型系统acts独立编译成可执行文件(bin格式), 在编译产物的suites\\acts目录下归档。
......@@ -581,55 +616,91 @@ OpenHarmony支持如下几种系统类型:
用例编写语法采用 jasmine 的标准语法,格式支持ES6格式。
1. 规范用例目录:测试用例存储到entry/src/main/js/test目录。
**以FA 模式为例:**
1. 规范用例目录:测试用例存储到 src/main/js/test目录。
```
├── BUILD.gn
│ └──entry
│ │ └──src
│ │ │ └──main
│ │ │ │ └──js
│ │ │ │ │ └──default
│ │ │ │ │ │ └──pages
│ │ │ │ │ │ │ └──index
│ │ │ │ │ │ │ │ └──index.js # 入口文件
│ │ │ │ │ └──test # 测试代码存放目录
│ │ │ └── resources # hap资源存放目录
│ │ │ └── config.json # hap配置文件
├── BUILD.gn
├── Test.json # 资源依赖hap不需要Test.json文件
├── signature
│ └──openharmony_sx.p7b # 签名工具
└──src
│ └──main
│ │ └──js
│ │ │ └──MainAbility
│ │ │ │ └──app.js
│ │ │ │ └──pages
│ │ │ │ │ └──index
│ │ │ │ │ │ └──index.js
│ │ │ └──test # 测试代码存放目录
│ │ │ │ │ └──List.test.js
│ │ │ │ │ └──Ability.test.js
│ │ │ └──TestAbility # 测试框架入口模板文件,添加后无需修改
│ │ │ │ └──app.js
│ │ │ │ └──pages
│ │ │ │ │ └──index
│ │ │ │ │ │ └──index.js
│ │ │ └──TestRunner # 测试框架入口模板文件,添加后无需修改
│ │ │ │ └──OpenHarmonyTestRunner.js
│ └── resources # hap资源存放目录
│ └── config.json # hap配置文件
```
2. index.js示例
2. OpenHarmonyTestRunner.js 示例
```
//加载js 测试框架
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
...
export default {
...
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
...
}
};
```
3. index.js示例
```
// 拉起js测试框架,加载测试用例
import {Core, ExpectExtend} 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'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onShow finish!')
},
...
}
```
3. 单元测试用例示例
4. app.js示例
```
//加载测试用例
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)
},
...
};
```
5. 单元测试用例示例
```
// Example1: 使用HJSUnit进行单元测试
......@@ -643,6 +714,228 @@ OpenHarmony支持如下几种系统类型:
```
FA_JS 模式测试模块下用例配置文件(BUILD.gn)样例:
```
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsDemoTest") {
hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b" //签名文件
hap_name = "ActsDemoTest" //测试套件,以Acts开头,以Test结尾,采用驼峰式命名
part_name = "..." //部件
subsystem_name = "..." //子系统
}
ohos_js_assets("hjs_demo_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
```
FA_TS 模式测试模块下用例配置文件(BUILD.gn)样例:
```
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsDemoTest") {
hap_profile = "./src/main/config.json"
deps = [
":ace_demo_ets_assets",
":ace_demo_ets_resources",
":ace_demo_ets_test_assets",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" //签名文件
hap_name = "ActsDemoTest" //测试套件,以Acts开头,以Test结尾,采用驼峰式命名
part_name = "..." //部件
subsystem_name = "..." //子系统
}
ohos_js_assets("ace_demo_ets_assets") {
source_dir = "./src/main/ets/MainAbility"
}
ohos_js_assets("ace_demo_ets_test_assets") {
source_dir = "./src/main/ets/TestAbility"
}
ohos_resources("ace_demo_ets_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
```
FA_JS 模式适配指导请参考
[一. 标准系统FA-JS-旧框架编译Hap包指导 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E4%B8%80.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA-JS-%E6%97%A7%E6%A1%86%E6%9E%B6%E7%BC%96%E8%AF%91Hap%E5%8C%85%E6%8C%87%E5%AF%BC)
[三. 标准系统FA-JS模式XTS-旧框架-新框架适配 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E4%B8%89.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA-JS%E6%A8%A1%E5%BC%8FXTS-%E6%97%A7%E6%A1%86%E6%9E%B6-%E6%96%B0%E6%A1%86%E6%9E%B6%E9%80%82%E9%85%8D)
FA_TS 模式适配指导请参考
[二. 标准系统FA-ETS-新框架编译Hap包指导 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E4%BA%8C.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA-ETS-%E6%96%B0%E6%A1%86%E6%9E%B6%E7%BC%96%E8%AF%91Hap%E5%8C%85%E6%8C%87%E5%AF%BC)
[四. 标准系统FA-TS模式XTS-旧框架-新框架适配 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E5%9B%9B.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA-TS%E6%A8%A1%E5%BC%8FXTS-%E6%97%A7%E6%A1%86%E6%9E%B6-%E6%96%B0%E6%A1%86%E6%9E%B6%E9%80%82%E9%85%8D)
**以Stage 模式为例:**
1. 规范用例目录:测试用例存储到 src/main/js/test目录。
```
├── BUILD.gn # 配置文件
├── Test.json # 资源依赖hap不需要Test.json文件
├── signature
│ └──openharmony_sx.p7b # 签名工具
├── AppScope
│ └──resource
│ └──app.json
├── entry
│ └──src
│ │ └──main
│ │ │ └──ets
│ │ │ │ └──test # 测试代码存放目录
│ │ │ │ │ └──List.test.ets
│ │ │ │ │ └──Ability.test.ets
│ │ │ │ └──MainAbility
│ │ │ │ │ └──MainAbility.ts
│ │ │ │ │ └──pages
│ │ │ │ │ │ └──index
│ │ │ │ │ │ │ └──index.ets
│ │ │ │ └──TestAbility
│ │ │ │ │ └──TestAbility.ts # 测试用例启动入口 ability
│ │ │ │ │ └──pages
│ │ │ │ │ │ └──index.ets
│ │ │ │ └──Application
│ │ │ │ │ └──AbilityStage.ts
│ │ │ │ └──TestRunner # 测试框架入口模板文件,添加后无需修改
│ │ │ │ │ └──OpenHarmonyTestRunner.js
│ │ └── resources # hap资源存放目录
│ │ └── module.json # hap配置文件
```
2. OpenHarmonyTestRunner.ts 示例
【注】在TestRunner目录下的 OpenHarmonyTestRunner.ts 文件中的 async onRun() 方法下存在拉起测试套入口xxxAbility的cmd 命令:
例如:
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
需与module.json中 "abilities" 下的 "name" 字段保持一致,保证拉起的是我们需要的测试入口。
```
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
...
export default class OpenHarmonyTestRunner implements TestRunner {
...
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
...
}
};
```
3. index.ets示例
```
import router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear(){
console.info("start run testcase!!!!")
}
build() {
...
}
}
```
4. app.js示例
```
//加载测试用例
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
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)
}
...
};
```
Stage 模式测试模块下用例配置文件(BUILD.gn)样例:
```
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsDemoTest") {
hap_profile = "/src/main/module.json"
js_build_mode = "debug"
deps = [
":edm_js_assets",
":edm_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b" //签名文件
hap_name = "ActsDemoTest" //测试套件,以Acts开头,以Test结尾,采用驼峰式命名
subsystem_name = "customization" //子系统
part_name = "enterprise_device_management" //部件
}
ohos_app_scope("edm_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("edm_js_assets") {
source_dir = "/src/main/ets"
}
ohos_resources("edm_resources") {
sources = [ "/src/main/resources" ]
deps = [ ":edm_app_profile" ]
hap_profile = "/src/main/module.json"
}
```
Stage 模式适配指导请参考
[五. 标准系统Stage模式-ETS-旧框架编译Hap包指导 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E4%BA%94.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FStage%E6%A8%A1%E5%BC%8F-ETS-%E6%97%A7%E6%A1%86%E6%9E%B6%E7%BC%96%E8%AF%91Hap%E5%8C%85%E6%8C%87%E5%AF%BC)
[六. 标准系统Stage模式XTS-旧框架-新框架适配 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E5%85%AD.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FStage%E6%A8%A1%E5%BC%8FXTS-%E6%97%A7%E6%A1%86%E6%9E%B6-%E6%96%B0%E6%A1%86%E6%9E%B6%E9%80%82%E9%85%8D)
### JS语言用例编译打包指导(适用于标准系统)<a name="section445519106559"></a>
hap包编译请参考 [标准系统 JS用例源码编译Hap包指导](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9F%20JS%E7%94%A8%E4%BE%8B%E6%BA%90%E7%A0%81%E7%BC%96%E8%AF%91Hap%E5%8C%85%E6%8C%87%E5%AF%BC%20?sort_id=4427112)
......@@ -650,12 +943,32 @@ hap包编译请参考 [标准系统 JS用例源码编译Hap包指导](https://gi
### 全量编译指导(适用于标准系统)<a name="section159801435165220"></a>
1. 全量编译
test/xts/acts目录下执行编译命令:
```./build.sh suite=acts system_size=standard ```
test/xts/acts目录下执行编译命令:
测试用例输出目录:out/release/suites/acts/testcases
```
./build.sh product_name=rk3568 system_size=standard
```
2. 单个子系统编译
test/xts/acts目录下执行编译命令:
```
./build.sh product_name=rk3568 system_size=standard target_subsystem=××××
```
3. 单模块编译
测试框架&用例整体输出目录:out/release/suites/acts(编译用例时会同步编译测试套执行框架)
test/xts/acts目录下执行编译命令:
```./build.sh suite=acts system_size=standard target_subsystem=××××
./build.sh product_name=rk3568 system_size=standard suite=xxx
suite 后面添加的是BUILD.gn 中ohos_js_hap_suite模板的命名
```
测试用例输出目录:out/rk3568/suites/acts/testcases
测试框架&用例整体输出目录:out/rk3568/suites/acts(编译用例时会同步编译测试套执行框架)
### 全量用例执行指导(适用于小型系统、标准系统)<a name="section159801435165220"></a>
......@@ -673,14 +986,27 @@ Windows工作台下安装python3.7及以上版本,确保工作台和测试设
用例执行
1. 在Windows工作台上,找到从Linux服务器上拷贝下来的测试套件用例目录,在Windows命令窗口进入对应目录,直接执行acts\run.bat。
2. 界面启动后,输入用例执行指令。
全量执行:```run acts ```
模块执行(具体模块可以查看\acts\testcases\):```run –l ActsSamgrTest ```
单包执行(具体模块可以查看\acts\testcases\):(适用于OH驱动)
```
run -l uitestActs -ta class:UiTestCase#testChecked
uitestActs: 测试hap
UiTestCase: testsuite
testChecked: testcase
```
3. 查看测试报告。
进入acts\reports\,获取当前的执行记录,打开“summary_report.html”可以获取到测试报告。
进入acts\reports\,获取当前的执行记录,打开“summary_report.html”可以获取到测试报告。
## 相关仓<a name="section1371113476307"></a>
......
......@@ -21,10 +21,15 @@ group("ability_runtime") {
"abilitymanager:actsabilitymanagertest",
"abilitymontior:ActsAbilityMonitorTest",
"abilitymultiinstance:abilitymultiinstance",
"abilitystagemonitor:abilitystagemonitor",
"actsabilitydelegatorcase:ActsAbilityDelegatorCaseTest",
"actsabilitymanageretstest:ActsAbilityManagerEtsTest",
"actsabilityusertest:ActsAbilityuserTest",
"actsappselector:actsappselector",
"actscalldataabilitytest:ActsCallDataAbilityTest",
"actscalldataabilitytest:ActsCallDataAbilityTest",
"actscalltest:actscalltest",
"actsdataabilityaccessdatasharetest:dataabilityaccessdatashare",
"actsfwkdataaccessortest:dataability",
"actsqueryfunctiontest:actsqueryfunctiontest",
"actsserviceabilityclienttest:serviceability",
......
......@@ -6,8 +6,7 @@
"description": "$string:entry_test_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"phone",
"tablet"
"default"
],
"deliveryWithInstall": true,
"installationFree": false,
......
......@@ -6,6 +6,7 @@
"description": "$string:entry_test_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone",
"tablet"
],
......
{
"app": {
"bundleName": "com.example.aacommandprintonetest",
"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": "AACommandPrintSyncTest"
}
]
}
# 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("ActsAACommandPrintOneTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":aacommandprintonetest_js_assets",
":aacommandprintonetest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAACommandPrintOneTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("aacommandprintonetest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("aacommandprintonetest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("aacommandprintonetest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":aacommandprintonetest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for aceceshi Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.aacommandprintonetest",
"module-name": "entry_test",
"shell-timeout": "600000"
},
"kits": [
{
"type": "ShellKit",
"run-command": [
" hilog -Q pidoff",
"hilog -Q domainoff",
"hilog -b D"
]
},
{
"test-file-name": [
"ActsAACommandPrintOneTest.hap",
"AACommandRelyHap.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 AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
}
}
\ 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 Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
async function startAbilityTest(TAG, context) {
let wantInfo = {
bundleName: "com.example.aacommandprintonetest",
abilityName: "MainAbility"
}
await context.startAbility(wantInfo).then((data) => {
console.log(TAG + "startAbility data : " + JSON.stringify(data));
}).catch((err) => {
console.log(TAG + "startAbility err : " + JSON.stringify(err));
})
}
export default class MainAbility extends Ability {
async onCreate(want, launchParam) {
globalThis.abilityContext = this.context;
console.log('MainAbility onCreate')
let cmd: any
let abilityDelegatorArguments: any
let abilityDelegator: any
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
cmd = 'aa test -b com.example.aacommandrelyhap -m entry_test -s class ACTS_AACommand_01_3#ACTS_AACo' +
'mmand_print_01_0100 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: start ')
console.log('ACTS_AACommand_print_01_0100 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_print_01_0100 stdResult = ' + data.stdResult)
globalThis.stdResult3 = data.stdResult;
console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_print_01_0100', this.context);
})
await sleep(4000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' +
'and_print_01_0200 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: start ')
console.log('ACTS_AACommand_print_01_0200 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_print_01_0200 stdResult = ' + data.stdResult)
globalThis.stdResult4 = data.stdResult;
console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_print_01_0200', this.context);
})
await sleep(4000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_' +
'AACommand_print_01_0300 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: start ')
console.log('ACTS_AACommand_print_01_0300 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_print_01_0300 stdResult = ' + data.stdResult)
globalThis.stdResult5 = data.stdResult;
console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_print_01_0300', this.context);
})
await sleep(4000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComma' +
'nd_print_01_0400 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: start ')
console.log('ACTS_AACommand_print_01_0400 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_print_01_0400 stdResult = ' + data.stdResult)
globalThis.stdResult6 = data.stdResult;
console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_print_01_0400', this.context);
})
await sleep(4000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' +
'and_print_01_0500 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: start ')
console.log('ACTS_AACommand_print_01_0500 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_print_01_0500 stdResult = ' + data.stdResult)
globalThis.stdResult7 = data.stdResult;
console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_print_01_0500', this.context);
})
await sleep(4000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AA' +
'Command_print_01_0600 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: start ')
console.log('ACTS_AACommand_print_01_0600 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_print_01_0600 stdResult = ' + data.stdResult)
globalThis.stdResult8 = data.stdResult;
console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_print_01_0600', this.context);
})
await sleep(4000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' +
'ACTS_AACommand_01_3#ACTS_AACommand_print_01_0700 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: start ')
console.log('ACTS_AACommand_print_01_0700 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_print_01_0700 stdResult = ' + data.stdResult)
globalThis.stdResult9 = data.stdResult;
console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_print_01_0700', this.context);
})
await sleep(4000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' +
'class ACTS_AACommand_01_3#ACTS_AACommand_print_01_0800 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: start ')
console.log('ACTS_AACommand_print_01_0800 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_print_01_0800 stdResult = ' + data.stdResult)
globalThis.stdResult10 = data.stdResult;
console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_print_01_0800', this.context);
})
setTimeout(() => {
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, 5000)
}
onDestroy() {
console.log('MainAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('MainAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'pages/index', null)
}
onWindowStageDestroy() {
console.log('MainAbility onWindowStageDestroy')
}
onForeground() {
console.log('MainAbility onForeground')
}
onBackground() {
console.log('MainAbility onBackground')
}
};
\ 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 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()
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
/*
* 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)
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
/*
* 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 '@ohos/hypium'
let msg: any
let msgcopy: any
export default function abilityTest() {
describe('ActsAACommandPrinOneTest', function () {
afterEach(async (done) => {
console.log("ActsAACommandPrinOneTest afterEach called");
let wantInfo = {
bundleName: "com.example.aacommandprintonetest",
abilityName: "MainAbility"
}
await globalThis.abilityContext.startAbility(wantInfo).then((data) => {
console.log("ActsAACommandPrinOneTest startAbility data : " + JSON.stringify(data));
}).catch((err) => {
console.log("ActsAACommandPrinOneTest startAbility err : " + JSON.stringify(err));
})
setTimeout(function () {
console.log("ActsAACommandPrinOneTest afterEach end");
done();
}, 1000);
})
/**
* @tc.number: ACTS_AACommand_print_0100
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in AsyncCallback mode. The print 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_print_0100', 0, async function (done) {
console.log("ACTS_AACommand_print_0100 --- start")
msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
expect(globalThis.stdResult3).assertContain(msg);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0200
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in AsyncCallback mode. The length of the print 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_print_0200', 0, async function (done) {
console.log("ACTS_AACommand_print_0200 --- start")
msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
expect(globalThis.stdResult4).assertContain(msg);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0300
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in AsyncCallback mode. The length of the print 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_print_0300', 0, async function (done) {
console.log("ACTS_AACommand_print_0300 --- start")
msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
let msgcopy = 'fffffffffff'
expect(globalThis.stdResult5).assertContain(msg);
expect(globalThis.stdResult5.indexOf(msgcopy) == -1).assertEqual(true);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0400
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in AsyncCallback mode. print 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_print_0400', 0, async function (done) {
console.log("ACTS_AACommand_print_0400 --- start")
msg = 'start ability successfully'
expect(globalThis.stdResult6).assertContain(msg);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0500
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in Promise mode. The print 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_print_0500', 0, async function (done) {
console.log("ACTS_AACommand_print_0500 --- start")
msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
expect(globalThis.stdResult7).assertContain(msg);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0600
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in Promise mode. The length of the print 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_print_0600', 0, async function (done) {
console.log("ACTS_AACommand_print_0600 --- start")
msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
expect(globalThis.stdResult8).assertContain(msg);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0700
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in Promise mode. The length of the print 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_print_0700', 0, async function (done) {
console.log("ACTS_AACommand_print_0700 --- start")
msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaa'
msgcopy = 'fffffffffff'
expect(globalThis.stdResult9).assertContain(msg);
expect(globalThis.stdResult9.indexOf(msgcopy) == -1).assertEqual(true);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0800
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in Promise mode. print 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_print_0800', 0, async function (done) {
console.log("ACTS_AACommand_print_0800 --- start")
msg = 'start ability successfully'
expect(globalThis.stdResult10).assertContain(msg);
done()
})
})
}
\ 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 abilityTest from './Ability.test'
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
{
"module": {
"name": "entry_test",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:entry_test_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone",
"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,
"launchType": "singleton",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_test_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "app_name",
"value": "AACommandPrintSyncTest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
......@@ -15,6 +15,9 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export default function abilityTest() {
describe('ACTS_AACommand_01_3', function () {
/**
......
......@@ -6,6 +6,7 @@
"description": "$string:entry_test_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone",
"tablet"
],
......
......@@ -14,11 +14,90 @@
*/
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
async function startAbilityTest(TAG, context) {
let wantInfo = {
bundleName: "com.example.aacommandprintsynctest",
abilityName: "MainAbility"
}
await context.startAbility(wantInfo).then((data) => {
console.log(TAG + "startAbility data : " + JSON.stringify(data));
}).catch((err) => {
console.log(TAG + "startAbility err : " + JSON.stringify(err));
})
}
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
async onCreate(want, launchParam) {
globalThis.abilityContext = this.context;
console.log('MainAbility onCreate')
let cmd: any
let abilityDelegatorArguments: any
let abilityDelegator: any
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
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'
abilityDelegator.executeShellCommand(cmd, async (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 ')
await startAbilityTest('ACTS_AACommand_printSync_01_0100', this.context);
})
await sleep(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'
abilityDelegator.executeShellCommand(cmd, async (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 ')
await startAbilityTest('ACTS_AACommand_printSync_01_0200', this.context);
})
await sleep(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'
abilityDelegator.executeShellCommand(cmd, async (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 ')
await startAbilityTest('ACTS_AACommand_printSync_01_0300', this.context);
})
await sleep(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'
abilityDelegator.executeShellCommand(cmd, async (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 ')
await startAbilityTest('ACTS_AACommand_printSync_01_0400', this.context);
})
setTimeout(() => {
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, 5000)
}
onDestroy() {
......
......@@ -13,83 +13,9 @@
* 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 {
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() {
......
......@@ -18,6 +18,25 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
let msg: any
export default function abilityTest() {
describe('ActsAbilityTest', function () {
afterEach(async (done) => {
console.log("ActsAACommandPrintSyncTest afterEach called");
let wantInfo = {
bundleName: "com.example.aacommandprintsynctest",
abilityName: "MainAbility"
}
await globalThis.abilityContext.startAbility(wantInfo).then((data) => {
console.log("ActsAACommandPrintSyncTest startAbility data : " + JSON.stringify(data));
}).catch((err) => {
console.log("ActsAACommandPrintSyncTest startAbility err : " + JSON.stringify(err));
})
setTimeout(function () {
console.log("ActsAACommandPrintSyncTest afterEach end");
done();
}, 1000);
})
/**
* @tc.number: ACTS_AACommand_printSync_0100
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid
......
......@@ -6,6 +6,7 @@
"description": "$string:entry_test_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone",
"tablet"
],
......@@ -21,6 +22,7 @@
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"launchType": "singleton",
"skills": [
{
"entities": [
......
......@@ -15,6 +15,10 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export default function abilityTest() {
describe('ACTS_AACommand_01_3', function () {
/**
......@@ -32,6 +36,7 @@ export default function abilityTest() {
console.log("ACTS_AACommand_print_01_0100 print test end ========> callback err: "+JSON.stringify(err) )
console.log("ACTS_AACommand_print_01_0100 print test end ========> callback data: "+JSON.stringify(data))
})
await sleep(1000);
var finishmsg = 'ACTS_AACommand_print_01_0100 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then((data)=>{
console.log("ACTS_AACommand_print_01_0100 finishTest test end ========> callback " )
......@@ -62,6 +67,7 @@ export default function abilityTest() {
globalThis.abilityDelegator.print(msg,()=>{
console.log("print test end ========> callback " )
})
await sleep(1000);
var finishmsg = 'ACTS_AACommand_print_01_0200 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{
console.log("ACTS_AACommand_print_01_0200 print test end ========> callback " )
......@@ -91,6 +97,7 @@ export default function abilityTest() {
globalThis.abilityDelegator.print(msg,()=>{
console.log("print test end ========> callback " )
})
await sleep(1000);
var finishmsg = 'ACTS_AACommand_print_01_0300 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{
console.log("ACTS_AACommand_print_01_0300 print test end ========> callback " )
......@@ -109,6 +116,7 @@ export default function abilityTest() {
globalThis.abilityDelegator.print(null,()=>{
console.log("print test end ========> callback " )
})
await sleep(1000);
var finishmsg = 'ACTS_AACommand_print_01_0400 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{
console.log("ACTS_AACommand_print_01_0400 print test end ========> callback " )
......@@ -128,6 +136,7 @@ export default function abilityTest() {
globalThis.abilityDelegator.print(msg).then(()=>{
console.log("ACTS_AACommand_print_01_0500 print test end ========> callback " )
})
await sleep(1000);
var finishmsg = 'ACTS_AACommand_print_01_0500 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{
console.log("ACTS_AACommand_print_01_0500 print test end ========> callback " )
......@@ -156,6 +165,7 @@ export default function abilityTest() {
globalThis.abilityDelegator.print(msg).then(()=>{
console.log("ACTS_AACommand_print_01_0600 print test end ========> callback " )
})
await sleep(1000);
var finishmsg = 'ACTS_AACommand_print_01_0600 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{
console.log("ACTS_AACommand_print_01_0600 2 print test end ========> callback " )
......@@ -185,6 +195,7 @@ export default function abilityTest() {
globalThis.abilityDelegator.print(msg).then(()=>{
console.log("ACTS_AACommand_print_01_0700 print test end ========> callback " )
})
await sleep(1000);
var finishmsg = 'ACTS_AACommand_print_01_0700 end'
globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{
console.log("ACTS_AACommand_print_01_0700 2 print test end ========> callback " )
......@@ -220,6 +231,7 @@ export default function abilityTest() {
*/
it('ACTS_AACommand_finish_01_0100', 0, async function (done) {
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146ACTS_AACommand_finish_01_0100'
await sleep(1000);
globalThis.abilityDelegator.finishTest(msg, 1,()=>{
console.log("ACTS_AACommand_finish_01_0100 finishTest test end ========> callback " )
done()
......@@ -275,6 +287,7 @@ export default function abilityTest() {
*/
it('ACTS_AACommand_finish_01_0400', 0, async function (done) {
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
await sleep(1000);
globalThis.abilityDelegator.finishTest(msg, Number.MAX_VALUE,()=>{
console.log("ACTS_AACommand_finish_01_0400 finishTest test end ========> callback " )
done()
......@@ -290,6 +303,7 @@ export default function abilityTest() {
*/
it('ACTS_AACommand_finish_01_0500', 0, async function (done) {
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
await sleep(1000);
globalThis.abilityDelegator.finishTest(msg, Number.MIN_VALUE,()=>{
console.log("ACTS_AACommand_finish_01_0500 finishTest test end ========> callback " )
done()
......@@ -306,6 +320,7 @@ export default function abilityTest() {
it('ACTS_AACommand_finish_01_0600', 0, async function (done) {
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
await sleep(1000);
globalThis.abilityDelegator.finishTest(msg, (Number.MIN_VALUE+1),()=>{
console.log("ACTS_AACommand_finish_01_0600 finishTest test end ========> callback " )
done()
......@@ -321,6 +336,7 @@ export default function abilityTest() {
*/
it('ACTS_AACommand_finish_01_0700', 0, async function (done) {
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
await sleep(1000);
globalThis.abilityDelegator.finishTest(msg, (Number.MIN_VALUE-1),()=>{
console.log("ACTS_AACommand_finish_01_0700 finishTest test end ========> callback " )
done()
......@@ -336,17 +352,12 @@ export default function abilityTest() {
*/
it('ACTS_AACommand_finish_01_0800', 0, async function (done) {
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
setTimeout(() => {
console.log('ACTS_AACommand_finish_01_0800 code:'+JSON.stringify(code))
if(code!=undefined){
expect().assertFail();
}
done();
}, 3000)
var code = globalThis.abilityDelegator.finishTest(msg, 'ABCD',()=>{
globalThis.abilityDelegator.finishTest(msg, 'ABCD',()=>{
console.log(" ACTS_AACommand_finish_01_0800 finishTest test end ========> callback " )
expect().assertFail();
})
await sleep(2000);
done();
})
/**
......@@ -358,6 +369,7 @@ export default function abilityTest() {
*/
it('ACTS_AACommand_finish_01_0900', 0, async function (done) {
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
await sleep(1000);
globalThis.abilityDelegator.finishTest(msg, 1).then(() => {
console.log("ACTS_AACommand_finish_01_0900 finishTest test end ========> callback " )
done()
......@@ -371,15 +383,9 @@ export default function abilityTest() {
* @tc.desc: Verify that the process of the test framework can be stopped by calling this interface.
*/
it('ACTS_AACommand_finish_01_1000', 0, async function (done) {
var code = null
setTimeout(() => {
console.log('ACTS_AACommand_finish_01_1000 code:'+JSON.stringify(code))
if(code!=undefined){
expect().assertFail();
}
done();
}, 3000)
code = globalThis.abilityDelegator.finishTest(null, 1)
globalThis.abilityDelegator.finishTest(null, 1)
await sleep(2000);
done()
})
/**
......@@ -389,15 +395,9 @@ export default function abilityTest() {
* @tc.desc: Verify that the process of the test framework can be stopped by calling this interface.
*/
it('ACTS_AACommand_finish_01_1100', 0, async function (done) {
var code=null
setTimeout(() => {
console.log('ACTS_AACommand_finish_01_1100 code:'+JSON.stringify(code))
if(code!=undefined){
expect().assertFail();
}
done();
}, 3000)
code = globalThis.abilityDelegator.finishTest(undefined, 1)
globalThis.abilityDelegator.finishTest(undefined, 1)
await sleep(2000);
done()
})
/**
......@@ -409,6 +409,7 @@ export default function abilityTest() {
*/
it('ACTS_AACommand_finish_01_1200', 0, async function (done) {
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
await sleep(1000);
globalThis.abilityDelegator.finishTest(msg, Number.MAX_VALUE).then(()=>{
console.log("ACTS_AACommand_finish_01_1200 finishTest test end ========> callback " )
done()
......@@ -424,6 +425,7 @@ export default function abilityTest() {
*/
it('ACTS_AACommand_finish_01_1300', 0, async function (done) {
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
await sleep(1000);
globalThis.abilityDelegator.finishTest(msg, Number.MIN_VALUE).then(()=>{
console.log("ACTS_AACommand_finish_01_1300 finishTest test end ========> callback " )
done()
......@@ -439,6 +441,7 @@ export default function abilityTest() {
*/
it('ACTS_AACommand_finish_01_1400', 0, async function (done) {
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
await sleep(1000);
globalThis.abilityDelegator.finishTest(msg, Number.MIN_VALUE+1).then(()=>{
console.log("ACTS_AACommand_finish_01_1400 finishTest test end ========> callback " )
done()
......@@ -454,6 +457,7 @@ export default function abilityTest() {
*/
it('ACTS_AACommand_finish_01_1500', 0, async function (done) {
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
await sleep(1000);
globalThis.abilityDelegator.finishTest(msg, Number.MIN_VALUE-1).then(()=>{
console.log("ACTS_AACommand_finish_01_1500 finishTest test end ========> callback " )
done()
......
......@@ -6,6 +6,7 @@
"description": "$string:entry_test_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone",
"tablet"
],
......
......@@ -6,6 +6,7 @@
"description": "$string:entry_test_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone",
"tablet"
],
......
......@@ -14,10 +14,299 @@
*/
import Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
async function startAbilityTest(TAG, context) {
let wantInfo = {
bundleName: "com.example.aacommandtest",
abilityName: "MainAbility"
}
await context.startAbility(wantInfo).then((data) => {
console.log(TAG + "startAbility data : " + JSON.stringify(data));
}).catch((err) => {
console.log(TAG + "startAbility err : " + JSON.stringify(err));
})
}
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
async onCreate(want, launchParam) {
globalThis.abilityContext = this.context;
console.log('MainAbility onCreate')
let cmd: any
let abilityDelegatorArguments: any
let abilityDelegator: any
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' +
'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0700 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_finish_01_0700 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_finish_01_0700 stdResult = ' + data.stdResult)
globalThis.stdResult1 = data.stdResult;
console.log('ACTS_AACommand_finish_01_0700 - executeShellCommand: end ')
await startAbilityTest('ACTS_AACommand_finish_01_0700', this.context);
})
await sleep(4000)
cmd = 'aa dump -a'
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err));
console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data));
globalThis.stdResult2 = data["stdResult"];
console.info('ACTS_AACommand_finish_01_0700 end');
})
await sleep(2000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' +
'ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0400 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_finish_01_0400 - executeShellCommand: start ')
console.log('ACTS_AACommand_finish_01_0400 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_finish_01_0400 stdResult = ' + data.stdResult)
globalThis.stdResult11 = data.stdResult;
console.log('ACTS_AACommand_finish_01_0400 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_finish_01_0400', this.context);
})
await sleep(4000)
cmd = 'aa dump -a'
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err));
console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data));
globalThis.stdResult12 = data["stdResult"];
console.info('ACTS_AACommand_finish_01_0700 end');
})
await sleep(2000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' +
'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0100 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_finish_01_0100 - executeShellCommand: start ')
console.log('ACTS_AACommand_finish_01_0100 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_finish_01_0100 stdResult = ' + data.stdResult)
globalThis.stdResult13 = data.stdResult;
console.log('ACTS_AACommand_finish_01_0100 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_finish_01_0100', this.context);
})
await sleep(4000)
cmd = 'aa dump -a'
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err));
console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data));
globalThis.stdResult14 = data["stdResult"];
console.info('ACTS_AACommand_finish_01_0700 end');
})
await sleep(2000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' +
'ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0500 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_finish_01_0500 - executeShellCommand: start ')
console.log('ACTS_AACommand_finish_01_0500 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_finish_01_0500 stdResult = ' + data.stdResult)
globalThis.stdResult15 = data.stdResult;
console.log('ACTS_AACommand_finish_01_0500 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_finish_01_0500', this.context);
})
await sleep(4000)
cmd = 'aa dump -a'
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('ACTS_AACommand_finish_01_0500 : err : ' + JSON.stringify(err));
console.info('ACTS_AACommand_finish_01_0500 : data : ' + JSON.stringify(data));
globalThis.stdResult16 = data["stdResult"];
console.info('ACTS_AACommand_finish_01_0500 end');
})
await sleep(2000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' +
'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0600 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_finish_01_0600 - executeShellCommand: start ')
console.log('ACTS_AACommand_finish_01_0600 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_finish_01_0600 stdResult = ' + data.stdResult)
globalThis.stdResult17 = data.stdResult;
console.log('ACTS_AACommand_finish_01_0600 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_finish_01_0600', this.context);
})
await sleep(4000)
cmd = 'aa dump -a'
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('ACTS_AACommand_finish_01_0600 : err : ' + JSON.stringify(err));
console.info('ACTS_AACommand_finish_01_0600 : data : ' + JSON.stringify(data));
globalThis.stdResult18 = data["stdResult"];
console.info('ACTS_AACommand_finish_01_0600 end');
})
await sleep(2000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' +
'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0900 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_finish_01_0900 - executeShellCommand: start ')
console.log('ACTS_AACommand_finish_01_0900 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_finish_01_0900 stdResult = ' + data.stdResult)
globalThis.stdResult19 = data.stdResult;
console.log('ACTS_AACommand_finish_01_0900 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_finish_01_0900', this.context);
})
await sleep(4000)
cmd = 'aa dump -a'
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('ACTS_AACommand_finish_01_0900 : err : ' + JSON.stringify(err));
console.info('ACTS_AACommand_finish_01_0900 : data : ' + JSON.stringify(data));
globalThis.stdResult20 = data["stdResult"];
console.info('ACTS_AACommand_finish_01_0900 end');
})
await sleep(2000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' +
'-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1300 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_finish_01_1300 - executeShellCommand: start ')
console.log('ACTS_AACommand_finish_01_1300 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_finish_01_1300 stdResult = ' + data.stdResult)
globalThis.stdResult23 = data.stdResult;
console.log('ACTS_AACommand_finish_01_1300 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_finish_01_1300', this.context);
})
await sleep(4000)
cmd = 'aa dump -a'
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('ACTS_AACommand_finish_01_1300 : err : ' + JSON.stringify(err));
console.info('ACTS_AACommand_finish_01_1300 : data : ' + JSON.stringify(data));
globalThis.stdResult24 = data["stdResult"];
console.info('ACTS_AACommand_finish_01_1300 end');
})
await sleep(2000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' +
'-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1400 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_finish_01_1400 - executeShellCommand: start ')
console.log('ACTS_AACommand_finish_01_1400 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_finish_01_1400 stdResult = ' + data.stdResult)
globalThis.stdResult25 = data.stdResult;
console.log('ACTS_AACommand_finish_01_1400 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_finish_01_1400', this.context);
})
await sleep(4000)
cmd = 'aa dump -a'
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('ACTS_AACommand_finish_01_1400 : err : ' + JSON.stringify(err));
console.info('ACTS_AACommand_finish_01_1400 : data : ' + JSON.stringify(data));
globalThis.stdResult26 = data["stdResult"];
console.info('ACTS_AACommand_finish_01_1400 end');
})
await sleep(2000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' +
'-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1500 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_finish_01_1500 - executeShellCommand: start ')
console.log('ACTS_AACommand_finish_01_1500 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_finish_01_1500 stdResult = ' + data.stdResult)
globalThis.stdResult27 = data.stdResult;
console.log('ACTS_AACommand_finish_01_1500 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_finish_01_1500', this.context);
})
await sleep(4000)
cmd = 'aa dump -a'
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('ACTS_AACommand_finish_01_1500 : err : ' + JSON.stringify(err));
console.info('ACTS_AACommand_finish_01_1500 : data : ' + JSON.stringify(data));
globalThis.stdResult28 = data["stdResult"];
console.info('ACTS_AACommand_finish_01_1500 end');
})
await sleep(2000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' +
'-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0300 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_finish_01_0300 - executeShellCommand: start ')
console.log('ACTS_AACommand_finish_01_0300 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_finish_01_0300 stdResult = ' + data.stdResult)
console.log('ACTS_AACommand_finish_01_0300 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_finish_01_0300', this.context);
})
await sleep(3000)
cmd = 'aa dump -a'
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('ACTS_AACommand_finish_01_0300 : err : ' + JSON.stringify(err));
console.info('ACTS_AACommand_finish_01_0300 : data : ' + JSON.stringify(data));
globalThis.stdResult30 = data["stdResult"];
console.info('ACTS_AACommand_finish_01_0300 end');
})
await sleep(2000)
cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap' +
' -s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1600 -s unittest OpenHarmonyTestRunner'
abilityDelegator.executeShellCommand(cmd, async (err, data) => {
console.log('ACTS_AACommand_finish_01_1600 - executeShellCommand: start ')
console.log('ACTS_AACommand_finish_01_1600 start err: ' + JSON.stringify(err))
console.log('ACTS_AACommand_finish_01_1600 stdResult = ' + data.stdResult)
console.log('ACTS_AACommand_finish_01_1600 - executeShellCommand: end')
await startAbilityTest('ACTS_AACommand_finish_01_1600', this.context);
})
await sleep(3000)
cmd = 'aa dump -a'
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('ACTS_AACommand_finish_01_1600 : err : ' + JSON.stringify(err));
console.info('ACTS_AACommand_finish_01_1600 : data : ' + JSON.stringify(data));
globalThis.stdResult34 = data["stdResult"];
console.info('ACTS_AACommand_finish_01_1600 end');
})
setTimeout(() => {
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, 5000)
}
onDestroy() {
......@@ -27,8 +316,6 @@ export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('MainAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'pages/index', null)
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() {
......
......@@ -22,6 +22,24 @@ let finishmsg1: any
export default function abilityTest() {
describe('ACTS_AACommand_Test', function () {
afterEach(async (done) => {
console.log("ActsAACommandTest afterEach called");
let wantInfo = {
bundleName: "com.example.aacommandtest",
abilityName: "MainAbility"
}
await globalThis.abilityContext.startAbility(wantInfo).then((data) => {
console.log("ActsAACommandTest startAbility data : " + JSON.stringify(data));
}).catch((err) => {
console.log("ActsAACommandTest startAbility err : " + JSON.stringify(err));
})
setTimeout(function () {
console.log("ActsAACommandTest afterEach end");
done();
}, 1000);
})
/**
* @tc.number: ACTS_AACommand_0100
* @tc.name: -b, -s unittest, -p, -s class, -s level, -s size, -s testType, -s timeout,
......@@ -202,165 +220,6 @@ export default function abilityTest() {
})
})
/**
* @tc.number: ACTS_AACommand_print_0100
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in AsyncCallback mode. The print 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_print_0100', 0, async function (done) {
console.log("ACTS_AACommand_print_0100 --- start")
msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
expect(globalThis.stdResult3).assertContain(msg);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0200
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in AsyncCallback mode. The length of the print 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_print_0200', 0, async function (done) {
console.log("ACTS_AACommand_print_0200 --- start")
msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
expect(globalThis.stdResult4).assertContain(msg);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0300
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in AsyncCallback mode. The length of the print 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_print_0300', 0, async function (done) {
console.log("ACTS_AACommand_print_0300 --- start")
msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
let msgcopy = 'fffffffffff'
expect(globalThis.stdResult5).assertContain(msg);
expect(globalThis.stdResult5.indexOf(msgcopy) == -1).assertEqual(true);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0400
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in AsyncCallback mode. print 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_print_0400', 0, async function (done) {
console.log("ACTS_AACommand_print_0400 --- start")
msg = 'start ability successfully'
expect(globalThis.stdResult6).assertContain(msg);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0500
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in Promise mode. The print 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_print_0500', 0, async function (done) {
console.log("ACTS_AACommand_print_0500 --- start")
msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
expect(globalThis.stdResult7).assertContain(msg);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0600
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in Promise mode. The length of the print 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_print_0600', 0, async function (done) {
console.log("ACTS_AACommand_print_0600 --- start")
msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae'
expect(globalThis.stdResult8).assertContain(msg);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0700
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in Promise mode. The length of the print 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_print_0700', 0, async function (done) {
console.log("ACTS_AACommand_print_0700 --- start")
msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaa' +
'1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'9aaaaaaaaa'
msgcopy = 'fffffffffff'
expect(globalThis.stdResult9).assertContain(msg);
expect(globalThis.stdResult9.indexOf(msgcopy) == -1).assertEqual(true);
done()
})
/**
* @tc.number: ACTS_AACommand_print_0800
* @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is
* called in Promise mode. print 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_print_0800', 0, async function (done) {
console.log("ACTS_AACommand_print_0800 --- start")
msg = 'start ability successfully'
expect(globalThis.stdResult10).assertContain(msg);
done()
})
/**
* @tc.number: ACTS_AACommand_finishTest_0400
* @tc.name: The parameters of the test command are valid, and the finishTest interface is called in
......@@ -379,7 +238,6 @@ export default function abilityTest() {
})
/**
* @tc.number: ACTS_AACommand_finishTest_0100
* @tc.name: Each parameter of the test command is valid, and the finishTest interface is called
......@@ -398,7 +256,6 @@ export default function abilityTest() {
done()
})
/**
* @tc.number: ACTS_AACommand_finishTest_0500
* @tc.name: The parameters of the test command are valid, and the finishTest
......@@ -437,8 +294,6 @@ export default function abilityTest() {
done()
})
/**
* @tc.number: ACTS_AACommand_finishTest_0900
* @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise
......@@ -456,25 +311,6 @@ export default function abilityTest() {
done()
})
/**
* @tc.number: ACTS_AACommand_finishTest_1200
* @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise
* mode. The msg parameter is valid(including Chinese and special characters) and the code parameter
* is valid (Number.MAX_VALUE)
* @tc.desc: Verify that the process of the test framework can be stopped by calling this interface.
*/
it('ACTS_AACommand_finishTest_1200', 0, async function (done) {
console.log("ACTS_AACommand_finishTest_1200 --- start")
let
finishmsg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
finishmsg1 = 'TestFinished-ResultCode: -1'
expect(globalThis.stdResult21).assertContain(finishmsg);
expect(globalThis.stdResult21).assertContain(finishmsg1);
expect(globalThis.stdResult22.indexOf("com.example.aacommandrelyhap") == -1).assertTrue()
done()
})
/**
* @tc.number: ACTS_AACommand_finishTest_1300
* @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise
......@@ -526,19 +362,6 @@ export default function abilityTest() {
done()
})
/**
* @tc.number: ACTS_AACommand_finishTest_0200
* @tc.name: The parameters of the test command are valid, and the finishTest
* interface is called in AsyncCallback
* mode. The msg parameter is invalid (null) and the code parameter is valid (1)
* @tc.desc: Verify that the process of the test framework can be stopped by calling this interface.
*/
it('ACTS_AACommand_finishTest_0200', 0, async function (done) {
console.log("ACTS_AACommand_finishTest_0200 --- start")
expect(globalThis.stdResult29.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue()
done()
})
/**
* @tc.number: ACTS_AACommand_finishTest_0300
* @tc.name: The parameters of the test command are valid, and the finishTest interface is called in
......@@ -551,43 +374,6 @@ export default function abilityTest() {
done()
})
/**
* @tc.number: ACTS_AACommand_finishTest_0800
* @tc.name: The parameters of the test command are valid, and the finishTest interface is called in
* AsyncCallback
* mode. The msg parameter is invalid(including Chinese and special characters) and the
* code parameter is valid (“ABCD”)
* @tc.desc: Verify that the process of the test framework is not stopped by calling this interface.
*/
it('ACTS_AACommand_finishTest_0800', 0, async function (done) {
console.log("ACTS_AACommand_finishTest_0800 --- start")
expect(globalThis.stdResult31.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue()
done()
})
/**
* @tc.number: ACTS_AACommand_finishTest_1000
* @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise
* mode. The msg parameter is invalid(null) and the code parameter is valid (1)
* @tc.desc: Verify that the process of the test framework can be stopped by calling this interface.
*/
it('ACTS_AACommand_finishTest_1000', 0, async function (done) {
console.log("ACTS_AACommand_finishTest_1000 --- start")
expect(globalThis.stdResult32.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue()
done()
})
/**
* @tc.number: ACTS_AACommand_finishTest_1100
* @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise
* mode. The msg parameter is invalid(undefined) and the code parameter is valid (1)
* @tc.desc: Verify that the process of the test framework can be stopped by calling this interface.
*/
it('ACTS_AACommand_finishTest_1100', 0, async function (done) {
console.log("ACTS_AACommand_finishTest_1100 --- start")
expect(globalThis.stdResult33.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue()
done()
})
/**
* @tc.number: ACTS_AACommand_finishTest_1600
* @tc.name: The parameters of the test command are valid, and the finishTest interface is called in
......
......@@ -6,6 +6,7 @@
"description": "$string:entry_test_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone",
"tablet"
],
......@@ -21,6 +22,7 @@
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"visible": true,
"launchType": "singleton",
"skills": [
{
"entities": [
......
......@@ -19,6 +19,7 @@ group("aacommand") {
deps = [
"AACommand07:AACommand07",
"AACommand08:AACommand08",
"AACommandPrintOneTest:ActsAACommandPrintOneTest",
"AACommandPrintSync:AACommandPrintSync",
"AACommandPrintSyncTest:ActsAACommandPrintSyncTest",
"AACommandRelyHap:AACommandRelyHap",
......
......@@ -19,6 +19,7 @@
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -19,6 +19,7 @@
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -19,6 +19,7 @@
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -19,6 +19,7 @@
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -19,6 +19,7 @@
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -19,6 +19,7 @@
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -19,6 +19,7 @@
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -19,6 +19,7 @@
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -19,6 +19,7 @@
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -19,6 +19,7 @@
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -17,6 +17,7 @@
"package": "com.example.simulateeability",
"name": ".MyApplication",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -17,6 +17,7 @@
"package": "com.example.simulatefabilityfir",
"name": ".MyApplication",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -17,6 +17,7 @@
"package": "com.example.simulatefabilitysed",
"name": ".MyApplication",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -17,6 +17,7 @@
"package": "com.example.verifyaability",
"name": ".MyApplication",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -17,6 +17,7 @@
"package": "com.example.verifyiability",
"name": ".MyApplication",
"deviceType": [
"default",
"phone"
],
"distro": {
......
......@@ -109,7 +109,10 @@ export default function abilityTest() {
data.addAbilityMonitor(
{
abilityName: 'MainAbility2',
onAbilityForeground: onAbilityForeground
onAbilityForeground: onAbilityForeground,
onWindowStageRestore:(Ability)=>{
console.info("===>onWindowStageRestore");
}
}, (async (err) => {
console.debug("====>ACTS_AddAbilityMonitor_0200 success====>" + err.code);
await globalThis.abilitydelegator.startAbility(
......
......@@ -6,6 +6,7 @@
"description": "$string:entry_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone"
],
"deliveryWithInstall": true,
......@@ -58,6 +59,12 @@
"visible": true,
"launchType": "singleton"
}
],
"reqPermissions": [
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone"
],
"deliveryWithInstall": true,
......@@ -74,6 +75,10 @@
{
"name":"ohos.permission.CLEAN_APPLICATION_DATA",
"reason":"need use ohos.permission.CLEAN_APPLICATION_DATA"
},
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
......
......@@ -6,6 +6,7 @@
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone"
],
"deliveryWithInstall": true,
......@@ -74,6 +75,10 @@
{
"name":"ohos.permission.CLEAN_APPLICATION_DATA",
"reason":"need use ohos.permission.CLEAN_APPLICATION_DATA"
},
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
......
......@@ -6,6 +6,7 @@
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone"
],
"deliveryWithInstall": true,
......@@ -74,6 +75,10 @@
{
"name":"ohos.permission.CLEAN_APPLICATION_DATA",
"reason":"need use ohos.permission.CLEAN_APPLICATION_DATA"
},
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
......
......@@ -6,6 +6,7 @@
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone"
],
"deliveryWithInstall": true,
......@@ -114,6 +115,10 @@
{
"name":"ohos.permission.CLEAN_APPLICATION_DATA",
"reason":"need use ohos.permission.CLEAN_APPLICATION_DATA"
},
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
......
......@@ -21,6 +21,7 @@
"package": "com.example.amsabilitymultiinstanceappe",
"name": ".MyApplication",
"deviceType": [
"default",
"phone"
],
"distro": {
......@@ -77,6 +78,10 @@
{
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
],
"js": [
......
......@@ -13,12 +13,23 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
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("AbilityMultiInstanceTest 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() {
......@@ -29,7 +40,7 @@ export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("AbilityMultiInstanceTest onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null)
console.log("AbilityMultiInstanceTest onWindowStageCreate finish")
}
......
......@@ -13,20 +13,11 @@
* 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 {
aboutToAppear(){
let abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
build() {
......
......@@ -91,6 +91,25 @@ async function startAbilityProcess(abilityContext, parameters) {
export default function abilityTest(abilityContext) {
describe('ActsAbilityTest', function () {
let TAG1 = "ACTS_AbilityMultiInstance_Single == ";
afterEach(async (done) => {
console.log(TAG1 + "afterEach called");
let wantInfo = {
bundleName: "com.example.abilitymultiinstance",
abilityName: "com.example.abilitymultiinstance.MainAbility"
}
await abilityContext.startAbility(wantInfo).then((data) => {
console.log(TAG1 + "startAbility data : " + JSON.stringify(data));
}).catch((err) => {
console.log(TAG1 + "startAbility err : " + JSON.stringify(err));
})
setTimeout(function () {
console.log(TAG1 + "afterEach end");
done();
}, 500);
})
/*
* @tc.number: ACTS_AbilityMultiInstance_Multi_0100
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
......
......@@ -6,6 +6,7 @@
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone"
],
"deliveryWithInstall": true,
......@@ -74,6 +75,10 @@
{
"name":"ohos.permission.CLEAN_APPLICATION_DATA",
"reason":"need use ohos.permission.CLEAN_APPLICATION_DATA"
},
{
"name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
......
# 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("abilitystagemonitor") {
testonly = true
if (is_standard_system) {
deps = [
"abilitystagemonitorassista:AbilityStageMonitorAssistA",
"abilitystagemonitorassistc:AbilityStageMonitorAssistC",
"abilitystagemonitorassistd:AbilityStageMonitorAssistD",
"abilitystagemonitorassiste:AbilityStageMonitorAssistE",
"abilitystagemonitorassistf:AbilityStageMonitorAssistF",
"abilitystagemonitorassistg:AbilityStageMonitorAssistG",
"abilitystagemonitorassisth:AbilityStageMonitorAssistH",
"abilitystagemonitortest:ActsAbilityStageMonitorTest",
]
}
}
{
"app": {
"bundleName": "com.example.abilitystagemonitortest",
"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
}
}
}
# 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_assist_suite("AbilityStageMonitorAssistA") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":abilitystagemonitorassista_js_assets",
":abilitystagemonitorassista_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "AbilityStageMonitorAssistA"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("abilitystagemonitorassista_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("abilitystagemonitorassista_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("abilitystagemonitorassista_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":abilitystagemonitorassista_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* 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.info("MyAbilityStageMonitor onCreate")
}
}
\ 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 Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.info('MainAbilityMonitor onCreate')
}
onDestroy() {
console.info('MainAbilityMonitor onDestroy')
}
onWindowStageCreate(windowStage) {
console.info('MainAbilityMonitor onWindowStageCreate')
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null)
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() {
console.info('MainAbilityMonitor onWindowStageDestroy')
}
onForeground() {
console.info('MainAbilityMonitor onForeground')
}
onBackground() {
console.info('MainAbilityMonitor onBackground')
}
};
\ 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.
*/
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('MainAbility index aboutToAppear')
console.info('start run testcase!!!')
}
@State message: string = 'MainAbility Hello'
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
{
"module": {
"name": "feature_assista",
"type": "feature",
"srcEntrance": "./ets/Application/MyAbilityStage.ts",
"description": "$string:entry_test_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"phone",
"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,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_test_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "assista"
},
{
"name": "app_name",
"value": "AACommandtest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.abilitystagemonitortest",
"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
}
}
}
# 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_assist_suite("AbilityStageMonitorAssistC") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":abilitystagemonitorassistc_js_assets",
":abilitystagemonitorassistc_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "AbilityStageMonitorAssistC"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("abilitystagemonitorassistc_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("abilitystagemonitorassistc_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("abilitystagemonitorassistc_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":abilitystagemonitorassistc_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* 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.info("MyAbilityStageMonitor onCreate")
}
}
\ 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 Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.info('MainAbilityMonitor onCreate')
}
onDestroy() {
console.info('MainAbilityMonitor onDestroy')
}
onWindowStageCreate(windowStage) {
console.info('MainAbilityMonitor onWindowStageCreate')
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null)
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() {
console.info('MainAbilityMonitor onWindowStageDestroy')
}
onForeground() {
console.info('MainAbilityMonitor onForeground')
}
onBackground() {
console.info('MainAbilityMonitor onBackground')
}
};
\ 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.
*/
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('MainAbility index aboutToAppear')
console.info('start run testcase!!!')
}
@State message: string = 'MainAbility2 Hello'
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
{
"module": {
"name": "feature_assistc",
"type": "feature",
"srcEntrance": "./ets/Application/MyAbilityStage.ts",
"description": "$string:entry_test_desc",
"mainElement": "MainAbility2",
"deviceTypes": [
"default",
"phone",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility2",
"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
{
"string": [
{
"name": "entry_test_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "assistc"
},
{
"name": "app_name",
"value": "AACommandtest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.abilitystagemonitortest",
"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
}
}
}
# 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_assist_suite("AbilityStageMonitorAssistD") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":abilitystagemonitorassistd_js_assets",
":abilitystagemonitorassistd_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "AbilityStageMonitorAssistD"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("abilitystagemonitorassistd_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("abilitystagemonitorassistd_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("abilitystagemonitorassistd_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":abilitystagemonitorassistd_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* 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.info("MyAbilityStageMonitor onCreate")
}
}
\ 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 Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.info('MainAbilityMonitor onCreate')
}
onDestroy() {
console.info('MainAbilityMonitor onDestroy')
}
onWindowStageCreate(windowStage) {
console.info('MainAbilityMonitor onWindowStageCreate')
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null)
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() {
console.info('MainAbilityMonitor onWindowStageDestroy')
}
onForeground() {
console.info('MainAbilityMonitor onForeground')
}
onBackground() {
console.info('MainAbilityMonitor onBackground')
}
};
\ 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.
*/
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('MainAbility index aboutToAppear')
console.info('start run testcase!!!')
}
@State message: string = 'MainAbility3 Hello'
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
{
"module": {
"name": "feature_assistd",
"type": "feature",
"srcEntrance": "./ets/Application/MyAbilityStage.ts",
"description": "$string:entry_test_desc",
"mainElement": "MainAbility3",
"deviceTypes": [
"default",
"phone",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "MainAbility3",
"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
{
"string": [
{
"name": "entry_test_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "assistd"
},
{
"name": "app_name",
"value": "AACommandtest"
},
{
"name": "description_application",
"value": "demo for test"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.abilitystagemonitortest",
"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
}
}
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册