提交 597387d5 编写于 作者: C chengxingzhen

xts失败用例适配

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 f25f19fd
......@@ -43,7 +43,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => {
formHost.getFormsInfo(bundleName, (error, data) => {
console.log(`FMS_fuzzTest_getinfobundle ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`);
expect(data).assertUndefined();
if (`STRING` === dataType) {
if (`string` === typeof bundleName) {
expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE);
expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED);
} else {
......@@ -79,7 +79,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => {
expect().assertFail();
} catch (error) {
console.log(`FMS_fuzzTest_getinfobundle ${tcNumber} exception caught: ${JSON.stringify(error)}`);
if (`STRING` === dataType) {
if (`string` === typeof bundleName) {
expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE);
expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED);
} else {
......@@ -108,7 +108,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => {
formHost.getFormsInfo(bundleName, moduleName, (error, data) => {
console.log(`${callbackName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`);
expect(data).assertUndefined();
if (`STRING` === dataType) {
if (`string` === typeof bundleName) {
expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE);
expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED);
} else {
......@@ -146,7 +146,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => {
expect().assertFail();
} catch (error) {
console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`);
if (`STRING` === dataType) {
if (`string` === typeof bundleName) {
expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE);
expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED);
} else {
......@@ -175,7 +175,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => {
formHost.getFormsInfo(bundleName, moduleName, (error, data) => {
console.log(`${callbackName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`);
expect(data).assertUndefined();
if (`STRING` === dataType) {
if (`string` === typeof moduleName) {
expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE);
expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED);
} else {
......@@ -212,7 +212,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => {
expect().assertFail();
} catch (error) {
console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`);
if (`STRING` === dataType) {
if (`string` === typeof moduleName) {
expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE);
expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED);
} else {
......
......@@ -76,7 +76,7 @@ export const releaseFormFuzzTest = (describeName, filterParameter) => {
expect().assertFail();
} catch (error) {
console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`);
if (`STRING` === dataType) {
if (`string` === typeof formId) {
expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE);
expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM);
} else {
......@@ -137,7 +137,7 @@ export const releaseFormFuzzTest = (describeName, filterParameter) => {
expect().assertFail();
} catch (error) {
console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`);
if (`STRING` === dataType) {
if (`string` === typeof formId) {
expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE);
expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM);
} else {
......@@ -166,7 +166,7 @@ export const releaseFormFuzzTest = (describeName, filterParameter) => {
formHost.releaseForm(formId, isReleaseCache, (error, data) => {
console.log(`${callbackName} ${tcNumber} releaseForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`);
expect(data).assertUndefined();
if (`BOOLEAN` === dataType) {
if (`boolean` === typeof isReleaseCache) {
expect(error.code).assertEqual(ERR_NOT_EXIST_ID_CODE);
expect(error.message).assertEqual(ERR_NOT_EXIST_ID);
} else {
......@@ -203,7 +203,7 @@ export const releaseFormFuzzTest = (describeName, filterParameter) => {
expect().assertFail();
} catch (error) {
console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`);
if (`BOOLEAN` === dataType) {
if (`boolean` === typeof isReleaseCache) {
expect(error.code).assertEqual(ERR_NOT_EXIST_ID_CODE);
expect(error.message).assertEqual(ERR_NOT_EXIST_ID);
} else {
......
......@@ -104,7 +104,7 @@ export const setFormNextRefreshTimeFuzzTest = (describeName, filterParameter) =>
formProvider.setFormNextRefreshTime(formId, nextTime, (error, data) => {
console.log(`${callbackName} ${tcNumber} setFormNextRefreshTime data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`);
expect(data).assertUndefined();
if (`NUMBER` === dataType) {
if (`number` === typeof nextTime) {
if (ERR_NOT_EXIST_ID_CODE === error.code) {
expect(error.message).assertEqual(ERR_NOT_EXIST_ID);
} else if (ERR_ADD_INVALID_PARAM_CODE === error.code) {
......@@ -147,7 +147,7 @@ export const setFormNextRefreshTimeFuzzTest = (describeName, filterParameter) =>
expect().assertFail();
} catch (error) {
console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`);
if (`NUMBER` === dataType) {
if (`number` === typeof nextTime) {
if (ERR_NOT_EXIST_ID_CODE === error.code) {
expect(error.message).assertEqual(ERR_NOT_EXIST_ID);
} else if (ERR_ADD_INVALID_PARAM_CODE === error.code) {
......
......@@ -149,9 +149,9 @@ const getFuzzData = (datatype: string) => {
switch (datatype) {
case 'ARRAY':
let array1 = arrayTest();
let array2 = array1.join("")
if (isNaN(Number(array2))) {
return array1;
let array2 = array1
if (isNaN(Number(array1.join("")))) {
return array2;
} else {
getFuzzData(DATA_TYPE_LIST[0]);
}
......
......@@ -68,7 +68,6 @@ export default function test() {
commonEvent.unsubscribe(onDeletedEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onDeletedEventSubscriber"));
commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onAcquiredEventSubscriber"));
commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onSupplyEventSubscriber"));
await sleep(1000);
await featureAbility.startAbility({
want: {
bundleName: "com.ohos.st.formstresstest",
......@@ -79,6 +78,7 @@ export default function test() {
}).catch((err) => {
console.log("FmsStressTest startAbility err: " + JSON.stringify(err));
})
await sleep(2000);
})
const subscribeDeletedEvent = (tcNumber, expectedDeletedFormAmount, done) => {
......
......@@ -65,7 +65,6 @@ export default function test() {
commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeCallback("afterEach unsubscribe subscriberOnDeleted"));
commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeCallback("afterEach unsubscribe subscriberOnRefresh"));
commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeCallback("afterEach unsubscribe subscriberOnRequest"));
await sleep(1000);
await featureAbility.startAbility({
want: {
bundleName: "com.ohos.st.formupdaterefreshtest",
......@@ -76,6 +75,7 @@ export default function test() {
}).catch((err) => {
console.log("FmsUpdateRefreshFormTest startAbility err: " + JSON.stringify(err));
})
await sleep(2000);
})
/**
* @tc.number: FMS_updateForm_0100
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册