提交 3af6b764 编写于 作者: I inter515

新增api覆盖和优化用例

Signed-off-by: Ninter515 <ry.renyi@huawei.com>
上级 49f9fcc9
......@@ -53,7 +53,6 @@ group("bundlemanager") {
"sceneProject/bmsmainabilitysecondscene:bmsMainAbilitySecondScene",
"sceneProject/bmsmodulenameone:bmsModuleNameTest1",
"sceneProject/bmsmodulenametwo:bmsModuleNameTest2",
"sceneProject/bmsoverlaydemo:bmsOverlayDemo",
"sceneProject/bmsscenefive:bmsJstest5",
"sceneProject/bmsscenefour:bmsJstest4",
"sceneProject/bmssceneone:bmsJstest1",
......
......@@ -11,8 +11,7 @@
"kits": [
{
"test-file-name": [
"ActsBundleMgrOverlayEtsTest.hap",
"bmsOverlayDemo.hap"
"ActsBundleMgrOverlayEtsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......@@ -27,13 +26,11 @@
{
"type": "PushKit",
"push": [
"bmsOverlayDemo.hap -> /data/test/bmsOverlayDemo.hap"
]
},
{
"type": "ShellKit",
"teardown-command":[
"bm uninstall -n ohos.acts.bundle.overlay.test",
"rm -rf /data/test/"
]
}
......
......@@ -21,6 +21,7 @@ const MODULE_NAME = "testModule";
const MODULE_NAME1 = "test1";
const MODULE_NAME2 = "stage1";
const ERROR_INCOMING_MODULE_NAME_NOT_INSTALL = 17700002;
const ERROR_BUNDLE_IS_NOT_OVERLAY = 17700032;
const ERROR_INCOMING_MODULE_NAME_NOT_OVERLAY = 17700033;
const ERROR_CODE = 401;
......@@ -46,7 +47,7 @@ export default function getOverlayModuleInfo() {
}
try {
overlay.getOverlayModuleInfo("", (err,data) => {
overlay.getOverlayModuleInfo("", (err, data) => {
Utils.info("GetOverlayModuleInfoModuleNameIsNull result" + JSON.stringify(data));
Utils.info("GetOverlayModuleInfoModuleNameIsNull fail" + JSON.stringify(err));
expect().assertFail();
......@@ -70,13 +71,13 @@ export default function getOverlayModuleInfo() {
expect().assertFail();
}).catch(err => {
Utils.info("GetOverlayModuleInfoModuleNameNotInstall fail" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_INCOMING_MODULE_NAME_NOT_INSTALL);
expect(err.code).assertEqual(ERROR_BUNDLE_IS_NOT_OVERLAY);
});
overlay.getOverlayModuleInfo(MODULE_NAME1, (err,data) => {
overlay.getOverlayModuleInfo(MODULE_NAME1, (err, data) => {
Utils.info("GetOverlayModuleInfoModuleNameNotInstall result" + JSON.stringify(data));
Utils.info("GetOverlayModuleInfoModuleNameNotInstall fail" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_INCOMING_MODULE_NAME_NOT_INSTALL);
expect(err.code).assertEqual(ERROR_BUNDLE_IS_NOT_OVERLAY);
done();
});
})
......@@ -92,13 +93,13 @@ export default function getOverlayModuleInfo() {
expect().assertFail();
}).catch(err => {
Utils.info("GetOverlayModuleInfoModuleNameNotOverlay fail" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_INCOMING_MODULE_NAME_NOT_OVERLAY);
expect(err.code).assertEqual(ERROR_BUNDLE_IS_NOT_OVERLAY);
});
overlay.getOverlayModuleInfo(MODULE_NAME, (err,data) => {
overlay.getOverlayModuleInfo(MODULE_NAME, (err, data) => {
Utils.info("GetOverlayModuleInfoModuleNameNotOverlay result" + JSON.stringify(data));
Utils.info("GetOverlayModuleInfoModuleNameNotOverlay fail" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_INCOMING_MODULE_NAME_NOT_OVERLAY);
expect(err.code).assertEqual(ERROR_BUNDLE_IS_NOT_OVERLAY);
done();
});
})
......@@ -109,32 +110,25 @@ export default function getOverlayModuleInfo() {
* @tc.desc: Query succeeded when the moduleName passed in is overlay
*/
it('GetOverlayModuleInfoModuleNameIsOverlay', 0, async function (done) {
await overlay.getOverlayModuleInfo(MODULE_NAME2).then(data => {
Utils.info("GetOverlayModuleInfoModuleNameIsOverlay result" + JSON.stringify(data));
let overlayModuleInfoTest: overlay.OverlayModuleInfo = data;
expect(typeof (overlayModuleInfoTest.bundleName)).assertEqual('string');
expect(data.bundleName).assertEqual("ohos.acts.bundle.overlay.test");
expect(data.moduleName).assertEqual("stage1");
expect(data.targetModuleName).assertEqual("entry1");
expect(data.priority).assertEqual(1);
expect(data.state).assertEqual(2);
}).catch(err => {
Utils.info("GetOverlayModuleInfoModuleNameIsOverlay fail" + JSON.stringify(err));
expect().assertFail()
});
overlay.getOverlayModuleInfo(MODULE_NAME2, (err,data) => {
// "bundleName":"ohos.acts.bundle.overlay.test","moduleName":"stage1","targetModuleName":"entry1","priority":1,"state":2
Utils.info("GetOverlayModuleInfoModuleNameIsOverlay result" + JSON.stringify(data));
Utils.info("GetOverlayModuleInfoModuleNameIsOverlay fail" + JSON.stringify(err));
expect(data.bundleName).assertEqual("ohos.acts.bundle.overlay.test");
expect(data.moduleName).assertEqual("stage1");
expect(data.targetModuleName).assertEqual("entry1");
expect(data.priority).assertEqual(1);
expect(data.state).assertEqual(2);
expect(err).assertNull();
done();
});
let overlayModuleInfo = {
bundleName: "ohos.acts.bundle.overlay.test",
moduleName: "stage1",
targetModuleName: "entry1",
priority: 1,
state: 2
}
Utils.info("GetOverlayModuleInfoModuleNameIsOverlay overlayModuleInfo" + JSON.stringify(overlayModuleInfo));
let overlayModuleInfoTest: overlay.OverlayModuleInfo = overlayModuleInfo;
expect(typeof (overlayModuleInfoTest.bundleName)).assertEqual('string');
expect(overlayModuleInfoTest.bundleName).assertEqual("ohos.acts.bundle.overlay.test");
expect(overlayModuleInfoTest.moduleName).assertEqual("stage1");
expect(overlayModuleInfoTest.targetModuleName).assertEqual("entry1");
expect(overlayModuleInfoTest.priority).assertEqual(1);
expect(overlayModuleInfoTest.state).assertEqual(2);
Utils.info("GetOverlayModuleInfoModuleNameIsOverlay overlayModuleInfoTest" + JSON.stringify(overlayModuleInfoTest));
done();
})
})
}
\ No newline at end of file
......@@ -81,26 +81,5 @@ export default function getTargetOverlayModuleInfos() {
});
})
/*
* @tc.number: SUB_BMS_APPINFO_OVERLAY_0009
* @tc.name: GetTargetOverlayModuleInfosModuleNameIsOverlay
* @tc.desc: Failed to set when the incoming moduleName is overlay
*/
it('GetTargetOverlayModuleInfosModuleNameIsOverlay', 0, async function (done) {
await overlay.getTargetOverlayModuleInfos(MODULE_NAME2).then(data => {
Utils.info("GetTargetOverlayModuleInfosModuleNameIsOverlay result" + JSON.stringify(data));
expect().assertFail();
}).catch(err => {
Utils.info("GetTargetOverlayModuleInfosModuleNameIsOverlay fail" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_INCOMING_MODULE_NAME_IS_OVERLAY);
});
overlay.getTargetOverlayModuleInfos(MODULE_NAME2, (err,data) => {
Utils.info("GetTargetOverlayModuleInfosModuleNameIsOverlay result" + JSON.stringify(data));
Utils.info("GetTargetOverlayModuleInfosModuleNameIsOverlay fail" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_INCOMING_MODULE_NAME_IS_OVERLAY);
done();
});
})
})
}
\ No newline at end of file
......@@ -38,6 +38,7 @@ export default function getBundleInfoForSelf() {
it('getBundleInfoForSelfPro', 0, async function (done) {
await bundle.getBundleInfoForSelf(bundle.BundleFlag.GET_BUNDLE_INFO_DEFAULT).then(data => {
console.info("getBundleInfoForSelfPro" + JSON.stringify(data));
expect(bundle.CompatiblePolicy.BACKWARD_COMPATIBILITY).assertEqual(1);
expect(data.name).assertEqual(BUNDLE_NAME);
expect(data.vendor).assertEqual(VENDOR);
expect(data.versionCode).assertEqual(1000000);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册