提交 22fa9284 编写于 作者: C chengxingzhen

xts失败用例适配

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