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

新增api覆盖和优化用例

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