未验证 提交 751c0807 编写于 作者: O openharmony_ci 提交者: Gitee

!9874 [新需求]: 同步接口补充xts用例

Merge pull request !9874 from junyi233/myfeature
......@@ -31,6 +31,7 @@ const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainA
const ERROR_ABILITY_NOT_EXIST = 17700003
const ERROR_PROFILE_NOT_EXIST = 17700024
const ERROR_MODULE_NOT_EXIST = 17700002
const PARAM_ERROR_CODE = 401;
export default function getProfileByAbility() {
describe('getProfileByAbility', function () {
......@@ -419,5 +420,161 @@ export default function getProfileByAbility() {
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0047
* @tc.name: getProfileByAbilitySyncSuccess
* @tc.desc: profile is json (by sync)
* @tc.level 0
*/
it('getProfileByAbilitySyncSuccess', 0, async function (done) {
try {
let data = manager.getProfileByAbilitySync(MODULE_NAME, ABILITY_NAME, METADATA_NAME);
console.info("getProfileByAbilitySync success" + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(1);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
done();
} catch (err) {
console.info("getProfileByAbilitySyncSuccessTest failed" + JSON.stringify(err));
expect(err).assertFail();
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0048
* @tc.name: getProfileByAbilitySyncSuccessEmptyMetaData
* @tc.desc: profile is json (by sync)
* @tc.level 0
*/
it('getProfileByAbilitySyncSuccessEmptyMetaData', 0, async function (done) {
try {
let data = manager.getProfileByAbilitySync(MODULE_NAME, ABILITY_NAME, '');
console.info("getProfileByAbilitySyncSuccessEmptyMetaData success" + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(3);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[2]).assertEqual("string");
expect(data[2]).assertEqual(PROFILE_JSON_STRING);
done();
} catch (err) {
console.info("getProfileByAbilitySyncSuccessEmptyMetaData failed" + JSON.stringify(err));
expect(err).assertFail();
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0049
* @tc.name: getProfileByAbilitySyncByEmptyModuleName
* @tc.desc: Check the empty moduleName (by sync)
* @tc.level 0
*/
it('getProfileByAbilitySyncByEmptyModuleName', 0, async function (done) {
try {
manager.getProfileByAbilitySync('', ABILITY_NAME, METADATA_NAME);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByAbilitySyncByEmptyModuleName failed" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_MODULE_NOT_EXIST);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0050
* @tc.name: getProfileByAbilitySyncByEmptyModuleName
* @tc.desc: Check the invalid moduleName (by sync)
* @tc.level 0
*/
it('getProfileByAbilitySyncByInvalidModuleName', 0, async function (done) {
try {
manager.getProfileByAbilitySync('INVALID_NAME', ABILITY_NAME, METADATA_NAME);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByAbilitySyncByInvalidModuleName failed" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0051
* @tc.name: getProfileByAbilitySyncByEmptyAbilityName
* @tc.desc: Check the empty abilityName (by sync)
* @tc.level 0
*/
it('getProfileByAbilitySyncByEmptyAbilityName', 0, async function (done) {
try {
manager.getProfileByAbilitySync(MODULE_NAME_TEST, '', METADATA_NAME);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByAbilitySyncByEmptyAbilityName failed" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0052
* @tc.name: getProfileByAbilitySyncByEmptyAbilityName
* @tc.desc: Check the invalid abilityName (by sync)
* @tc.level 0
*/
it('getProfileByAbilitySyncByInvalidAbilityName', 0, async function (done) {
try {
manager.getProfileByAbilitySync(MODULE_NAME_TEST, 'INVALID_NAME', METADATA_NAME);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByAbilitySyncByInvalidAbilityName failed" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0053
* @tc.name: getProfileByAbilitySyncNoProfile
* @tc.desc: Check resource has no prefix (by sync)
* @tc.level 0
*/
it('getProfileByAbilitySyncNoProfile', 0, async function (done) {
try {
manager.getProfileByAbilitySync(MODULE_NAME, ABILITY_NAME, METADATA_NAME2);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByAbilitySyncNoProfile failed" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0054
* @tc.name: getProfileByAbilitySyncParamError
* @tc.desc: Check param number is failed (by sync)
* @tc.level 0
*/
it('getProfileByAbilitySyncParamError', 0, async function (done) {
try {
manager.getProfileByAbilitySync(null, null);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByAbilitySyncParamError failed" + JSON.stringify(err));
expect(err.code).assertEqual(PARAM_ERROR_CODE);
done();
}
})
})
}
\ No newline at end of file
......@@ -31,6 +31,7 @@ const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainA
const ERROR_ABILITY_NOT_EXIST = 17700003
const ERROR_PROFILE_NOT_EXIST = 17700024
const ERROR_MODULE_NOT_EXIST = 17700002
const PARAM_ERROR_CODE = 401;
export default function getProfileByExtensionAbility() {
describe('getProfileByExtensionAbility', function () {
......@@ -420,5 +421,160 @@ export default function getProfileByExtensionAbility() {
done();
});
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0047
* @tc.name: getProfileByExtensionAbilitySyncSuccess
* @tc.desc: profile is json (by sync)
* @tc.level 0
*/
it('getProfileByExtensionAbilitySyncSuccess', 0, async function (done) {
try {
let data = manager.getProfileByExtensionAbilitySync(MODULE_NAME, ABILITY_NAME, METADATA_NAME3);
console.info("getProfileByExtensionAbilitySync success" + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(1);
expect(typeof data[0]).assertEqual("string");
done();
} catch (err) {
console.info("getProfileByExtensionAbilitySyncSuccessTest failed" + JSON.stringify(err));
expect(err).assertFail();
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0048
* @tc.name: getProfileByExtensionAbilitySyncSuccessEmptyMetaData
* @tc.desc: Check the empty metadataName
* @tc.level 0
*/
it('getProfileByExtensionAbilitySyncSuccessEmptyMetaData', 0, async function (done) {
try {
let data = manager.getProfileByExtensionAbilitySync(MODULE_NAME, ABILITY_NAME, '');
console.info("getProfileByExtensionAbilitySyncSuccessEmptyMetaData success" + JSON.stringify(data));
expect(Array.isArray(data)).assertTrue();
expect(data.length).assertEqual(3);
expect(typeof data[0]).assertEqual("string");
expect(data[0]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[1]).assertEqual("string");
expect(data[1]).assertEqual(PROFILE_JSON_STRING);
expect(typeof data[2]).assertEqual("string");
expect(data[2]).assertEqual(PROFILE_JSON_STRING);
done();
} catch (err) {
console.info("getProfileByExtensionAbilitySyncSuccessEmptyMetaData failed" + JSON.stringify(err));
expect(err).assertFail();
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0049
* @tc.name: getProfileByExtensionAbilitySyncByEmptyModuleName
* @tc.desc: Check the empty moduleName (by sync)
* @tc.level 0
*/
it('getProfileByExtensionAbilitySyncByEmptyModuleName', 0, async function (done) {
try {
manager.getProfileByExtensionAbilitySync('', ABILITY_NAME, METADATA_NAME);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByExtensionAbilitySyncByEmptyModuleName failed" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_MODULE_NOT_EXIST);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0050
* @tc.name: getProfileByExtensionAbilitySyncByEmptyModuleName
* @tc.desc: Check the invalid moduleName (by sync)
* @tc.level 0
*/
it('getProfileByExtensionAbilitySyncByInvalidModuleName', 0, async function (done) {
try {
manager.getProfileByExtensionAbilitySync('INVALID_NAME', ABILITY_NAME, METADATA_NAME);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByExtensionAbilitySyncByInvalidModuleName failed" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0051
* @tc.name: getProfileByExtensionAbilitySyncByEmptyAbilityName
* @tc.desc: Check the empty abilityName (by sync)
* @tc.level 0
*/
it('getProfileByExtensionAbilitySyncByEmptyAbilityName', 0, async function (done) {
try {
manager.getProfileByExtensionAbilitySync(MODULE_NAME_TEST, '', METADATA_NAME);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByExtensionAbilitySyncByEmptyAbilityName failed" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0052
* @tc.name: getProfileByExtensionAbilitySyncByEmptyAbilityName
* @tc.desc: Check the invalid abilityName (by sync)
* @tc.level 0
*/
it('getProfileByExtensionAbilitySyncByInvalidAbilityName', 0, async function (done) {
try {
manager.getProfileByExtensionAbilitySync(MODULE_NAME_TEST, 'INVALID_NAME', METADATA_NAME);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByExtensionAbilitySyncByInvalidAbilityName failed" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_ABILITY_NOT_EXIST);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0053
* @tc.name: getProfileByExtensionAbilitySyncNoProfile
* @tc.desc: Check resource has no prefix (by sync)
* @tc.level 0
*/
it('getProfileByExtensionAbilitySyncNoProfile', 0, async function (done) {
try {
manager.getProfileByExtensionAbilitySync(MODULE_NAME, ABILITY_NAME, METADATA_NAME2);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByExtensionAbilitySyncNoProfile failed" + JSON.stringify(err));
expect(err.code).assertEqual(ERROR_PROFILE_NOT_EXIST);
done();
}
})
/*
* @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0054
* @tc.name: getProfileByExtensionAbilitySyncParamError
* @tc.desc: Check param number is failed (by sync)
* @tc.level 0
*/
it('getProfileByExtensionAbilitySyncParamError', 0, async function (done) {
try {
manager.getProfileByExtensionAbilitySync(null, null);
expect().assertFail();
done();
} catch (err) {
console.info("getProfileByExtensionAbilitySyncParamError failed" + JSON.stringify(err));
expect(err.code).assertEqual(PARAM_ERROR_CODE);
done();
}
})
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册