Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2eab72b8
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
2eab72b8
编写于
6月 09, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3503 移植getBundleArchiveInfo接口的测试套
Merge pull request !3503 from ry/master
上级
405451a0
2a13534e
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
363 addition
and
2 deletion
+363
-2
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/Test.json
...standard/bundlemanager/actsbundlemanageretstest/Test.json
+19
-2
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets
...undlemanageretstest/entry/src/main/ets/test/List.test.ets
+2
-0
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getBundleArchiveInfo.test.ets
...est/entry/src/main/ets/test/getBundleArchiveInfo.test.ets
+342
-0
未找到文件。
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/Test.json
浏览文件 @
2eab72b8
...
...
@@ -29,7 +29,13 @@
"first_right.hap -> /data/test/first_right.hap"
,
"second_right.hap -> /data/second_right.hap"
,
"bmsStageDemo1.hap -> /data/test/bmsStageDemo1.hap"
,
"bmsStageDemo2.hap -> /data/test/bmsStageDemo2.hap"
"bmsStageDemo2.hap -> /data/test/bmsStageDemo2.hap"
,
"bmsJstest1.hap -> /data/test/bmsJstest1.hap"
,
"bmsJstest2.hap -> /data/test/bmsJstest2.hap"
,
"bmsJstest3.hap -> /data/test/bmsJstest3.hap"
,
"bmsJstest4.hap -> /data/test/bmsJstest4.hap"
,
"bmsJstest5.hap -> /data/test/bmsJstest5.hap"
,
"bmsJstest6.hap -> /data/test/bmsJstest6.hap"
]
},
{
...
...
@@ -39,11 +45,22 @@
"bm install -p /data/test/first_right.hap"
,
"bm install -p /data/second_right.hap"
,
"bm install -p /data/test/bmsStageDemo1.hap"
,
"bm install -p /data/test/bmsStageDemo2.hap"
"bm install -p /data/test/bmsStageDemo2.hap"
,
"bm install -p /data/test/bmsJstest1.hap"
,
"bm install -p /data/test/bmsJstest2.hap"
,
"bm install -p /data/test/bmsJstest3.hap"
,
"bm install -p /data/test/bmsJstest4.hap"
,
"bm install -p /data/test/bmsJstest5.hap"
,
"bm install -p /data/test/bmsJstest6.hap"
],
"teardown-command"
:[
"bm uninstall -n com.example.third1"
,
"bm uninstall -n com.example.l3jsdemo"
,
"bm uninstall -n com.example.myapplication1"
,
"bm uninstall -n com.example.myapplication2"
,
"bm uninstall -n com.example.myapplication4"
,
"bm uninstall -n com.example.myapplication5"
,
"bm uninstall -n com.example.myapplication6"
,
"bm uninstall -n ohos.acts.bundle.stage"
]
}
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets
浏览文件 @
2eab72b8
...
...
@@ -22,8 +22,10 @@ import isApplicationEnabledETSUnit from "./IsApplicationEnabledETSUnit.ets";
import getAbilityIcon from "./GetAbilityIcon.test.ets";
import getNameForUid from "./GetNameForUid.test.ets";
import queryExtensionAbilityInfos from "./QueryExtensionAbilityInfos.test.ets";
import getBundleArchiveInfo from "./getBundleArchiveInfo.test.ets";
export default function testsuite() {
getBundleArchiveInfo();
queryExtensionAbilityInfos();
getAbilityIcon();
getLaunchWantForBundle();
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getBundleArchiveInfo.test.ets
0 → 100644
浏览文件 @
2eab72b8
/**
* 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 bundle from '@ohos.bundle';
import { describe, beforeAll, it, expect } from 'hypium/index';
const PATH = "/data/test/"
const ERROR = "error.hap"
const BMSJSTEST1 = "bmsJstest1.hap"
const BMSJSTEST2 = "bmsJstest2.hap"
const BMSJSTEST3 = "bmsJstest3.hap"
const BMSJSTEST4 = "bmsJstest4.hap"
const BMSJSTEST5 = "bmsJstest5.hap"
const BMSJSTEST6 = "bmsJstest6.hap"
const NAME1 = "com.example.myapplication1"
const NAME2 = "com.example.myapplication2"
const NAME3 = "com.example.myapplication4"
const NAME4 = "com.example.myapplication5"
const NAME5 = "com.example.myapplication6"
const DESCRIPTION = "$string:mainability_description"
export default function getBundleArchiveInfo() {
describe('getBundleArchiveInfo', function () {
/**
* @tc.number getBundleArchiveInfo_0100
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with one hap.
*/
it('getBundleArchiveInfo_0100', 0, async function (done) {
let datainfo = await bundle.getBundleArchiveInfo(PATH + BMSJSTEST1, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES)
expect(datainfo.name).assertEqual(NAME1)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
done();
})
/**
* @tc.number getBundleArchiveInfo_0200
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with two haps.
*/
it('getBundleArchiveInfo_0200', 0, async function (done) {
let datainfo = await bundle.getBundleArchiveInfo(PATH + BMSJSTEST2, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES)
expect(datainfo.name).assertEqual(NAME2)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
done();
})
/**
* @tc.number getBundleArchiveInfo_0300
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with three haps.
*/
it('getBundleArchiveInfo_0300', 0, async function (done) {
let datainfo = await bundle.getBundleArchiveInfo(PATH + BMSJSTEST4, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES)
expect(datainfo.name).assertEqual(NAME3)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
done();
})
/**
* @tc.number getBundleArchiveInfo_0400
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with error hap.
*/
it('getBundleArchiveInfo_0400', 0, async function (done) {
await bundle.getBundleArchiveInfo(PATH + ERROR, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES).then(datainfo => {
console.info("getBundleArchiveInfo success" + JSON.stringify(datainfo))
expect(datainfo).assertFail()
done()
}).catch(err => {
console.info("getBundleArchiveInfo fail" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/**
* @tc.number getBundleArchiveInfo_0500
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with none hap.
*/
it('getBundleArchiveInfo_0500', 0, async function (done) {
let datainfo = await bundle.getBundleArchiveInfo(' ', bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES).then(datainfo => {
console.info("getBundleArchiveInfo success" + JSON.stringify(datainfo))
expect(datainfo).assertFail()
done()
}).catch(err => {
console.info("getBundleArchiveInfo fail" + JSON.stringify(err))
expect(err).assertEqual(1)
done()
})
})
/**
* @tc.number getBundleArchiveInfo_0600
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with none hap.
*/
it('getBundleArchiveInfo_0600', 0, async function (done) {
await bundle.getBundleArchiveInfo(PATH + BMSJSTEST1, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name).assertEqual(NAME1)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual("1.0")
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.name).assertEqual(NAME1)
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
expect(datainfo.appInfo.supportedModes).assertEqual(0)
for (let j = 0; j < datainfo.appInfo.moduleInfos.length; j++) {
expect(datainfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry")
}
for (let j = 0; j < datainfo.abilityInfos.length; j++) {
expect(datainfo.abilityInfos[j].name).assertEqual("com.example.myapplication1.MainAbility")
expect(datainfo.abilityInfos[j].label).assertEqual("$string:app_name")
expect(datainfo.abilityInfos[j].description).assertEqual(DESCRIPTION)
expect(datainfo.abilityInfos[j].icon).assertEqual("$media:icon")
expect(datainfo.abilityInfos[j].isVisible).assertEqual(false)
expect(datainfo.abilityInfos[j].bundleName).assertEqual(NAME1)
expect(datainfo.abilityInfos[j].moduleName).assertEqual("entry")
}
done();
}
})
/**
* @tc.number getBundleArchiveInfo_0700
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with two hap.
*/
it('getBundleArchiveInfo_0700', 0, async function (done) {
await bundle.getBundleArchiveInfo(PATH + BMSJSTEST2, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name).assertEqual(NAME2)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
done();
}
})
/**
* @tc.number getBundleArchiveInfo_0800
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with one hap.
*/
it('getBundleArchiveInfo_0800', 0, async function (done) {
await bundle.getBundleArchiveInfo(PATH + BMSJSTEST4, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name).assertEqual(NAME3)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertLarger(0)
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
done();
}
})
/**
* @tc.number getBundleArchiveInfo_0900
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with error hap.
*/
it('getBundleArchiveInfo_0900', 0, async function (done) {
await bundle.getBundleArchiveInfo(PATH + ERROR, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
if (err) {
console.info("getBundleArchiveInfo error" + JSON.stringify(err));
expect(err).assertEqual(1);
done();
return;
}
console.info("getBundleArchiveInfo sucess" + JSON.stringify(datainfo));
expect(datainfo).assertFail();
done();
}
})
/**
* @tc.number getBundleArchiveInfo_1000
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with none hap.
*/
it('getBundleArchiveInfo_1000', 0, async function (done) {
await bundle.getBundleArchiveInfo(' ', bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
if (err) {
console.info("getBundleArchiveInfo error" + JSON.stringify(err));
expect(err).assertEqual(1);
done();
return;
}
console.info("getBundleArchiveInfo sucess" + JSON.stringify(datainfo));
expect(datainfo).assertFail();
done();
}
})
/**
* @tc.number getBundleArchiveInfo_1100
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with none hap.
*/
it('getBundleArchiveInfo_1100', 0, async function (done) {
await bundle.getBundleArchiveInfo(PATH + BMSJSTEST1, bundle.BundleFlag.GET_BUNDLE_DEFAULT, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name).assertEqual(NAME1)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual("1.0")
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.name).assertEqual(NAME1)
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
expect(datainfo.appInfo.supportedModes).assertEqual(0)
for (let j = 0; j < datainfo.appInfo.moduleInfos.length; j++) {
expect(datainfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry")
}
for (let j = 0; j < datainfo.abilityInfos.length; j++) {
expect(datainfo.abilityInfos[j].name).assertEqual(".MainAbility")
expect(datainfo.abilityInfos[j].label).assertEqual("$string:app_name")
expect(datainfo.abilityInfos[j].description).assertEqual(DESCRIPTION)
expect(datainfo.abilityInfos[j].icon).assertEqual("$media:icon")
expect(datainfo.abilityInfos[j].isVisible).assertEqual(false)
expect(datainfo.abilityInfos[j].bundleName).assertEqual(NAME1)
expect(datainfo.abilityInfos[j].moduleName).assertEqual("entry")
}
done();
}
})
/**
* @tc.number getBundleArchiveInfo_1200
* @tc.name BUNDLE::getBundleArchiveInfo
* @tc.desc Test getBundleArchiveInfo interfaces with none hap.
*/
it('getBundleArchiveInfo_1200', 0, async function (done) {
await bundle.getBundleArchiveInfo(PATH + BMSJSTEST1, bundle.BundleFlag.GET_BUNDLE_DEFAULT, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
expect(datainfo.name).assertEqual(NAME1)
expect(datainfo.vendor).assertEqual("example")
expect(datainfo.versionCode).assertEqual(1)
expect(datainfo.versionName).assertEqual("1.0")
expect(datainfo.entryModuleName).assertEqual("entry")
expect(datainfo.appInfo.name).assertEqual(NAME1)
expect(datainfo.appInfo.description).assertEqual(DESCRIPTION)
expect(datainfo.appInfo.descriptionId >= 0).assertTrue()
expect(datainfo.appInfo.icon).assertEqual("$media:icon")
expect(datainfo.appInfo.iconId >= 0).assertTrue()
expect(datainfo.appInfo.label).assertEqual("$string:app_name")
expect(datainfo.appInfo.labelId >= 0).assertTrue()
expect(datainfo.appInfo.systemApp).assertEqual(false)
expect(datainfo.appInfo.supportedModes).assertEqual(0)
for (let j = 0; j < datainfo.appInfo.moduleInfos.length; j++) {
expect(datainfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry")
}
for (let j = 0; j < datainfo.abilityInfos.length; j++) {
expect(datainfo.abilityInfos[j].name).assertEqual(".MainAbility")
expect(datainfo.abilityInfos[j].label).assertEqual("$string:app_name")
expect(datainfo.abilityInfos[j].description).assertEqual(DESCRIPTION)
expect(datainfo.abilityInfos[j].icon).assertEqual("$media:icon")
expect(datainfo.abilityInfos[j].isVisible).assertEqual(false)
expect(datainfo.abilityInfos[j].bundleName).assertEqual(NAME1)
expect(datainfo.abilityInfos[j].moduleName).assertEqual("entry")
}
done();
}
})
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录