From 22fa92849d0ad9f88aea02cfdf322dc3eaab866f Mon Sep 17 00:00:00 2001 From: chengxingzhen Date: Thu, 29 Sep 2022 20:01:09 +0800 Subject: [PATCH] =?UTF-8?q?xts=E5=A4=B1=E8=B4=A5=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chengxingzhen --- .../src/main/ets/test/GetFormsInfoFuzz.test.ets | 12 ++++++------ .../entry/src/main/ets/test/ReleaseFormFuzz.test.ets | 8 ++++---- .../ets/test/SetFormNextRefreshTimeFuzz.test.ets | 4 ++-- .../entry/src/main/ets/test/getParam.ets | 6 +++--- .../entry/src/main/ets/test/FmsStress.test.ets | 2 +- .../src/main/ets/test/FmsUpdateRefreshForm.test.ets | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/GetFormsInfoFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/GetFormsInfoFuzz.test.ets index 7870950c2..c8d058de5 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/GetFormsInfoFuzz.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/GetFormsInfoFuzz.test.ets @@ -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 { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/ReleaseFormFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/ReleaseFormFuzz.test.ets index 0dc146dba..a5c4ddfe7 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/ReleaseFormFuzz.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/ReleaseFormFuzz.test.ets @@ -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 { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/SetFormNextRefreshTimeFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/SetFormNextRefreshTimeFuzz.test.ets index 4d030380a..70c2eb0ca 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/SetFormNextRefreshTimeFuzz.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/SetFormNextRefreshTimeFuzz.test.ets @@ -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) { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/getParam.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/getParam.ets index 440f7aaa9..f4cf08212 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/getParam.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/getParam.ets @@ -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]); } diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/test/FmsStress.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/test/FmsStress.test.ets index 4c1f78b33..371a11680 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/test/FmsStress.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/test/FmsStress.test.ets @@ -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) => { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/test/FmsUpdateRefreshForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/test/FmsUpdateRefreshForm.test.ets index 2e1c9c888..9d84b65ca 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/test/FmsUpdateRefreshForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/test/FmsUpdateRefreshForm.test.ets @@ -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 -- GitLab