未验证 提交 598ae7d5 编写于 作者: O openharmony_ci 提交者: Gitee

!3652 电话服务JS框架整改、os端适配

Merge pull request !3652 from 高曦/OpenHarmony-3.1-Release
...@@ -21,7 +21,7 @@ group("telephonyjstest") { ...@@ -21,7 +21,7 @@ group("telephonyjstest") {
"netmanager_socket:ActsNetManagerSocketEtsTest", "netmanager_socket:ActsNetManagerSocketEtsTest",
"network_search:network_search", "network_search:network_search",
"observer:ActsObserverEtsTest", "observer:ActsObserverEtsTest",
"radiostatistic:ActsRadiostatisticEtsTest", "radiostatistic:ActsRadioStatisticEtsTest",
"sim:sim", "sim:sim",
"sms_mms:sms_mms", "sms_mms:sms_mms",
] ]
......
...@@ -18,7 +18,6 @@ ohos_js_hap_suite("ActsNetManagerHttpEtsTest") { ...@@ -18,7 +18,6 @@ ohos_js_hap_suite("ActsNetManagerHttpEtsTest") {
deps = [ deps = [
":ace_demo_ets_assets", ":ace_demo_ets_assets",
":ace_demo_ets_resources", ":ace_demo_ets_resources",
":ace_demo_ets_test_assets",
] ]
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
...@@ -27,9 +26,6 @@ ohos_js_hap_suite("ActsNetManagerHttpEtsTest") { ...@@ -27,9 +26,6 @@ ohos_js_hap_suite("ActsNetManagerHttpEtsTest") {
ohos_js_assets("ace_demo_ets_assets") { ohos_js_assets("ace_demo_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility" 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") { ohos_resources("ace_demo_ets_resources") {
sources = [ "./entry/src/main/resources" ] sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./entry/src/main/config.json"
......
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "OHJSUnitTest", "type": "JSUnitTest",
"test-timeout": "1800000", "test-timeout": "1500000",
"bundle-name": "com.ohos.netmanagerhttp", "package": "com.ohos.netmanagerhttp",
"package-name": "com.ohos.netmanagerhttp", "shell-timeout": "60000"
"shell-timeout": "1800000"
}, },
"kits": [ "kits": [
{ {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"package": "com.ohos.netmanagerhttp", "package": "com.ohos.netmanagerhttp",
"name": ".MyApplication", "name": ".MyApplication",
"mainAbility": ".MainAbility", "mainAbility": ".MainAbility",
"srcPath": "", "srcPath": "MainAbility",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
...@@ -50,19 +50,6 @@ ...@@ -50,19 +50,6 @@
"label": "$string:entry_MainAbility", "label": "$string:entry_MainAbility",
"type": "page", "type": "page",
"launchType": "standard" "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": [ "reqPermissions": [
...@@ -146,20 +133,6 @@ ...@@ -146,20 +133,6 @@
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": false "autoDesignWidth": false
} }
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
} }
] ]
} }
......
...@@ -13,11 +13,39 @@ ...@@ -13,11 +13,39 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 @Entry
@Component @Component
struct MyComponent { struct MyComponent {
aboutToAppear() { 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() { build() {
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License') * Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 http from '@ohos.net.http';
export default function httpJsunit() { export default function httpJsunit() {
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License') * Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 http from '@ohos.net.http';
import utils from './Utils.ets' import utils from './Utils.ets'
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License') * Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 http from '@ohos.net.http';
import utils from './Utils.ets' import utils from './Utils.ets'
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License') * Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 http from '@ohos.net.http';
import utils from './Utils.ets' import utils from './Utils.ets'
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
*/ */
//other import //other import
import httpJsunit from './HttpJsunit.test.ets' import httpJsunit from './HttpJsunit.test'
import responseCodeJsunit from './ResponseCodeJsunit.test.ets'; import responseCodeJsunit from './ResponseCodeJsunit.test';
import requestMethodJsunit from './RequestMethodJsunit.test.ets'; import requestMethodJsunit from './RequestMethodJsunit.test';
import httpResponseJsunit from './HttpResponseJsunit.test.ets'; import httpResponseJsunit from './HttpResponseJsunit.test';
import HttpRequestOptionsJsunit from './HttpRequestOptionsJsunit.test.ets'; import HttpRequestOptionsJsunit from './HttpRequestOptionsJsunit.test';
import httpRequestJsunit from './HttpRequestJsunit.test.ets'; import httpRequestJsunit from './HttpRequestJsunit.test';
export default function testsuite() { export default function testsuite() {
//other //other
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License') * Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 http from '@ohos.net.http';
import utils from './Utils.ets' import utils from './Utils.ets'
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License') * Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 http from '@ohos.net.http';
export default function responseCodeJsunit() { export default function responseCodeJsunit() {
......
/*
* 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
/*
* 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
/*
* 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
...@@ -7,14 +7,6 @@ ...@@ -7,14 +7,6 @@
{ {
"name": "description_mainability", "name": "description_mainability",
"value": "ETS_Empty Ability" "value": "ETS_Empty Ability"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
} }
] ]
} }
\ No newline at end of file
...@@ -18,7 +18,6 @@ ohos_js_hap_suite("ActsNetManagerSocketEtsTest") { ...@@ -18,7 +18,6 @@ ohos_js_hap_suite("ActsNetManagerSocketEtsTest") {
deps = [ deps = [
":ace_demo_ets_assets", ":ace_demo_ets_assets",
":ace_demo_ets_resources", ":ace_demo_ets_resources",
":ace_demo_ets_test_assets",
] ]
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
...@@ -27,9 +26,6 @@ ohos_js_hap_suite("ActsNetManagerSocketEtsTest") { ...@@ -27,9 +26,6 @@ ohos_js_hap_suite("ActsNetManagerSocketEtsTest") {
ohos_js_assets("ace_demo_ets_assets") { ohos_js_assets("ace_demo_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility" 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") { ohos_resources("ace_demo_ets_resources") {
sources = [ "./entry/src/main/resources" ] sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./entry/src/main/config.json"
......
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "OHJSUnitTest", "type": "JSUnitTest",
"test-timeout": "1800000", "test-timeout": "1500000",
"bundle-name": "com.ohos.netmanagersocket", "package": "com.ohos.netmanagersocket",
"package-name": "com.ohos.netmanagersocket", "shell-timeout": "60000"
"shell-timeout": "1800000"
}, },
"kits": [ "kits": [
{ {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"package": "com.ohos.netmanagersocket", "package": "com.ohos.netmanagersocket",
"name": ".MyApplication", "name": ".MyApplication",
"mainAbility": ".MainAbility", "mainAbility": ".MainAbility",
"srcPath": "", "srcPath": "MainAbility",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
...@@ -50,19 +50,6 @@ ...@@ -50,19 +50,6 @@
"label": "$string:entry_MainAbility", "label": "$string:entry_MainAbility",
"type": "page", "type": "page",
"launchType": "standard" "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": [ "reqPermissions": [
...@@ -146,20 +133,6 @@ ...@@ -146,20 +133,6 @@
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": false "autoDesignWidth": false
} }
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
} }
] ]
} }
......
...@@ -13,11 +13,39 @@ ...@@ -13,11 +13,39 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 @Entry
@Component @Component
struct MyComponent { struct MyComponent {
aboutToAppear() { 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() { build() {
......
// @ts-nocheck // @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 connection from '@ohos.net.connection'
import utils from './Utils.ets' import utils from './Utils.ets'
......
// @ts-nocheck // @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') * Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import connection from '@ohos.net.connection'; 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' import utils from './Utils.ets'
export default function connectionSecondJsUnit() { export default function connectionSecondJsUnit() {
......
// @ts-nocheck // @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * 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 socket from '@ohos.net.socket'
import utils from './Utils.ets' import utils from './Utils.ets'
...@@ -655,7 +655,7 @@ export default function socketJsunit() { ...@@ -655,7 +655,7 @@ export default function socketJsunit() {
broadcast: true broadcast: true
} }
try{ try{
udp.setExtraOptions(udpExtraOptions, funtion(error,data) { udp.setExtraOptions(udpExtraOptions, function(error,data) {
if (error) { if (error) {
expect().assertFail(); expect().assertFail();
console.log(`${caseName} error, case failed,error: ` + JSON.stringify(error)); console.log(`${caseName} error, case failed,error: ` + JSON.stringify(error));
...@@ -901,10 +901,11 @@ export default function socketJsunit() { ...@@ -901,10 +901,11 @@ export default function socketJsunit() {
it('Telephony_Socket_UDPSocket_off_error_0100', 0, function (done) { it('Telephony_Socket_UDPSocket_off_error_0100', 0, function (done) {
console.log("************* Telephony_Socket_UDPSocket_off_error_0100 Test start*************"); console.log("************* Telephony_Socket_UDPSocket_off_error_0100 Test start*************");
let caseName = "Telephony_Socket_UDPSocket_off_error_0100" let caseName = "Telephony_Socket_UDPSocket_off_error_0100"
udp.off("error", error => { let callback = err =>{
console.log(`${caseName} fail, error:${toString(error)}`); console.log(caseName +" on error, err:" + JSON.stringify(err));
expect().assertFail(); }
}); udp.on('error', callback);
udp.off('error', callback);
expect(true).assertTrue(); expect(true).assertTrue();
console.log("************* Telephony_Socket_UDPSocket_off_error_0100 Test end*************"); console.log("************* Telephony_Socket_UDPSocket_off_error_0100 Test end*************");
done(); done();
...@@ -1611,10 +1612,11 @@ export default function socketJsunit() { ...@@ -1611,10 +1612,11 @@ export default function socketJsunit() {
it('Telephony_Socket_TCPSocket_off_error_0100', 0, function (done) { it('Telephony_Socket_TCPSocket_off_error_0100', 0, function (done) {
console.log("************* Telephony_Socket_TCPSocket_off_error_0100 Test start*************"); console.log("************* Telephony_Socket_TCPSocket_off_error_0100 Test start*************");
let caseName = "Telephony_Socket_TCPSocket_off_error_0100" let caseName = "Telephony_Socket_TCPSocket_off_error_0100"
tcp.off("error", error => { let callback = err =>{
console.log(`${caseName} fail, error:${toString(error)}`); console.log(caseName +" on error, err:" + JSON.stringify(err));
expect().assertFail(); }
}); tcp.on('error', callback);
tcp.off('error', callback);
expect(true).assertTrue(); expect(true).assertTrue();
console.log("************* Telephony_Socket_TCPSocket_off_error_0100 Test end*************"); console.log("************* Telephony_Socket_TCPSocket_off_error_0100 Test end*************");
done(); done();
......
// @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -14,7 +13,7 @@ ...@@ -14,7 +13,7 @@
* limitations under the License. * 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 webSocket from '@ohos.net.webSocket'
import utils from './Utils.ets' import utils from './Utils.ets'
......
/*
* 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
/*
* 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
/*
* 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
...@@ -7,14 +7,6 @@ ...@@ -7,14 +7,6 @@
{ {
"name": "description_mainability", "name": "description_mainability",
"value": "ETS_Empty Ability" "value": "ETS_Empty Ability"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
} }
] ]
} }
\ No newline at end of file
...@@ -13,23 +13,19 @@ ...@@ -13,23 +13,19 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsRadiostatisticEtsTest") { ohos_js_hap_suite("ActsRadioStatisticEtsTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./entry/src/main/config.json"
deps = [ deps = [
":ace_demo_ets_assets", ":ace_demo_ets_assets",
":ace_demo_ets_resources", ":ace_demo_ets_resources",
":ace_demo_ets_test_assets",
] ]
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsRadiostatisticEtsTest" hap_name = "ActsRadioStatisticEtsTest"
} }
ohos_js_assets("ace_demo_ets_assets") { ohos_js_assets("ace_demo_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility" 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") { ohos_resources("ace_demo_ets_resources") {
sources = [ "./entry/src/main/resources" ] sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./entry/src/main/config.json"
......
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "OHJSUnitTest", "type": "JSUnitTest",
"test-timeout": "2000000", "test-timeout": "1500000",
"bundle-name": "com.ohos.radiostatistic", "package": "com.ohos.radiostatistic",
"package-name": "com.ohos.radiostatistic", "shell-timeout": "60000"
"shell-timeout": "2000000"
}, },
"kits": [ "kits": [
{ {
"test-file-name": [ "test-file-name": [
"ActsRadiostatisticEtsTest.hap" "ActsRadioStatisticEtsTest.hap"
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"package": "com.ohos.radiostatistic", "package": "com.ohos.radiostatistic",
"name": ".MyApplication", "name": ".MyApplication",
"mainAbility": ".MainAbility", "mainAbility": ".MainAbility",
"srcPath": "", "srcPath": "MainAbility",
"deviceType": [ "deviceType": [
"phone" "phone"
], ],
...@@ -50,19 +50,6 @@ ...@@ -50,19 +50,6 @@
"label": "$string:entry_MainAbility", "label": "$string:entry_MainAbility",
"type": "page", "type": "page",
"launchType": "standard" "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": [ "reqPermissions": [
...@@ -146,20 +133,6 @@ ...@@ -146,20 +133,6 @@
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": false "autoDesignWidth": false
} }
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
} }
] ]
} }
......
...@@ -13,11 +13,39 @@ ...@@ -13,11 +13,39 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 @Entry
@Component @Component
struct MyComponent { struct MyComponent {
aboutToAppear() { 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() { build() {
......
// @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") * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,7 +12,7 @@ ...@@ -13,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 call from '@ohos.telephony.call';
import utils from './Utils.ets' import utils from './Utils.ets'
......
// @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -14,10 +13,10 @@ ...@@ -14,10 +13,10 @@
* limitations under the License. * 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' import convertxml from '@ohos.convertxml'
export default function convertOptionsJsunit() { export default function convertOptionsJsunit() {
describe('XmlTest_telephony1',function () { describe('XmlTest',function () {
console.log("************* settings Test start*************"); console.log("************* settings Test start*************");
it('Telephony_convertxml_ConvertXML_0100', 0, async function (done) { it('Telephony_convertxml_ConvertXML_0100', 0, async function (done) {
var xml = var xml =
......
/** /**
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License") * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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'; import data from '@ohos.telephony.data';
......
// @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
......
// @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,7 +12,7 @@ ...@@ -13,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 radio from '@ohos.telephony.radio';
import utils from './Utils.ets' import utils from './Utils.ets'
...@@ -65,10 +64,8 @@ export default function radioSecondJsunit() { ...@@ -65,10 +64,8 @@ export default function radioSecondJsunit() {
const CELL_INFO_MIN = 0; const CELL_INFO_MIN = 0;
const TIME_RADIO_TURNON = 10000; const TIME_RADIO_TURNON = 10000;
console.log("************* radio Test start*************"); console.log("************* radio Test start*************");
/**
/**
* @tc.number Telephony_NetworkSearch_NetworkState_Async_0100 * @tc.number Telephony_NetworkSearch_NetworkState_Async_0100
* @tc.name Test getNrOptionMode() to check the callback result * @tc.name Test getNrOptionMode() to check the callback result
* @tc.desc Function test * @tc.desc Function test
...@@ -195,34 +192,35 @@ export default function radioSecondJsunit() { ...@@ -195,34 +192,35 @@ export default function radioSecondJsunit() {
}) })
/** /**
* @tc.number Telephony_NetworkSearch_getRadioTech_Async_0500 * @tc.number Telephony_NetworkSearch_getRadioTech_Async_0500
* @tc.name TestGetRadioTech_0500 * @tc.name TestGetRadioTech_0500
* @tc.desc Test getRadioTech() api by callback .SlotId parameter input is 0 * @tc.desc Test getRadioTech() api by callback, SlotId parameter input is 0
*/ */
it("Telephony_NetworkSearch_getRadioTech_Async_0500", 0, async function(done){ it("Telephony_NetworkSearch_getRadioTech_Async_0500", 0, async function(done){
radio.getRadioTech(0, (err, data) => { radio.getRadioTech(0, (err, data) => {
if (err) { 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(); expect(err.code === '-1').assertTrue();
done(); done();
return; return;
} }
console.log(`Telephony_NetworkSearch_getRadioTech_Async_0500 success ${data}`); console.info(`Telephony_NetworkSearch_getRadioTech_Async_0500 success ${data}`);
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
}); });
}); });
/** /**
* @tc.number Telephony_NetworkSearch_getRadioTech_Promise_0500 * @tc.number Telephony_NetworkSearch_getRadioTech_Promise_0500
* @tc.name TestGetRadioTech_0500 * @tc.name testGetRadioTech_0500
* @tc.desc SlotId parameter input is 0 ,Test getRadioTech() api by promise * @tc.desc SlotId parameter input is 0, test getRadioTech() api by promise.
*/ */
it("Telephony_NetworkSearch_getRadioTech_Promise_0500", 0, async function(done){ it("Telephony_NetworkSearch_getRadioTech_Promise_0500", 0, async function(done){
try { try {
let data = await radio.getRadioTech(0); let data = await radio.getRadioTech(0);
console.log(`Telephony_NetworkSearch_getRadioTech_Promise_0500 success`); console.log(`Telephony_NetworkSearch_getRadioTech_Promise_0500 success`);
expect(true).assertTrue(); expect(true).assertTrue();
done();
} catch (err) { } catch (err) {
console.log(`Telephony_NetworkSearch_getRadioTech_Promise_0500 fail err: ${err}`); console.log(`Telephony_NetworkSearch_getRadioTech_Promise_0500 fail err: ${err}`);
expect(err.code === '-1').assertTrue(); expect(err.code === '-1').assertTrue();
...@@ -359,6 +357,10 @@ export default function radioSecondJsunit() { ...@@ -359,6 +357,10 @@ export default function radioSecondJsunit() {
done(); done();
}); });
console.log("************* radio Test end*************"); console.log("************* radio Test end*************");
function assertCellInformation(data) { function assertCellInformation(data) {
expect(data !== '' && data != undefined && data != null).assertTrue(); expect(data !== '' && data != undefined && data != null).assertTrue();
......
// @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,11 +12,11 @@ ...@@ -13,11 +12,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 mms from '@ohos.telephony.sms';
import utils from './Utils.ets' import utils from './Utils.ets'
export default function smsUiJsunit() { export default function smsUiJsunit() {
describe('appInfoTest_telephony1', function () { describe('appInfoTest', function () {
const SMS_SEND_DST_NUMBER = ''; const SMS_SEND_DST_NUMBER = '';
const TRUE_SLOT_ID = 0; const TRUE_SLOT_ID = 0;
......
// @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,11 +12,11 @@ ...@@ -13,11 +12,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 statistics from '@ohos.net.statistics';
import utils from './Utils.ets' import utils from './Utils.ets'
export default function statisticsUiJsunit() { export default function statisticsUiJsunit() {
describe('appInfoTest_telephony2', function () { describe('appInfoTest', function () {
const DATA_0 = 0; const DATA_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
/*
* 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
/*
* 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
...@@ -7,14 +7,6 @@ ...@@ -7,14 +7,6 @@
{ {
"name": "description_mainability", "name": "description_mainability",
"value": "ETS_Empty Ability" "value": "ETS_Empty Ability"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
} }
] ]
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册