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

!5922 【包管理子系统 master】新增xts用例

Merge pull request !5922 from ry/master
......@@ -170,7 +170,7 @@ export default function actsBmsJsUnPermissionTest() {
* @tc.name: getAbilityInfoUnPermissionSelf
* @tc.desc: test getAbilityInfo
*/
it('getAbilityInfo_200', 0, async function (done) {
it('getAbilityInfoUnPermissionSelf', 0, async function (done) {
await bundle.getAbilityInfo(SELF_BUNDLENAME, SELF_ABILITYNAME).then(res => {
console.info('actwsBundleManager getAbilityInfo promise success res:' + JSON.stringify(res));
for (const item in res) {
......
......@@ -4,7 +4,7 @@
"type": "OHJSUnitTest",
"test-timeout": "180000",
"bundle-name": "ohos.acts.bundle.stage.test",
"module-name": "phone",
"module-name": "entry",
"shell-timeout": "600000",
"testcase-timeout": 70000
},
......
......@@ -16,7 +16,7 @@
import bundle from '@ohos.bundle';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
const MODULE_NAME = "phone"
const MODULE_NAME = "entry"
const MODULE_NAME_TEST = "phone1"
const ABILITY_NAME = "ohos.acts.bundle.stage.test.MainAbility"
const ABILITY_NAME1 = "ohos.acts.bundle.stage.test.MainAbility1"
......
......@@ -16,7 +16,7 @@
import bundle from '@ohos.bundle';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
const MODULE_NAME = "phone"
const MODULE_NAME = "entry"
const MODULE_NAME_TEST = "phone1"
const ABILITY_NAME = "Form"
const ABILITY_NAME1 = "Form1"
......
{
"module": {
"name": "phone",
"name": "entry",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc",
......
......@@ -288,6 +288,42 @@ export default function getAllApplicationBundleTest() {
});
});
/**
* @tc.number: SUB_BMS_APPINFO_QUERY_0060
* @tc.name: getAllApplicationInfoNoMetaData
* @tc.desc: Check the return value of the interface
*/
it('getAllApplicationInfoNoMetaData', 0, async function (done) {
await Bundle.getAllApplicationInfo(DEFAULT_FLAG,userId).then((data) => {
expect(data.length).assertLarger(10);
let flag = 0;
for(let i in data){
if (data[i].name == BUNDLE_OTHER){
flag = 1;
getAllApplicationInfoSuccessOther(data[i]);
expect(JSON.stringify(data[i].metaData)).assertEqual("{}");
}
}
expect(flag).assertEqual(1);
}).catch((error) => {
expect(error).assertFail();
});
Bundle.getAllApplicationInfo(DEFAULT_FLAG,userId, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.length).assertLarger(10);
let flag = 0;
for(let i in data){
if (data[i].name == BUNDLE_OTHER){
flag = 1;
getAllApplicationInfoSuccessOther(data[i]);
expect(JSON.stringify(data[i].metaData)).assertEqual("{}");
}
}
expect(flag).assertEqual(1);
done();
});
});
function expectData(msg, data) {
console.info(msg + 'commonTest data length [' + data.length + ']');
for (let i = 0; i < data.length; i++) {
......@@ -393,6 +429,39 @@ export default function getAllApplicationBundleTest() {
console.info('check end');
}
function getAllApplicationInfoSuccessOther(data) {
expect(data.name).assertEqual(BUNDLE_OTHER);
expect(data.codePath).assertEqual(PATH + '/' + BUNDLE_OTHER);
expect(data.accessTokenId).assertLarger(0);
expect(data.description).assertEqual('$string:entry_description');
expect(data.descriptionId).assertLarger(0);
expect(data.icon).assertEqual('$media:icon');
expect(data.iconId).assertLarger(0);
expect(data.iconIndex).assertLarger(0);
expect(data.iconIndex).assertEqual(data.iconId);
expect(data.label).assertEqual('$string:app_name');
expect(data.labelId).assertLarger(0);
expect(data.labelIndex).assertLarger(0);
expect(data.labelIndex).assertEqual(data.labelId);
expect(data.systemApp).assertFalse();
expect(data.supportedModes).assertEqual(0);
expect(data.process).assertEqual(BUNDLE_OTHER);
expect(data.entryDir).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(data.permissions.length).assertEqual(0);
expect(data.moduleSourceDirs.length).assertEqual(1);
expect(data.moduleSourceDirs[0]).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(data.moduleInfos.length).assertEqual(1);
expect(data.moduleInfos[0].moduleName).assertEqual('entry');
expect(data.moduleInfos[0].moduleSourceDir).assertEqual(PATH + '/' +
BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(data.enabled).assertTrue();
expect(data.uid).assertLarger(0);
expect(data.entityType).assertEqual('unspecified');
expect(data.removable).assertTrue();
expect(data.fingerprint).assertEqual("");
console.info('check end');
}
});
}
\ No newline at end of file
......@@ -422,6 +422,46 @@ export default function applicationBundleJsunit() {
});
})
/**
* @tc.number: SUB_BMS_APPINFO_QUERY_0059
* @tc.name: getApplicationInfoNoMetaData
* @tc.desc: Check the return value of the interface
*/
it('getApplicationInfoNoMetaData', 0, async function (done) {
await Bundle.getApplicationInfo(BUNDLE_OTHER, FLAG_DEFAULT ,userId).then((data) => {
getApplicationInfoSuccessOther_METADATA(data);
expect(JSON.stringify(data.metaData)).assertEqual("{}");
expect(JSON.stringify(data.metadata)).assertEqual("{}");
}).catch((error) => {
expect(error).assertFail();
});
Bundle.getApplicationInfo(BUNDLE_OTHER, FLAG_DEFAULT,userId, (err, data) => {
expect(err.code).assertEqual(0);
getApplicationInfoSuccessOther_METADATA(data);
expect(JSON.stringify(data.metaData)).assertEqual("{}");
expect(JSON.stringify(data.metadata)).assertEqual("{}");
done();
});
});
/**
* @tc.number: SUB_BMS_APPINFO_QUERY_0005
* @tc.name: getApplicationInfoNotExistBundleName
* @tc.desc: Check the return value of the interface
*/
it('getApplicationInfoNotExistBundleName', 0, async function (done) {
await Bundle.getApplicationInfo(BUNDLE_NOTEXIST, FLAG_DEFAULT, userId).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error.code).assertEqual(1);
});
await Bundle.getApplicationInfo(BUNDLE_NOTEXIST, FLAG_DEFAULT, userId, (err, data) => {
expect(err.code).assertEqual(1);
expect(JSON.stringify(data)).assertEqual(undefined);
done();
});
});
function expectData(msg, data) {
expect(typeof (data)).assertEqual('object');
expect(typeof (data.name)).assertEqual('string');
......@@ -554,6 +594,38 @@ export default function applicationBundleJsunit() {
console.info('check end');
}
});
function getApplicationInfoSuccessOther_METADATA(data) {
expect(data.name).assertEqual(BUNDLE_OTHER);
expect(data.codePath).assertEqual(PATH + '/' + BUNDLE_OTHER);
expect(data.accessTokenId).assertLarger(0);
expect(data.description).assertEqual('$string:entry_description');
expect(data.descriptionId).assertLarger(0);
expect(data.icon).assertEqual('$media:icon');
expect(data.iconId).assertLarger(0);
expect(data.iconIndex).assertLarger(0);
expect(data.iconIndex).assertEqual(data.iconId);
expect(data.label).assertEqual('$string:app_name');
expect(data.labelId).assertLarger(0);
expect(data.labelIndex).assertLarger(0);
expect(data.labelIndex).assertEqual(data.labelId);
expect(data.systemApp).assertFalse();
expect(data.supportedModes).assertEqual(0);
expect(data.process).assertEqual(BUNDLE_OTHER);
expect(data.entryDir).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(data.permissions.length).assertEqual(0);
expect(data.moduleSourceDirs.length).assertEqual(1);
expect(data.moduleSourceDirs[0]).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(data.moduleInfos.length).assertEqual(1);
expect(data.moduleInfos[0].moduleName).assertEqual('entry');
expect(data.moduleInfos[0].moduleSourceDir).assertEqual(PATH + '/' +
BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry');
expect(data.enabled).assertTrue();
expect(data.uid).assertLarger(0);
expect(data.entityType).assertEqual('unspecified');
expect(data.removable).assertTrue();
expect(data.fingerprint).assertEqual("");
console.info('check end');
}
});
}
\ No newline at end of file
......@@ -909,7 +909,7 @@
"type": "pageAbility"
},
"pages": [
"pages/index"
"pages/index/index"
],
"name": ".MainAbility",
"window": {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册