diff --git a/telephony/telephonyjstest/BUILD.gn b/telephony/telephonyjstest/BUILD.gn index 05e4514069e113b165c52f6efdb5507d8e2d7e16..a14ed6ac0f863efd1f595fa8d165e0b0fb0b28ce 100644 --- a/telephony/telephonyjstest/BUILD.gn +++ b/telephony/telephonyjstest/BUILD.gn @@ -21,7 +21,7 @@ group("telephonyjstest") { "netmanager_socket:ActsNetManagerSocketEtsTest", "network_search:network_search", "observer:ActsObserverEtsTest", - "radiostatistic:ActsRadiostatisticEtsTest", + "radiostatistic:ActsRadioStatisticEtsTest", "sim:sim", "sms_mms:sms_mms", ] diff --git a/telephony/telephonyjstest/netmanager_http/BUILD.gn b/telephony/telephonyjstest/netmanager_http/BUILD.gn index cacdd6f056e5d863db4c3f8bd7ba7e27d9565e6d..8b9be1eba6521ac2cc8c90c17cec28619e486bff 100644 --- a/telephony/telephonyjstest/netmanager_http/BUILD.gn +++ b/telephony/telephonyjstest/netmanager_http/BUILD.gn @@ -18,7 +18,6 @@ ohos_js_hap_suite("ActsNetManagerHttpEtsTest") { deps = [ ":ace_demo_ets_assets", ":ace_demo_ets_resources", - ":ace_demo_ets_test_assets", ] ets2abc = true certificate_profile = "./signature/openharmony_sx.p7b" @@ -27,9 +26,6 @@ ohos_js_hap_suite("ActsNetManagerHttpEtsTest") { ohos_js_assets("ace_demo_ets_assets") { source_dir = "./entry/src/main/ets/MainAbility" } -ohos_js_assets("ace_demo_ets_test_assets") { - source_dir = "./entry/src/main/ets/TestAbility" -} ohos_resources("ace_demo_ets_resources") { sources = [ "./entry/src/main/resources" ] hap_profile = "./entry/src/main/config.json" diff --git a/telephony/telephonyjstest/netmanager_http/Test.json b/telephony/telephonyjstest/netmanager_http/Test.json index fd9f01ded62f554def5d2b71e2f51dff4832d8dc..7ba53b9d615459230f20de31dccee5246c80c2fc 100644 --- a/telephony/telephonyjstest/netmanager_http/Test.json +++ b/telephony/telephonyjstest/netmanager_http/Test.json @@ -1,11 +1,10 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "OHJSUnitTest", - "test-timeout": "1800000", - "bundle-name": "com.ohos.netmanagerhttp", - "package-name": "com.ohos.netmanagerhttp", - "shell-timeout": "1800000" + "type": "JSUnitTest", + "test-timeout": "1500000", + "package": "com.ohos.netmanagerhttp", + "shell-timeout": "60000" }, "kits": [ { diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/config.json b/telephony/telephonyjstest/netmanager_http/entry/src/main/config.json index fec1ff61c25698868e79bab4381765daf10cc95d..295ac996e7daf3a571f51fbd416d04c9b72fe206 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/config.json @@ -17,7 +17,7 @@ "package": "com.ohos.netmanagerhttp", "name": ".MyApplication", "mainAbility": ".MainAbility", - "srcPath": "", + "srcPath": "MainAbility", "deviceType": [ "phone" ], @@ -50,19 +50,6 @@ "label": "$string:entry_MainAbility", "type": "page", "launchType": "standard" - }, - { - "orientation": "unspecified", - "visible": true, - "srcPath": "TestAbility", - "name": ".TestAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:TestAbility_desc", - "formsEnabled": false, - "label": "$string:TestAbility_label", - "type": "page", - "launchType": "standard" } ], "reqPermissions": [ @@ -146,20 +133,6 @@ "designWidth": 720, "autoDesignWidth": false } - }, - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } } ] } diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/pages/index.ets index 987f3a954fdecfaede4540d18cb97a080cb2a826..10359134da915c9b44b0836ba4881bca71f43f33 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/pages/index.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/pages/index.ets @@ -13,11 +13,39 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import file from '@system.file'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; +import testsuite from "../test/List.test.ets"; +import featureAbility from "@ohos.ability.featureAbility"; @Entry @Component struct MyComponent { aboutToAppear() { + console.info("start run testcase!!!!") + featureAbility.getWant() + .then((Want) => { + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + Want.parameters['timeout'] = 100000 + console.info('parameters---->' + JSON.stringify(Want.parameters)); + configService.setConfig(Want.parameters); + testsuite(); + core.execute(); + console.info('Operation successful. Data: ' + JSON.stringify(Want)); + }) + .catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); + }) } build() { diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpJsunit.test.ets similarity index 94% rename from telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets rename to telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpJsunit.test.ets index 5153d2fdf445004a2d017b7c1975ac93c1738cf2..4cbee959711b9f5ee298339f27a86dc791d8ee19 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpJsunit.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the 'License') * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, afterAll, it, expect, afterEach} from 'hypium/index'; +import {describe, beforeAll, afterAll, it, expect, afterEach} from 'deccjsunit/index'; import http from '@ohos.net.http'; export default function httpJsunit() { diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpRequestJsunit.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpRequestJsunit.test.ets rename to telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestJsunit.test.ets index 2bfd70ad1da3ba015c5b24fe52c5892bf3cbfc43..2f58bd9fa6aca98f5f55fe918be936abb4856944 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpRequestJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestJsunit.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the 'License') * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, afterAll, it, expect, afterEach} from 'deccjsunit/index.ets'; +import {describe, beforeAll, afterAll, it, expect, afterEach} from 'deccjsunit/index'; import http from '@ohos.net.http'; import utils from './Utils.ets' diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpRequestOptionsJsunit.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestOptionsJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpRequestOptionsJsunit.test.ets rename to telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestOptionsJsunit.test.ets index 81f59847cfba73e4235c7f099a51cb5034fc1da5..a35a947730b8ba449b29f3a7320f85f9860e0e0f 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpRequestOptionsJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpRequestOptionsJsunit.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the 'License') * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, afterAll, it, expect, afterEach} from 'hypium/index'; +import {describe, beforeAll, afterAll, it, expect, afterEach} from 'deccjsunit/index'; import http from '@ohos.net.http'; import utils from './Utils.ets' diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpResponseJsunit.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpResponseJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpResponseJsunit.test.ets rename to telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpResponseJsunit.test.ets index c7a2ac9190c2e7bb0777101acfeb76697af6c397..ff827296b55e97fdd908a2ee83bbb9cdd24bdfcb 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpResponseJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/HttpResponseJsunit.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the 'License') * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, afterAll, it, expect, afterEach} from 'hypium/index'; +import {describe, beforeAll, afterAll, it, expect, afterEach} from 'deccjsunit/index'; import http from '@ohos.net.http'; import utils from './Utils.ets' diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/List.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/List.test.ets similarity index 73% rename from telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/List.test.ets rename to telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/List.test.ets index 34a0f9c29ffae557e1aae1a16e19a7e2c327057c..0901b051f906dba36f22b9c89fb210b29d87174d 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/List.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/List.test.ets @@ -14,12 +14,12 @@ */ //other import -import httpJsunit from './HttpJsunit.test.ets' -import responseCodeJsunit from './ResponseCodeJsunit.test.ets'; -import requestMethodJsunit from './RequestMethodJsunit.test.ets'; -import httpResponseJsunit from './HttpResponseJsunit.test.ets'; -import HttpRequestOptionsJsunit from './HttpRequestOptionsJsunit.test.ets'; -import httpRequestJsunit from './HttpRequestJsunit.test.ets'; +import httpJsunit from './HttpJsunit.test' +import responseCodeJsunit from './ResponseCodeJsunit.test'; +import requestMethodJsunit from './RequestMethodJsunit.test'; +import httpResponseJsunit from './HttpResponseJsunit.test'; +import HttpRequestOptionsJsunit from './HttpRequestOptionsJsunit.test'; +import httpRequestJsunit from './HttpRequestJsunit.test'; export default function testsuite() { //other diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/RequestMethodJsunit.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/RequestMethodJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/RequestMethodJsunit.test.ets rename to telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/RequestMethodJsunit.test.ets index 0b4bbda16686e084ed0fa2901cd061322500c4c2..7df7bd96efe0f0ff48bd5c10edd9e10ec1355a46 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/RequestMethodJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/RequestMethodJsunit.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the 'License') * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, afterAll, it, expect, afterEach} from 'hypium/index'; +import {describe, beforeAll, afterAll, it, expect, afterEach} from 'deccjsunit/index'; import http from '@ohos.net.http'; import utils from './Utils.ets' diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/ResponseCodeJsunit.test.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/ResponseCodeJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/ResponseCodeJsunit.test.ets rename to telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/ResponseCodeJsunit.test.ets index bf9701cf5d31e9e29b12dae4988060c61a9fea0a..23ef89283f39e57bb4b122588ecf277aecf5e60f 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/ResponseCodeJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/ResponseCodeJsunit.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the 'License') * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, afterAll, it, expect, afterEach} from 'hypium/index'; +import {describe, beforeAll, afterAll, it, expect, afterEach} from 'deccjsunit/index'; import http from '@ohos.net.http'; export default function responseCodeJsunit() { diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/Utils.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/Utils.ets similarity index 100% rename from telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/Utils.ets rename to telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/Utils.ets diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/lib/Const.js b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/lib/Const.js similarity index 100% rename from telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/lib/Const.js rename to telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/test/lib/Const.js diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestAbility/app.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestAbility/app.ets deleted file mode 100644 index 1405dd359f629939894b86e2b285cb2cc1b37aa6..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestAbility/app.ets +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestAbility/pages/index.ets b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestAbility/pages/index.ets deleted file mode 100644 index 52663437cb619d4598126cf403d3689cb31ba131..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestAbility/pages/index.ets +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import router from '@system.router'; - -@Entry -@Component -struct Index { - aboutToAppear() { - console.info('TestAbility index aboutToAppear') - } - - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 14e78a653e030645860bcc3e7eb6c600b098127b..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import TestRunner from '@ohos.application.testRunner' -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -function translateParamsToString(parameters) { - const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s itName', - '-s level', '-s testType', '-s size', '-s timeout', - '-s package' - ]) - let targetParams = ''; - for (const key in parameters) { - if (keySet.has(key)) { - targetParams += ' ' + key + ' ' + parameters[key] - } - } - return targetParams.trim() -} - -async function onAbilityCreateCallback() { - console.log('onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - console.info('OpenHarmonyTestRunner OnPrepare') - } - - onRun() { - console.log('OpenHarmonyTestRunner onRun run') - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName - cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) - console.info('cmd : '+cmd) - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + d.stdResult); - console.info('executeShellCommand : data : ' + d.exitCode); - }) - console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') - var context = abilityDelegator.getAppContext() - console.info('getAppContext : ' + JSON.stringify(context)) - console.info('OpenHarmonyTestRunner onRun end') - } -}; \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_http/entry/src/main/resources/base/element/string.json index 498677efbde065c36668727190d3613cbf278bfc..03b8532c53ca563f8ed6b1e21d20ad3f67a68906 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/resources/base/element/string.json +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/resources/base/element/string.json @@ -7,14 +7,6 @@ { "name": "description_mainability", "value": "ETS_Empty Ability" - }, - { - "name": "TestAbility_desc", - "value": "description" - }, - { - "name": "TestAbility_label", - "value": "label" } ] } \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_socket/BUILD.gn b/telephony/telephonyjstest/netmanager_socket/BUILD.gn index aede1e1c6bb6e1c0f3310fd978c9cb49366475b2..60f5120fd5adf0dd502a56cd5c500b048bdbc124 100644 --- a/telephony/telephonyjstest/netmanager_socket/BUILD.gn +++ b/telephony/telephonyjstest/netmanager_socket/BUILD.gn @@ -18,7 +18,6 @@ ohos_js_hap_suite("ActsNetManagerSocketEtsTest") { deps = [ ":ace_demo_ets_assets", ":ace_demo_ets_resources", - ":ace_demo_ets_test_assets", ] ets2abc = true certificate_profile = "./signature/openharmony_sx.p7b" @@ -27,9 +26,6 @@ ohos_js_hap_suite("ActsNetManagerSocketEtsTest") { ohos_js_assets("ace_demo_ets_assets") { source_dir = "./entry/src/main/ets/MainAbility" } -ohos_js_assets("ace_demo_ets_test_assets") { - source_dir = "./entry/src/main/ets/TestAbility" -} ohos_resources("ace_demo_ets_resources") { sources = [ "./entry/src/main/resources" ] hap_profile = "./entry/src/main/config.json" diff --git a/telephony/telephonyjstest/netmanager_socket/Test.json b/telephony/telephonyjstest/netmanager_socket/Test.json index 1db5390ee0102302596cb8533b96c5430e11882b..6e0020bea14d86e86641b63228ee4add9005ea91 100644 --- a/telephony/telephonyjstest/netmanager_socket/Test.json +++ b/telephony/telephonyjstest/netmanager_socket/Test.json @@ -1,11 +1,10 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "OHJSUnitTest", - "test-timeout": "1800000", - "bundle-name": "com.ohos.netmanagersocket", - "package-name": "com.ohos.netmanagersocket", - "shell-timeout": "1800000" + "type": "JSUnitTest", + "test-timeout": "1500000", + "package": "com.ohos.netmanagersocket", + "shell-timeout": "60000" }, "kits": [ { diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/config.json b/telephony/telephonyjstest/netmanager_socket/entry/src/main/config.json index b9b207c75d1c389668e0cbfc900f8771927accc6..52694233d1df26520de72eeae862ee3d4d2f8d62 100644 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/config.json @@ -17,7 +17,7 @@ "package": "com.ohos.netmanagersocket", "name": ".MyApplication", "mainAbility": ".MainAbility", - "srcPath": "", + "srcPath": "MainAbility", "deviceType": [ "phone" ], @@ -50,19 +50,6 @@ "label": "$string:entry_MainAbility", "type": "page", "launchType": "standard" - }, - { - "orientation": "unspecified", - "visible": true, - "srcPath": "TestAbility", - "name": ".TestAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:TestAbility_desc", - "formsEnabled": false, - "label": "$string:TestAbility_label", - "type": "page", - "launchType": "standard" } ], "reqPermissions": [ @@ -146,20 +133,6 @@ "designWidth": 720, "autoDesignWidth": false } - }, - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } } ] } diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/pages/index.ets index 987f3a954fdecfaede4540d18cb97a080cb2a826..10359134da915c9b44b0836ba4881bca71f43f33 100644 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/pages/index.ets +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/pages/index.ets @@ -13,11 +13,39 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import file from '@system.file'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; +import testsuite from "../test/List.test.ets"; +import featureAbility from "@ohos.ability.featureAbility"; @Entry @Component struct MyComponent { aboutToAppear() { + console.info("start run testcase!!!!") + featureAbility.getWant() + .then((Want) => { + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + Want.parameters['timeout'] = 100000 + console.info('parameters---->' + JSON.stringify(Want.parameters)); + configService.setConfig(Want.parameters); + testsuite(); + core.execute(); + console.info('Operation successful. Data: ' + JSON.stringify(Want)); + }) + .catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); + }) } build() { diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionJsunit.test.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/ConnectionJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionJsunit.test.ets rename to telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/ConnectionJsunit.test.ets index 352f0486c426973f34b967ee40bf097ec375557d..2c68819315942bb6a20792c8bc2c6a4d474187ca 100644 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/ConnectionJsunit.test.ets @@ -1,6 +1,6 @@ // @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, it, expect} from 'hypium/index'; +import {describe, it, expect} from 'deccjsunit/index'; import connection from '@ohos.net.connection' import utils from './Utils.ets' diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionSecondJsUnit.test.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/ConnectionSecondJsUnit.test.ets similarity index 99% rename from telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionSecondJsUnit.test.ets rename to telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/ConnectionSecondJsUnit.test.ets index 075c303e460a6aff7d95f0e2905866ff2b3f910d..98fdbb3281d6e801d7388cd885d3f52ff06693f3 100644 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionSecondJsUnit.test.ets +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/ConnectionSecondJsUnit.test.ets @@ -1,6 +1,6 @@ // @ts-nocheck /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the 'License') * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,7 +14,7 @@ * limitations under the License. */ import connection from '@ohos.net.connection'; -import {describe, it, expect} from 'hypium/index'; +import {describe, it, expect} from 'deccjsunit/index'; import utils from './Utils.ets' export default function connectionSecondJsUnit() { diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/List.test.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/List.test.ets similarity index 100% rename from telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/List.test.ets rename to telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/List.test.ets diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/SocketJsunit.test.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/SocketJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/SocketJsunit.test.ets rename to telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/SocketJsunit.test.ets index 9742dbddd6887f76b0fea47c89b23f62f2539311..bb4a2e588b96aa6d4f8878ee82ce5be95cfac5a3 100644 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/SocketJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/SocketJsunit.test.ets @@ -1,6 +1,6 @@ // @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,7 +14,7 @@ * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; import socket from '@ohos.net.socket' import utils from './Utils.ets' @@ -655,7 +655,7 @@ export default function socketJsunit() { broadcast: true } try{ - udp.setExtraOptions(udpExtraOptions, funtion(error,data) { + udp.setExtraOptions(udpExtraOptions, function(error,data) { if (error) { expect().assertFail(); console.log(`${caseName} error, case failed,error: ` + JSON.stringify(error)); @@ -901,10 +901,11 @@ export default function socketJsunit() { it('Telephony_Socket_UDPSocket_off_error_0100', 0, function (done) { console.log("************* Telephony_Socket_UDPSocket_off_error_0100 Test start*************"); let caseName = "Telephony_Socket_UDPSocket_off_error_0100" - udp.off("error", error => { - console.log(`${caseName} fail, error:${toString(error)}`); - expect().assertFail(); - }); + let callback = err =>{ + console.log(caseName +" on error, err:" + JSON.stringify(err)); + } + udp.on('error', callback); + udp.off('error', callback); expect(true).assertTrue(); console.log("************* Telephony_Socket_UDPSocket_off_error_0100 Test end*************"); done(); @@ -1611,10 +1612,11 @@ export default function socketJsunit() { it('Telephony_Socket_TCPSocket_off_error_0100', 0, function (done) { console.log("************* Telephony_Socket_TCPSocket_off_error_0100 Test start*************"); let caseName = "Telephony_Socket_TCPSocket_off_error_0100" - tcp.off("error", error => { - console.log(`${caseName} fail, error:${toString(error)}`); - expect().assertFail(); - }); + let callback = err =>{ + console.log(caseName +" on error, err:" + JSON.stringify(err)); + } + tcp.on('error', callback); + tcp.off('error', callback); expect(true).assertTrue(); console.log("************* Telephony_Socket_TCPSocket_off_error_0100 Test end*************"); done(); diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/Utils.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/Utils.ets similarity index 100% rename from telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/Utils.ets rename to telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/Utils.ets diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/WebSocketJsunit.test.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/WebSocketJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/WebSocketJsunit.test.ets rename to telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/WebSocketJsunit.test.ets index 9b5155a775d82e84e5338fcdcc8b47fdcc364dee..a10ec712a5634cbc39917f0a02c7824943fcfd0e 100644 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/WebSocketJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/WebSocketJsunit.test.ets @@ -1,6 +1,5 @@ -// @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,7 +13,7 @@ * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; import webSocket from '@ohos.net.webSocket' import utils from './Utils.ets' diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/lib/Const.js b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/lib/Const.js similarity index 100% rename from telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/lib/Const.js rename to telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/test/lib/Const.js diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestAbility/app.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestAbility/app.ets deleted file mode 100644 index ee5488c7f63a09a5e51b3820ed2132ca259efae0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestAbility/app.ets +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/*import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test'*/ - -export default { - onCreate() { - console.info('TestApplication onCreate') - /*var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)*/ - }, - onDestroy() { - console.info('TestApplication onDestroy') - }, -} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestAbility/pages/index.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestAbility/pages/index.ets deleted file mode 100644 index 5a0f0beb5b3007c2498e3baf1e576af29b211d0f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestAbility/pages/index.ets +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import router from '@system.router'; -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../../test/List.test' - -@Entry -@Component -struct Index { - aboutToAppear() { - console.info('TestAbility index aboutToAppear') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 14e78a653e030645860bcc3e7eb6c600b098127b..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import TestRunner from '@ohos.application.testRunner' -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -function translateParamsToString(parameters) { - const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s itName', - '-s level', '-s testType', '-s size', '-s timeout', - '-s package' - ]) - let targetParams = ''; - for (const key in parameters) { - if (keySet.has(key)) { - targetParams += ' ' + key + ' ' + parameters[key] - } - } - return targetParams.trim() -} - -async function onAbilityCreateCallback() { - console.log('onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - console.info('OpenHarmonyTestRunner OnPrepare') - } - - onRun() { - console.log('OpenHarmonyTestRunner onRun run') - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName - cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) - console.info('cmd : '+cmd) - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + d.stdResult); - console.info('executeShellCommand : data : ' + d.exitCode); - }) - console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') - var context = abilityDelegator.getAppContext() - console.info('getAppContext : ' + JSON.stringify(context)) - console.info('OpenHarmonyTestRunner onRun end') - } -}; \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/netmanager_socket/entry/src/main/resources/base/element/string.json index 498677efbde065c36668727190d3613cbf278bfc..03b8532c53ca563f8ed6b1e21d20ad3f67a68906 100644 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/resources/base/element/string.json +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/resources/base/element/string.json @@ -7,14 +7,6 @@ { "name": "description_mainability", "value": "ETS_Empty Ability" - }, - { - "name": "TestAbility_desc", - "value": "description" - }, - { - "name": "TestAbility_label", - "value": "label" } ] } \ No newline at end of file diff --git a/telephony/telephonyjstest/radiostatistic/BUILD.gn b/telephony/telephonyjstest/radiostatistic/BUILD.gn index d31d214299673679b1dabdb88259f108a0dbc86e..2c97b24170f8dd4834f11dd1ecd183f413e1a3ea 100644 --- a/telephony/telephonyjstest/radiostatistic/BUILD.gn +++ b/telephony/telephonyjstest/radiostatistic/BUILD.gn @@ -13,23 +13,19 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("ActsRadiostatisticEtsTest") { +ohos_js_hap_suite("ActsRadioStatisticEtsTest") { hap_profile = "./entry/src/main/config.json" deps = [ ":ace_demo_ets_assets", ":ace_demo_ets_resources", - ":ace_demo_ets_test_assets", ] ets2abc = true certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsRadiostatisticEtsTest" + hap_name = "ActsRadioStatisticEtsTest" } ohos_js_assets("ace_demo_ets_assets") { source_dir = "./entry/src/main/ets/MainAbility" } -ohos_js_assets("ace_demo_ets_test_assets") { - source_dir = "./entry/src/main/ets/TestAbility" -} ohos_resources("ace_demo_ets_resources") { sources = [ "./entry/src/main/resources" ] hap_profile = "./entry/src/main/config.json" diff --git a/telephony/telephonyjstest/radiostatistic/Test.json b/telephony/telephonyjstest/radiostatistic/Test.json index dc19065426bbf039289b909d9b0e716f340ea6ce..062cde66cc152de52f572e044a23f7a3dd706c09 100644 --- a/telephony/telephonyjstest/radiostatistic/Test.json +++ b/telephony/telephonyjstest/radiostatistic/Test.json @@ -1,16 +1,15 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "OHJSUnitTest", - "test-timeout": "2000000", - "bundle-name": "com.ohos.radiostatistic", - "package-name": "com.ohos.radiostatistic", - "shell-timeout": "2000000" + "type": "JSUnitTest", + "test-timeout": "1500000", + "package": "com.ohos.radiostatistic", + "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsRadiostatisticEtsTest.hap" + "ActsRadioStatisticEtsTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/config.json b/telephony/telephonyjstest/radiostatistic/entry/src/main/config.json index 9822f0339d95682d0239ccc53d658ac1e544c290..fda9d63dd9bd97c3c48b0b5b28cbb8cf0cdd0e83 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/config.json +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/config.json @@ -17,7 +17,7 @@ "package": "com.ohos.radiostatistic", "name": ".MyApplication", "mainAbility": ".MainAbility", - "srcPath": "", + "srcPath": "MainAbility", "deviceType": [ "phone" ], @@ -50,19 +50,6 @@ "label": "$string:entry_MainAbility", "type": "page", "launchType": "standard" - }, - { - "orientation": "unspecified", - "visible": true, - "srcPath": "TestAbility", - "name": ".TestAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:TestAbility_desc", - "formsEnabled": false, - "label": "$string:TestAbility_label", - "type": "page", - "launchType": "standard" } ], "reqPermissions": [ @@ -146,20 +133,6 @@ "designWidth": 720, "autoDesignWidth": false } - }, - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } } ] } diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/index.ets index 987f3a954fdecfaede4540d18cb97a080cb2a826..10359134da915c9b44b0836ba4881bca71f43f33 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/index.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/index.ets @@ -13,11 +13,39 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import file from '@system.file'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; +import testsuite from "../test/List.test.ets"; +import featureAbility from "@ohos.ability.featureAbility"; @Entry @Component struct MyComponent { aboutToAppear() { + console.info("start run testcase!!!!") + featureAbility.getWant() + .then((Want) => { + const core = Core.getInstance(); + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }); + core.addService('expect', expectExtend); + const reportExtend = new ReportExtend(file); + core.addService('report', reportExtend); + core.init(); + core.subscribeEvent('task', reportExtend); + const configService = core.getDefaultService('config'); + Want.parameters['timeout'] = 100000 + console.info('parameters---->' + JSON.stringify(Want.parameters)); + configService.setConfig(Want.parameters); + testsuite(); + core.execute(); + console.info('Operation successful. Data: ' + JSON.stringify(Want)); + }) + .catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); + }) } build() { diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/CallJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/CallJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/CallJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/CallJsunit.test.ets index 57db9b443e7c5c900d8557a4e58c521955fdaec1..53dc1428d40f63aac5cf732777d061f8fae45640 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/CallJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/CallJsunit.test.ets @@ -1,6 +1,5 @@ -// @ts-nocheck /** - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License") * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import call from '@ohos.telephony.call'; import utils from './Utils.ets' diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/ConvertOptionsJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/ConvertOptionsJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/ConvertOptionsJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/ConvertOptionsJsunit.test.ets index c743c1b3e98274f04c1517c5536bd9f2054c65ff..42441da2faeb9e9808359299f862b99fced3283d 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/ConvertOptionsJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/ConvertOptionsJsunit.test.ets @@ -1,6 +1,5 @@ -// @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,10 +13,10 @@ * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import convertxml from '@ohos.convertxml' export default function convertOptionsJsunit() { - describe('XmlTest_telephony1',function () { + describe('XmlTest',function () { console.log("************* settings Test start*************"); it('Telephony_convertxml_ConvertXML_0100', 0, async function (done) { var xml = diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/DataJsunit.test.ets similarity index 98% rename from telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/DataJsunit.test.ets index 0344a3f96df09fa874a70a8efc6789301362e76a..8a6d9d98baba60be59ef0e33ae2bdac36443273a 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/DataJsunit.test.ets @@ -1,5 +1,5 @@ /** - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License") * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import data from '@ohos.telephony.data'; diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/List.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/List.test.ets similarity index 100% rename from telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/List.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/List.test.ets diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets index 80e58c8b56a68583da8e52b0bca33f1f9f6c6672..ac2a165c4df41ae71e355357e11155069ac4c3da 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets @@ -1,6 +1,5 @@ -// @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioSecondJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioSecondJsunit.test.ets similarity index 95% rename from telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioSecondJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioSecondJsunit.test.ets index 26fedc8505b28a070ca0a2887bdaed4b98f0f5cb..32159adf3f5b54005508cdc2a7bfb33cb7b0f0d4 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioSecondJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/RadioSecondJsunit.test.ets @@ -1,6 +1,5 @@ -// @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"; import radio from '@ohos.telephony.radio'; import utils from './Utils.ets' @@ -65,10 +64,8 @@ export default function radioSecondJsunit() { const CELL_INFO_MIN = 0; const TIME_RADIO_TURNON = 10000; console.log("************* radio Test start*************"); - - - - /** + + /** * @tc.number Telephony_NetworkSearch_NetworkState_Async_0100 * @tc.name Test getNrOptionMode() to check the callback result * @tc.desc Function test @@ -195,34 +192,35 @@ export default function radioSecondJsunit() { }) /** - * @tc.number Telephony_NetworkSearch_getRadioTech_Async_0500 - * @tc.name TestGetRadioTech_0500 - * @tc.desc Test getRadioTech() api by callback .SlotId parameter input is 0 - */ + * @tc.number Telephony_NetworkSearch_getRadioTech_Async_0500 + * @tc.name TestGetRadioTech_0500 + * @tc.desc Test getRadioTech() api by callback, SlotId parameter input is 0 + */ it("Telephony_NetworkSearch_getRadioTech_Async_0500", 0, async function(done){ radio.getRadioTech(0, (err, data) => { if (err) { - console.log(`Telephony_NetworkSearch_getRadioTech_Async_0500 fail err: ${err}`); + console.info(`Telephony_NetworkSearch_getRadioTech_Async_0500 fail err: ${err}`); expect(err.code === '-1').assertTrue(); done(); return; } - console.log(`Telephony_NetworkSearch_getRadioTech_Async_0500 success ${data}`); + console.info(`Telephony_NetworkSearch_getRadioTech_Async_0500 success ${data}`); expect(true).assertTrue(); done(); }); }); /** - * @tc.number Telephony_NetworkSearch_getRadioTech_Promise_0500 - * @tc.name TestGetRadioTech_0500 - * @tc.desc SlotId parameter input is 0 ,Test getRadioTech() api by promise - */ + * @tc.number Telephony_NetworkSearch_getRadioTech_Promise_0500 + * @tc.name testGetRadioTech_0500 + * @tc.desc SlotId parameter input is 0, test getRadioTech() api by promise. + */ it("Telephony_NetworkSearch_getRadioTech_Promise_0500", 0, async function(done){ try { let data = await radio.getRadioTech(0); console.log(`Telephony_NetworkSearch_getRadioTech_Promise_0500 success`); expect(true).assertTrue(); + done(); } catch (err) { console.log(`Telephony_NetworkSearch_getRadioTech_Promise_0500 fail err: ${err}`); expect(err.code === '-1').assertTrue(); @@ -359,6 +357,10 @@ export default function radioSecondJsunit() { done(); }); + + + + console.log("************* radio Test end*************"); function assertCellInformation(data) { expect(data !== '' && data != undefined && data != null).assertTrue(); diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/SmsMmsJsunit.test.ets similarity index 97% rename from telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/SmsMmsJsunit.test.ets index 0564e71f3528d68d0455c642ca9878fcce614c9f..a05be799295c2512ee9f43e994cda7cae29bf130 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/SmsMmsJsunit.test.ets @@ -1,6 +1,5 @@ -// @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,11 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"; import mms from '@ohos.telephony.sms'; import utils from './Utils.ets' export default function smsUiJsunit() { - describe('appInfoTest_telephony1', function () { + describe('appInfoTest', function () { const SMS_SEND_DST_NUMBER = ''; const TRUE_SLOT_ID = 0; diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/StatisticsJsunit.test.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/StatisticsJsunit.test.ets similarity index 99% rename from telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/StatisticsJsunit.test.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/StatisticsJsunit.test.ets index bfb117fadff2485c5a951b5712de40bebb0d927a..53d771c83457f5c26fbddbf520340d10f07f319a 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/StatisticsJsunit.test.ets +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/StatisticsJsunit.test.ets @@ -1,6 +1,5 @@ -// @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,11 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; import statistics from '@ohos.net.statistics'; import utils from './Utils.ets' export default function statisticsUiJsunit() { - describe('appInfoTest_telephony2', function () { + describe('appInfoTest', function () { const DATA_0 = 0; /** diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/Utils.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/Utils.ets similarity index 100% rename from telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/Utils.ets rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/Utils.ets diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/lib/Const.js b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/lib/Const.js similarity index 100% rename from telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/lib/Const.js rename to telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/test/lib/Const.js diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestAbility/app.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestAbility/app.ets deleted file mode 100644 index 1405dd359f629939894b86e2b285cb2cc1b37aa6..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestAbility/app.ets +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestAbility/pages/index.ets b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestAbility/pages/index.ets deleted file mode 100644 index 52663437cb619d4598126cf403d3689cb31ba131..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestAbility/pages/index.ets +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import router from '@system.router'; - -@Entry -@Component -struct Index { - aboutToAppear() { - console.info('TestAbility index aboutToAppear') - } - - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 14e78a653e030645860bcc3e7eb6c600b098127b..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import TestRunner from '@ohos.application.testRunner' -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -function translateParamsToString(parameters) { - const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s itName', - '-s level', '-s testType', '-s size', '-s timeout', - '-s package' - ]) - let targetParams = ''; - for (const key in parameters) { - if (keySet.has(key)) { - targetParams += ' ' + key + ' ' + parameters[key] - } - } - return targetParams.trim() -} - -async function onAbilityCreateCallback() { - console.log('onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - console.info('OpenHarmonyTestRunner OnPrepare') - } - - onRun() { - console.log('OpenHarmonyTestRunner onRun run') - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName - cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) - console.info('cmd : '+cmd) - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + d.stdResult); - console.info('executeShellCommand : data : ' + d.exitCode); - }) - console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') - var context = abilityDelegator.getAppContext() - console.info('getAppContext : ' + JSON.stringify(context)) - console.info('OpenHarmonyTestRunner onRun end') - } -}; \ No newline at end of file diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/base/element/string.json index 498677efbde065c36668727190d3613cbf278bfc..03b8532c53ca563f8ed6b1e21d20ad3f67a68906 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/base/element/string.json +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/resources/base/element/string.json @@ -7,14 +7,6 @@ { "name": "description_mainability", "value": "ETS_Empty Ability" - }, - { - "name": "TestAbility_desc", - "value": "description" - }, - { - "name": "TestAbility_label", - "value": "label" } ] } \ No newline at end of file