Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b0b65f15
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
接近 2 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b0b65f15
编写于
6月 08, 2022
作者:
G
gaoxi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
电话用例整改
Signed-off-by:
N
gaoxi
<
gaoxi785@huawei.com
>
上级
0fe9944b
变更
56
隐藏空白更改
内联
并排
Showing
56 changed file
with
1331 addition
and
177 deletion
+1331
-177
telephony/telephonyjstest/BUILD.gn
telephony/telephonyjstest/BUILD.gn
+0
-5
telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js
...er_ims2_call/entry/src/main/js/test/CallManageAll.test.js
+83
-4
telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js
...normal/entry/src/main/js/test/CellularDataAbnorma.test.js
+2
-2
telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/test/NetworkManagerDNS.test.js
...base/dns/entry/src/main/js/test/NetworkManagerDNS.test.js
+17
-13
telephony/telephonyjstest/netmanager_http/BUILD.gn
telephony/telephonyjstest/netmanager_http/BUILD.gn
+4
-0
telephony/telephonyjstest/netmanager_http/Test.json
telephony/telephonyjstest/netmanager_http/Test.json
+4
-3
telephony/telephonyjstest/netmanager_http/entry/src/main/config.json
...elephonyjstest/netmanager_http/entry/src/main/config.json
+28
-1
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/pages/index.ets
...nager_http/entry/src/main/ets/MainAbility/pages/index.ets
+0
-28
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestAbility/app.ets
...st/netmanager_http/entry/src/main/ets/TestAbility/app.ets
+32
-0
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestAbility/pages/index.ets
...nager_http/entry/src/main/ets/TestAbility/pages/index.ets
+49
-0
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...tp/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+77
-0
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets
...tmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets
+1
-1
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpRequestJsunit.test.ets
...r_http/entry/src/main/ets/test/HttpRequestJsunit.test.ets
+52
-0
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpRequestOptionsJsunit.test.ets
...entry/src/main/ets/test/HttpRequestOptionsJsunit.test.ets
+1
-1
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpResponseJsunit.test.ets
..._http/entry/src/main/ets/test/HttpResponseJsunit.test.ets
+1
-1
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/List.test.ets
...est/netmanager_http/entry/src/main/ets/test/List.test.ets
+0
-0
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/RequestMethodJsunit.test.ets
...http/entry/src/main/ets/test/RequestMethodJsunit.test.ets
+1
-1
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/ResponseCodeJsunit.test.ets
..._http/entry/src/main/ets/test/ResponseCodeJsunit.test.ets
+1
-1
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/Utils.ets
...yjstest/netmanager_http/entry/src/main/ets/test/Utils.ets
+0
-0
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/lib/Const.js
...test/netmanager_http/entry/src/main/ets/test/lib/Const.js
+0
-0
telephony/telephonyjstest/netmanager_http/entry/src/main/resources/base/element/string.json
...er_http/entry/src/main/resources/base/element/string.json
+8
-0
telephony/telephonyjstest/netmanager_socket/BUILD.gn
telephony/telephonyjstest/netmanager_socket/BUILD.gn
+4
-0
telephony/telephonyjstest/netmanager_socket/Test.json
telephony/telephonyjstest/netmanager_socket/Test.json
+4
-3
telephony/telephonyjstest/netmanager_socket/entry/src/main/config.json
...ephonyjstest/netmanager_socket/entry/src/main/config.json
+28
-1
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/pages/index.ets
...ger_socket/entry/src/main/ets/MainAbility/pages/index.ets
+0
-28
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestAbility/app.ets
.../netmanager_socket/entry/src/main/ets/TestAbility/app.ets
+32
-0
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestAbility/pages/index.ets
...ger_socket/entry/src/main/ets/TestAbility/pages/index.ets
+58
-0
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...et/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+77
-0
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionJsunit.test.ets
..._socket/entry/src/main/ets/test/ConnectionJsunit.test.ets
+1
-1
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionSecondJsUnit.test.ets
...t/entry/src/main/ets/test/ConnectionSecondJsUnit.test.ets
+1
-1
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/List.test.ets
...t/netmanager_socket/entry/src/main/ets/test/List.test.ets
+0
-0
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/SocketJsunit.test.ets
...ager_socket/entry/src/main/ets/test/SocketJsunit.test.ets
+1
-1
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/Utils.ets
...stest/netmanager_socket/entry/src/main/ets/test/Utils.ets
+0
-0
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/WebSocketJsunit.test.ets
...r_socket/entry/src/main/ets/test/WebSocketJsunit.test.ets
+1
-1
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/lib/Const.js
...st/netmanager_socket/entry/src/main/ets/test/lib/Const.js
+0
-0
telephony/telephonyjstest/netmanager_socket/entry/src/main/resources/base/element/string.json
..._socket/entry/src/main/resources/base/element/string.json
+8
-0
telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js
...errors/entry/src/main/js/test/NetworkSearchErrors.test.js
+70
-1
telephony/telephonyjstest/radiostatistic/BUILD.gn
telephony/telephonyjstest/radiostatistic/BUILD.gn
+4
-0
telephony/telephonyjstest/radiostatistic/Test.json
telephony/telephonyjstest/radiostatistic/Test.json
+4
-3
telephony/telephonyjstest/radiostatistic/entry/src/main/config.json
...telephonyjstest/radiostatistic/entry/src/main/config.json
+28
-1
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/index.ets
...ostatistic/entry/src/main/ets/MainAbility/pages/index.ets
+0
-28
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestAbility/app.ets
...est/radiostatistic/entry/src/main/ets/TestAbility/app.ets
+32
-0
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestAbility/pages/index.ets
...ostatistic/entry/src/main/ets/TestAbility/pages/index.ets
+49
-0
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...ic/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+77
-0
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/CallJsunit.test.ets
...adiostatistic/entry/src/main/ets/test/CallJsunit.test.ets
+1
-1
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/ConvertOptionsJsunit.test.ets
...tic/entry/src/main/ets/test/ConvertOptionsJsunit.test.ets
+1
-1
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets
...adiostatistic/entry/src/main/ets/test/DataJsunit.test.ets
+1
-1
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/List.test.ets
...test/radiostatistic/entry/src/main/ets/test/List.test.ets
+0
-0
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioJsunit.test.ets
...diostatistic/entry/src/main/ets/test/RadioJsunit.test.ets
+25
-2
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioSecondJsunit.test.ets
...tistic/entry/src/main/ets/test/RadioSecondJsunit.test.ets
+417
-0
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets
...iostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets
+34
-1
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/StatisticsJsunit.test.ets
...atistic/entry/src/main/ets/test/StatisticsJsunit.test.ets
+1
-1
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/Utils.ets
...nyjstest/radiostatistic/entry/src/main/ets/test/Utils.ets
+0
-0
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/lib/Const.js
...stest/radiostatistic/entry/src/main/ets/test/lib/Const.js
+0
-0
telephony/telephonyjstest/radiostatistic/entry/src/main/resources/base/element/string.json
...atistic/entry/src/main/resources/base/element/string.json
+8
-0
telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js
...r_function_test/entry/src/main/js/test/SimManager.test.js
+3
-40
未找到文件。
telephony/telephonyjstest/BUILD.gn
浏览文件 @
b0b65f15
...
...
@@ -18,11 +18,6 @@ group("telephonyjstest") {
"cellular_data:cellular_data",
"netmanager_base:netmanager_base",
"netmanager_http:ActsNetManagerHttpEtsTest",
#"contact_function:ActsContactFunctionEtsTest",
#"contact_function_merge:ActsContactFunctionMergeEtsTest",
#"contact_performance:ActsContactPerformanceEtsTest",
#"contact_stability:ActsContactStabilityEtsTest",
"netmanager_socket:ActsNetManagerSocketEtsTest",
"network_search:network_search",
"observer:ActsObserverEtsTest",
...
...
telephony/telephonyjstest/call_manager/call_manager_ims2_call/entry/src/main/js/test/CallManageAll.test.js
浏览文件 @
b0b65f15
...
...
@@ -757,7 +757,7 @@ describe('CallManageImsCall', function () {
done
();
return
;
}
expect
(
data
==
=
call
.
CALL_STATE_IDLE
).
assertTrue
();
expect
(
data
==
call
.
CALL_STATE_IDLE
||
data
==
call
.
CALL_STATE_UNKNOWN
||
data
==
call
.
CALL_STATE_RINGING
||
data
==
call
.
CALL_STATE_OFFHOOK
).
assertTrue
();
console
.
log
(
`Telephony_CallManager_getCallState_Async_0100 finish data =
${
data
}
`
);
done
();
});
...
...
@@ -772,7 +772,7 @@ describe('CallManageImsCall', function () {
it
(
'
Telephony_CallManager_getCallState_Promise_0100
'
,
0
,
async
function
(
done
)
{
try
{
var
data
=
await
call
.
getCallState
();
expect
(
data
==
=
call
.
CALL_STATE_IDLE
).
assertTrue
();
expect
(
data
==
call
.
CALL_STATE_IDLE
||
data
==
call
.
CALL_STATE_UNKNOWN
||
data
==
call
.
CALL_STATE_RINGING
||
data
==
call
.
CALL_STATE_OFFHOOK
).
assertTrue
();
console
.
log
(
`Telephony_CallManager_getCallState_Promise_0100 finish data =
${
data
}
`
);
done
();
}
catch
(
err
)
{
...
...
@@ -796,7 +796,6 @@ describe('CallManageImsCall', function () {
done
();
return
;
}
expect
(
data
===
false
).
assertTrue
();
console
.
log
(
`Telephony_CallManager_hasCall_Async_0400 finish data =
${
data
}
`
);
done
();
});
...
...
@@ -810,7 +809,6 @@ describe('CallManageImsCall', function () {
it
(
'
Telephony_CallManager_hasCall_Promise_0400
'
,
0
,
async
function
(
done
)
{
try
{
var
data
=
await
call
.
hasCall
();
expect
(
data
===
false
).
assertTrue
();
console
.
log
(
`Telephony_CallManager_hasCall_Promise_0400 finish data =
${
data
}
`
);
done
();
}
catch
(
err
)
{
...
...
@@ -862,6 +860,48 @@ describe('CallManageImsCall', function () {
}
});
/**
* @tc.number Telephony_CallManager_formatPhoneNumber_Async_0200
* @tc.name testFormatPhoneNumber_0200
* @tc.desc PhoneNumber is 13900000000, options: CN, test formatPhoneNumber() api by callback.
* The return value is 139 0000 0000
*/
it
(
'
Telephony_CallManager_formatPhoneNumber_Async_0200
'
,
0
,
async
function
(
done
)
{
let
numberFormatOptions
=
new
NumberFormatOptions
(
'
CN
'
);
call
.
formatPhoneNumber
(
'
13900000000
'
,
numberFormatOptions
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`Telephony_CallManager_formatPhoneNumber_Async_0200 err =
${
err
.
message
}
`
);
console
.
log
(
'
Telephony_CallManager_formatPhoneNumber_Async_0200 fail
'
);
expect
().
assertFail
();
done
();
return
;
}
expect
(
data
===
'
139 0000 0000
'
).
assertTrue
();
console
.
log
(
`Telephony_CallManager_formatPhoneNumber_Async_0200 finish data =
${
data
}
`
);
done
();
});
});
/**
* @tc.number Telephony_CallManager_formatPhoneNumber_Async_0300
* @tc.name testFormatPhoneNumber_0300
* @tc.desc PhoneNumber is 13900000000, options: US, test formatPhoneNumber() api by promise.
* The return value is '1 390-000-0000'
*/
it
(
'
Telephony_CallManager_formatPhoneNumber_Promise_0200
'
,
0
,
async
function
(
done
)
{
let
numberFormatOptions
=
new
NumberFormatOptions
(
'
US
'
);
try
{
var
data
=
await
call
.
formatPhoneNumber
(
'
13900000000
'
,
numberFormatOptions
);
expect
(
data
===
'
1 390-000-0000
'
).
assertTrue
();
console
.
log
(
`Telephony_CallManager_formatPhoneNumber_Promise_0200 finish data =
${
data
}
`
);
done
();
}
catch
(
err
)
{
console
.
log
(
'
Telephony_CallManager_formatPhoneNumber_Promise_0200 fail
'
);
expect
().
assertFail
();
done
();
}
});
/**
* @tc.number Telephony_CallManager_formatPhoneNumberToE164_Async_0100
* @tc.name PhoneNumber is 010-0000-0000, options: CN, call formatPhoneNumberToE164() to format the number,
...
...
@@ -942,4 +982,43 @@ describe('CallManageImsCall', function () {
done
();
}
});
/**
* @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1400
* @tc.name testIsEmergencyPhoneNumber_1400
* @tc.desc PhoneNumber: 110, no options. Call isEmergencyPhoneNumber() api by callback.
* The return value is true
*/
it
(
'
Telephony_CallManager_isEmergencyPhoneNumber_Async_1400
'
,
0
,
async
function
(
done
)
{
call
.
isEmergencyPhoneNumber
(
'
110
'
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
`Telephony_CallManager_isEmergencyPhoneNumber_Async_1400 finish err =
${
err
}
`
);
expect
().
assertFail
();
done
();
return
;
}
expect
(
true
).
assertTrue
();
console
.
log
(
'
Telephony_CallManager_isEmergencyPhoneNumber_Async_1400 PASSED
'
);
done
();
});
});
/**
* @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1500
* @tc.name testIsEmergencyPhoneNumber_1500
* @tc.desc PhoneNumber: 120, no options. Call isEmergencyPhoneNumber() api by promise.
* The return value is true
*/
it
(
'
Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400
'
,
0
,
async
function
(
done
)
{
try
{
var
data
=
await
call
.
isEmergencyPhoneNumber
(
'
120
'
);
expect
(
true
).
assertTrue
();
console
.
log
(
'
Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400 PASSED
'
);
done
();
}
catch
(
err
)
{
console
.
log
(
`Telephony_CallManager_isEmergencyPhoneNumber_Promise_1400 finish err =
${
err
}
`
);
expect
().
assertFail
();
done
();
}
});
});
\ No newline at end of file
telephony/telephonyjstest/cellular_data/cellular_data_abnormal/entry/src/main/js/test/CellularDataAbnorma.test.js
浏览文件 @
b0b65f15
...
...
@@ -101,7 +101,7 @@ describe("ActsCellularDataAbnormalTest", function () {
* @tc.desc Function test
*/
it
(
"
Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500
"
,
0
,
async
function
(
done
)
{
cellular
.
getDefaultCellularDataS
ol
tId
((
err
)
=>
{
cellular
.
getDefaultCellularDataS
lo
tId
((
err
)
=>
{
if
(
!
err
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
"
Telephony_CellularData_getDefaultCellularDataSlotId_Async_0500 finish
"
);
...
...
@@ -193,7 +193,7 @@ describe("ActsCellularDataAbnormalTest", function () {
*/
it
(
"
Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500
"
,
0
,
async
function
(
done
)
{
try
{
await
cellular
.
getDefaultCellularDataS
ol
tId
();
await
cellular
.
getDefaultCellularDataS
lo
tId
();
console
.
info
(
"
Telephony_CellularData_getDefaultCellularDataSlotId_Promise_0500 finish
"
);
done
();
}
catch
(
err
)
{
...
...
telephony/telephonyjstest/netmanager_base/dns/entry/src/main/js/test/NetworkManagerDNS.test.js
浏览文件 @
b0b65f15
...
...
@@ -25,7 +25,7 @@ describe('Telephony_NETMANAGER_TestDNSTest',function(){
netConnection
.
getDefaultNet
().
then
(
function
(
netHandle
){
netHandle
.
getAddressesByName
(
"
www.zhihu.com
"
).
then
(
function
(
addresses
){
if
(
addresses
===
undefined
||
addresses
.
length
==
0
){
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0100 addresses i
d undefined
'
+
addresses
);
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0100 addresses i
s
'
+
addresses
);
expect
(
false
).
assertFail
();
}
else
{
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0100 is success
'
);
...
...
@@ -41,7 +41,7 @@ describe('Telephony_NETMANAGER_TestDNSTest',function(){
netConnection
.
getDefaultNet
().
then
(
function
(
netHandle
){
netHandle
.
getAddressesByName
(
"
www.zhihu.com
"
,
function
(
err
,
addresses
){
if
(
addresses
===
undefined
||
addresses
.
length
==
0
){
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0200 addresses i
d undefined
'
+
addresses
);
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0200 addresses i
s
'
+
addresses
);
expect
(
false
).
assertFail
();
}
else
{
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0200 is success
'
);
...
...
@@ -58,7 +58,7 @@ describe('Telephony_NETMANAGER_TestDNSTest',function(){
netConnection
.
getDefaultNet
().
then
(
function
(
netHandle
){
netHandle
.
getAddressByName
(
"
www.zhihu.com
"
).
then
(
function
(
address
){
if
(
address
===
undefined
){
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0300 addresses i
d undefined
'
+
address
);
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0300 addresses i
s
'
+
address
);
expect
(
false
).
assertFail
();
}
else
{
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0300 is success
'
);
...
...
@@ -72,9 +72,9 @@ describe('Telephony_NETMANAGER_TestDNSTest',function(){
it
(
'
Telephony_NETMANAGER_TestDNS_Test0400
'
,
0
,
function
(
done
){
netConnection
.
getDefaultNet
().
then
(
function
(
netHandle
){
netHandle
.
getAddressByName
(
"
www.bai
d
u.com
"
,
function
(
err
,
address
){
netHandle
.
getAddressByName
(
"
www.bai
s
u.com
"
,
function
(
err
,
address
){
if
(
address
===
undefined
){
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0400 addresses i
d undefined
'
+
address
);
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0400 addresses i
s
'
+
address
);
expect
(
false
).
assertFail
();
}
else
{
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0400 is success
'
);
...
...
@@ -88,11 +88,13 @@ describe('Telephony_NETMANAGER_TestDNSTest',function(){
it
(
'
Telephony_NETMANAGER_TestDNS_Test0500
'
,
0
,
function
(
done
){
netConnection
.
getDefaultNet
().
then
(
function
(
netHandle
){
netHandle
.
getAddressesByName
(
"
www.askjdbaksjnhd.com
"
).
catch
(
function
(
error
){
netHandle
.
getAddressesByName
(
"
www.askjdbaksjnhd.com
"
).
then
(
function
(
error
){
if
(
error
===
undefined
){
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0500 addresses is
'
+
address
);
expect
(
false
).
assertTrue
();
}
else
{
expect
(
true
).
assertTrue
()
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0500 is success
'
);
expect
(
true
).
assertTrue
();
}
done
();
})
...
...
@@ -104,7 +106,7 @@ describe('Telephony_NETMANAGER_TestDNSTest',function(){
netConnection
.
getDefaultNet
().
then
(
function
(
netHandle
){
netHandle
.
getAddressesByName
(
"
www.askjdbaksjnhd.com
"
,
function
(
err
,
addresses
){
if
(
addresses
instanceof
Array
&&
addresses
.
length
!==
0
){
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0600 addresses i
d undefined
'
+
addresses
);
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0600 addresses i
s
'
+
addresses
);
expect
(
false
).
assertFail
();
}
else
{
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0600 is success
'
);
...
...
@@ -119,11 +121,13 @@ describe('Telephony_NETMANAGER_TestDNSTest',function(){
it
(
'
Telephony_NETMANAGER_TestDNS_Test0700
'
,
0
,
function
(
done
){
netConnection
.
getDefaultNet
().
then
(
function
(
netHandle
){
netHandle
.
getAddressesByName
(
"
www.askjdbaksjnhd.com
"
).
catch
(
function
(
error
){
if
(
error
===
undefined
){
netHandle
.
getAddressByName
(
"
www.askjdbaksjnhd.com
"
).
then
(
function
(
error
){
if
(
error
!==
undefined
){
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0700 error is
'
+
error
);
expect
(
false
).
assertTrue
();
}
else
{
expect
(
true
).
assertTrue
()
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0700 is success
'
);
expect
(
true
).
assertTrue
();
}
done
();
})
...
...
@@ -133,9 +137,9 @@ describe('Telephony_NETMANAGER_TestDNSTest',function(){
it
(
'
Telephony_NETMANAGER_TestDNS_Test0800
'
,
0
,
function
(
done
){
netConnection
.
getDefaultNet
().
then
(
function
(
netHandle
){
netHandle
.
getAddress
es
ByName
(
"
www.askjdbaksjnhd.com
"
,
function
(
err
,
address
){
netHandle
.
getAddressByName
(
"
www.askjdbaksjnhd.com
"
,
function
(
err
,
address
){
if
(
address
!==
undefined
){
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0800 address
es id
undefined
'
+
address
);
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0800 address
is
undefined
'
+
address
);
expect
(
false
).
assertFail
();
}
else
{
console
.
log
(
'
Telephony_NETMANAGER_TestDNS_Test0800 is success
'
);
...
...
telephony/telephonyjstest/netmanager_http/BUILD.gn
浏览文件 @
b0b65f15
...
...
@@ -18,6 +18,7 @@ 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"
...
...
@@ -26,6 +27,9 @@ 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"
...
...
telephony/telephonyjstest/netmanager_http/Test.json
浏览文件 @
b0b65f15
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"
OH
JSUnitTest"
,
"test-timeout"
:
"1800000"
,
"package"
:
"com.ohos.netmanagerhttp"
,
"shell-timeout"
:
"60000"
"bundle-name"
:
"com.ohos.netmanagerhttp"
,
"package-name"
:
"com.ohos.netmanagerhttp"
,
"shell-timeout"
:
"1800000"
},
"kits"
:
[
{
...
...
telephony/telephonyjstest/netmanager_http/entry/src/main/config.json
浏览文件 @
b0b65f15
...
...
@@ -17,7 +17,7 @@
"package"
:
"com.ohos.netmanagerhttp"
,
"name"
:
".MyApplication"
,
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
"
MainAbility
"
,
"srcPath"
:
""
,
"deviceType"
:
[
"phone"
],
...
...
@@ -50,6 +50,19 @@
"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"
:
[
...
...
@@ -133,6 +146,20 @@
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
...
...
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/MainAbility/pages/index.ets
浏览文件 @
b0b65f15
...
...
@@ -13,39 +13,11 @@
* 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() {
...
...
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestAbility/app.ets
0 → 100644
浏览文件 @
b0b65f15
/*
* 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
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
b0b65f15
/*
* 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
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
b0b65f15
/*
* 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
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/
MainAbility/
test/HttpJsunit.test.ets
→
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -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 '
hypium/index
';
import http from '@ohos.net.http';
export default function httpJsunit() {
...
...
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/
MainAbility/
test/HttpRequestJsunit.test.ets
→
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpRequestJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -270,6 +270,58 @@ export default function httpRequestJsunit() {
}
});
/**
* @tc.number Telephony_http_HttpRequest_off_headersReceive_0200
* @tc.name httprequest::off_headersReceive_0200
* @tc.desc Test Test httprequest property.
*/
it("Telephony_http_HttpRequest_off_headersReceive_0200", 0, function (done) {
var casename = "Telephony_http_HttpRequest_off_headersReceive_0200"
console.log("-----------------------HttpRequest_off_headersReceive Test is starting-----------------------");
try {
var httpRequest = http.createHttp();
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
httpRequest.off('headersReceive');
expect(true).assertTrue();
console.log("-----------------------HttpRequest_off_headersReceive_0200 Test end-----------------------");
done();
} catch (error) {
console.log("Telephony_http_HttpRequest_off_headersReceive_0200 : error = " + error);
done();
}
});
/**
* @tc.number Telephony_http_HttpRequest_once_headersReceive_0100
* @tc.name httprequest::once_headersReceive_0100
* @tc.desc Test Test httprequest property.
*/
it("Telephony_http_HttpRequest_once_headersReceive_0100", 0, function (done) {
var casename = "Telephony_http_HttpRequest_once_headersReceive_0100"
console.log("-----------------------HttpRequest_once_headersReceive Test is starting-----------------------");
try {
var httpRequest = http.createHttp();
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
httpRequest.once('headersReceive', (data) => {
console.log(casename + " data: " + JSON.stringify(data));
expect(true).assertTrue();
console.log("-----------------------HttpRequest_on_headersReceive Test end-----------------------");
done();
});
} catch (error) {
console.log("Telephony_http_HttpRequest_once_headersReceive_010 : error = " + error);
done();
}
});
})
...
...
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/
MainAbility/
test/HttpRequestOptionsJsunit.test.ets
→
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpRequestOptionsJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -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 '
hypium/index
';
import http from '@ohos.net.http';
import utils from './Utils.ets'
...
...
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/
MainAbility/
test/HttpResponseJsunit.test.ets
→
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpResponseJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -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 '
hypium/index
';
import http from '@ohos.net.http';
import utils from './Utils.ets'
...
...
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/
MainAbility/
test/List.test.ets
→
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/List.test.ets
浏览文件 @
b0b65f15
文件已移动
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/
MainAbility/
test/RequestMethodJsunit.test.ets
→
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/RequestMethodJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -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 '
hypium/index
';
import http from '@ohos.net.http';
import utils from './Utils.ets'
...
...
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/
MainAbility/
test/ResponseCodeJsunit.test.ets
→
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/ResponseCodeJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -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 '
hypium/index
';
import http from '@ohos.net.http';
export default function responseCodeJsunit() {
...
...
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/
MainAbility/
test/Utils.ets
→
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/Utils.ets
浏览文件 @
b0b65f15
文件已移动
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/
MainAbility/
test/lib/Const.js
→
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/lib/Const.js
浏览文件 @
b0b65f15
文件已移动
telephony/telephonyjstest/netmanager_http/entry/src/main/resources/base/element/string.json
浏览文件 @
b0b65f15
...
...
@@ -7,6 +7,14 @@
{
"name"
:
"description_mainability"
,
"value"
:
"ETS_Empty Ability"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
telephony/telephonyjstest/netmanager_socket/BUILD.gn
浏览文件 @
b0b65f15
...
...
@@ -18,6 +18,7 @@ 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"
...
...
@@ -26,6 +27,9 @@ 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"
...
...
telephony/telephonyjstest/netmanager_socket/Test.json
浏览文件 @
b0b65f15
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"
OH
JSUnitTest"
,
"test-timeout"
:
"1800000"
,
"package"
:
"com.ohos.netmanagersocket"
,
"shell-timeout"
:
"60000"
"bundle-name"
:
"com.ohos.netmanagersocket"
,
"package-name"
:
"com.ohos.netmanagersocket"
,
"shell-timeout"
:
"1800000"
},
"kits"
:
[
{
...
...
telephony/telephonyjstest/netmanager_socket/entry/src/main/config.json
浏览文件 @
b0b65f15
...
...
@@ -17,7 +17,7 @@
"package"
:
"com.ohos.netmanagersocket"
,
"name"
:
".MyApplication"
,
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
"
MainAbility
"
,
"srcPath"
:
""
,
"deviceType"
:
[
"phone"
],
...
...
@@ -50,6 +50,19 @@
"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"
:
[
...
...
@@ -133,6 +146,20 @@
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
...
...
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/MainAbility/pages/index.ets
浏览文件 @
b0b65f15
...
...
@@ -13,39 +13,11 @@
* 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() {
...
...
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestAbility/app.ets
0 → 100644
浏览文件 @
b0b65f15
/*
* 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
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
b0b65f15
/*
* 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
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
b0b65f15
/*
* 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
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/
MainAbility/
test/ConnectionJsunit.test.ets
→
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, it, expect} from
"deccjsunit/index"
;
import {describe, it, expect} from
'hypium/index'
;
import connection from '@ohos.net.connection'
import utils from './Utils.ets'
...
...
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/
MainAbility/
test/ConnectionSecondJsUnit.test.ets
→
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionSecondJsUnit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import connection from '@ohos.net.connection';
import {describe, it, expect} from '
deccjsunit
/index';
import {describe, it, expect} from '
hypium
/index';
import utils from './Utils.ets'
export default function connectionSecondJsUnit() {
...
...
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/
MainAbility/
test/List.test.ets
→
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/List.test.ets
浏览文件 @
b0b65f15
文件已移动
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/
MainAbility/
test/SocketJsunit.test.ets
→
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/SocketJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from
"deccjsunit/index"
;
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from
'hypium/index'
;
import socket from '@ohos.net.socket'
import utils from './Utils.ets'
...
...
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/
MainAbility/
test/Utils.ets
→
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/Utils.ets
浏览文件 @
b0b65f15
文件已移动
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/
MainAbility/
test/WebSocketJsunit.test.ets
→
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/WebSocketJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -14,7 +14,7 @@
* 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
'hypium/index'
;
import webSocket from '@ohos.net.webSocket'
import utils from './Utils.ets'
...
...
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/
MainAbility/
test/lib/Const.js
→
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/lib/Const.js
浏览文件 @
b0b65f15
文件已移动
telephony/telephonyjstest/netmanager_socket/entry/src/main/resources/base/element/string.json
浏览文件 @
b0b65f15
...
...
@@ -7,6 +7,14 @@
{
"name"
:
"description_mainability"
,
"value"
:
"ETS_Empty Ability"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js
浏览文件 @
b0b65f15
...
...
@@ -337,7 +337,43 @@ describe('ActsNetworkSearchTest', function () {
}
})
/**
* @tc.number Telephony_NetworkSearch_getOperatorName_Async_0500
* @tc.name testGetOperatorName_0500
* @tc.desc Test getOperatorName api by callback.
*/
it
(
'
Telephony_NetworkSearch_getOperatorName_Async_0500
'
,
0
,
async
function
(
done
)
{
radio
.
getOperatorName
(
0
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
`Telephony_NetworkSearch_getOperatorName_Async_0500 fail err:
${
err
}
`
);
expect
().
assertFail
();
done
();
return
;
}
console
.
log
(
`Telephony_NetworkSearch_getOperatorName_Async_0500 finish data:
${
data
}
`
);
expect
(
true
).
assertTrue
();
done
();
})
})
/**
* @tc.number Telephony_NetworkSearch_getOperatorName_Async_0600
* @tc.name testGetOperatorName_0600
* @tc.desc Test getOperatorName api by promise.
*/
it
(
'
Telephony_NetworkSearch_getOperatorName_Promise_0500
'
,
0
,
async
function
(
done
)
{
try
{
let
data
=
await
radio
.
getOperatorName
(
0
);
console
.
log
(
`Telephony_NetworkSearch_getOperatorName_Promise_0500 finish data:
${
data
}
`
);
expect
(
true
).
assertTrue
();
done
();
}
catch
(
err
)
{
console
.
log
(
`Telephony_NetworkSearch_getOperatorName_Promise_0500 fail err:
${
err
}
`
);
expect
().
assertFail
();
done
();
}
})
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Async_0200
* @tc.name Test The function isRadioOn
...
...
@@ -371,6 +407,39 @@ describe('ActsNetworkSearchTest', function () {
}
});
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Async_0300
* @tc.name testIsRadioOn_0300
* @tc.desc Test isRadioOn api by callback.
*/
it
(
'
Telephony_NetworkSearch_isRadioOn_Async_0300
'
,
0
,
async
function
(
done
)
{
radio
.
isRadioOn
(
0
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
`Telephony_NetworkSearch_isRadioOn_Async_0300 fail:
${
err
}
`
);
done
();
return
;
}
console
.
log
(
'
Telephony_NetworkSearch_isRadioOn_Async_0300 finish
'
);
done
();
});
});
/**
* @tc.number Telephony_NetworkSearch_isRadioOn_Async_0400
* @tc.name testIsRadioOn_0400
* @tc.desc Test isRadioOn api by promise.
*/
it
(
'
Telephony_NetworkSearch_isRadioOn_Promise_0300
'
,
0
,
async
function
(
done
)
{
try
{
await
radio
.
isRadioOn
(
0
);
console
.
log
(
'
Telephony_NetworkSearch_isRadioOn_Promise_0300 success
'
);
done
();
}
catch
(
err
)
{
console
.
log
(
`Telephony_NetworkSearch_isRadioOn_Promise_0300 fail
${
err
}
`
);
done
();
}
});
/**
* @tc.number Telephony_StateRegistry_on_0200
* @tc.name Add a networkStatus change listen and test observer.on({slotId:0}) to view the callback results
...
...
telephony/telephonyjstest/radiostatistic/BUILD.gn
浏览文件 @
b0b65f15
...
...
@@ -18,6 +18,7 @@ ohos_js_hap_suite("ActsRadiostatisticEtsTest") {
deps = [
":ace_demo_ets_assets",
":ace_demo_ets_resources",
":ace_demo_ets_test_assets",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
...
...
@@ -26,6 +27,9 @@ ohos_js_hap_suite("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"
...
...
telephony/telephonyjstest/radiostatistic/Test.json
浏览文件 @
b0b65f15
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"
OH
JSUnitTest"
,
"test-timeout"
:
"2000000"
,
"package"
:
"com.ohos.radiostatistic"
,
"shell-timeout"
:
"60000"
"bundle-name"
:
"com.ohos.radiostatistic"
,
"package-name"
:
"com.ohos.radiostatistic"
,
"shell-timeout"
:
"2000000"
},
"kits"
:
[
{
...
...
telephony/telephonyjstest/radiostatistic/entry/src/main/config.json
浏览文件 @
b0b65f15
...
...
@@ -17,7 +17,7 @@
"package"
:
"com.ohos.radiostatistic"
,
"name"
:
".MyApplication"
,
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
"
MainAbility
"
,
"srcPath"
:
""
,
"deviceType"
:
[
"phone"
],
...
...
@@ -50,6 +50,19 @@
"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"
:
[
...
...
@@ -133,6 +146,20 @@
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
...
...
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/MainAbility/pages/index.ets
浏览文件 @
b0b65f15
...
...
@@ -13,39 +13,11 @@
* 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() {
...
...
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestAbility/app.ets
0 → 100644
浏览文件 @
b0b65f15
/*
* 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
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
b0b65f15
/*
* 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
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
b0b65f15
/*
* 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
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/
MainAbility/
test/CallJsunit.test.ets
→
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/CallJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -13,7 +13,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 '
hypium/index
'
import call from '@ohos.telephony.call';
import utils from './Utils.ets'
...
...
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/
MainAbility/
test/ConvertOptionsJsunit.test.ets
→
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/ConvertOptionsJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
deccjsunit
/index'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
hypium
/index'
import convertxml from '@ohos.convertxml'
export default function convertOptionsJsunit() {
describe('XmlTest',function () {
...
...
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/
MainAbility/
test/DataJsunit.test.ets
→
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/DataJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -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 '
deccjsunit/index.ets
'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
hypium/index
'
import data from '@ohos.telephony.data';
...
...
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/
MainAbility/
test/List.test.ets
→
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/List.test.ets
浏览文件 @
b0b65f15
文件已移动
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/
MainAbility/
test/RadioJsunit.test.ets
→
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -49,7 +49,30 @@ export default function radioJsunit() {
});
});
/**
* @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0300
* @tc.name testGetPrimarySlotId_0300
* @tc.desc Test getPrimarySlotId api by promise.
*/
it('Telephony_NetworkSearch_getPrimarySlotId_Promise_0200', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
try {
let data = await radio.getPrimarySlotId();
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 pass data: ${data}`);
expect(true).assertTrue();
} catch (err) {
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 fail err: ${err}`);
expect().assertFail();
done();
return;
}
done();
});
/**
* @tc.number Telephony_NetworkSearch_isNrSupported_Promise_0400
* @tc.name Test The function setPrimarySlotId(0)
...
...
@@ -215,4 +238,4 @@ export default function radioJsunit() {
});
})
}
\ No newline at end of file
}
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/
MainAbility/
test/RadioSecondJsunit.test.ets
→
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioSecondJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -100,6 +100,76 @@ export default function radioSecondJsunit() {
});
})
/**
* @tc.number Telephony_NetworkSearch_NetworkState_Async_0300
* @tc.name testGetNetworkState_0300
* @tc.desc Test getNetworkState api by promise.
*/
it('Telephony_NetworkSearch_NetworkState_Promise_0100', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
const result = await radio.getNetworkState();
expect(true).assertTrue();
console.log(`Telephony_NetworkSearch_NetworkState_Promise_0100 test finish.`);
} catch (error) {
console.log(`Telephony_NetworkSearch_NetworkState_Promise_0100 error: ${error.message}`);
expect().assertFail();
}
done();
})
/**
* @tc.number Telephony_NetworkSearch_NetworkState_Async_0200
* @tc.name testGetNetworkState_0200
* @tc.desc Test getNetworkState() api by callback, slotId is 0, to check the callback result
*/
it('Telephony_NetworkSearch_NetworkState_Async_0200', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getNetworkState(0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_NetworkState_Async_0200 get fail err: ${err}`);
expect().assertFail();
done();
return;
}
console.log(`Telephony_NetworkSearch_NetworkState_Async_0200 end data: ${JSON.stringify(data)}`);
expect(true).assertTrue();
done();
return;
});
})
/**
* @tc.number Telephony_NetworkSearch_NetworkState_Async_0400
* @tc.name testGetNetworkState_0400
* @tc.desc Test getNetworkState() api by promise, slotId is 0, to check the callback result
*/
it('Telephony_NetworkSearch_NetworkState_Promise_0200', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
const result = await radio.getNetworkState(0);
expect(true).assertTrue();
console.log(`Telephony_NetworkSearch_NetworkState_Promise_0200 test finish.`);
} catch (error) {
console.log(`Telephony_NetworkSearch_NetworkState_Promise_0200 error: ${error.message}`);
expect().assertFail();
}
done();
})
/**
* @tc.number Telephony_Radio_CdmaCellInformation_sid_0100
* @tc.name sid
...
...
@@ -124,8 +194,172 @@ export default function radioSecondJsunit() {
console.log("-----------------------Telephony_Radio_CdmaCellInformation_sid_0100 end-----------------------");
})
/**
* @tc.number Telephony_NetworkSearch_getRadioTech_Async_0500
* @tc.name TestGetRadioTech_500
* @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}`);
expect(err.code === '-1').assertTrue();
done();
return;
}
console.log(`Telephony_NetworkSearch_getRadioTech_Async_0500 success ${data}`);
expect(true).assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_getRadioTech_Async_0600
* @tc.name testGetRadioTech_0600
* @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();
} catch (err) {
console.log(`Telephony_NetworkSearch_getRadioTech_Promise_0500 fail err: ${err}`);
expect().assertFail();
done();
return;
}
done();
});
/**
* @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Async_0600
* @tc.name testGetNetworkSelectionMode_0600
* @tc.desc SlotId parameter input is 0, test getNetworkSelectionMode() api by callback.
*/
it('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0600', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getNetworkSelectionMode(0, (err, res) => {
if (err) {
console.log(`Telephony_NetworkSearch_getNetworkSelectionMode_Async_0600 err: ${err}`);
expect().assertFail();
done();
} else {
console.log('Telephony_NetworkSearch_getNetworkSelectionMode_Async_0600 pass ${res}');
expect(true).assertTrue();
done();
}
});
});
/**
* @tc.number Telephony_NetworkSearch_getNetworkSelectionMode_Async_0700
* @tc.name testGetNetworkSelectionMode_0700
* @tc.desc SlotId parameter input is 0, test getNetworkSelectionMode() api by promise.
*/
it('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0600', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
await radio.getNetworkSelectionMode(0);
console.log('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0600 pass');
expect(true).assertTrue();
} catch (err) {
console.log('Telephony_NetworkSearch_getNetworkSelectionMode_Promise_0600 fail: ${err}');
expect().assertFail();
done();
return;
}
done();
});
/**
* @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500
* @tc.name testGetISOCountryCodeForNetwork_0500
* @tc.desc SlotId parameter input is 0, test getISOCountryCodeForNetwork() api by callback.
*/
it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500', 0, async function (done) {
radio.getISOCountryCodeForNetwork(0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 fail err: ${err}`);
expect().assertFail();
done();
return;
}
console.log(
`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 finish data: ${JSON.stringify(data)}`);
expect(true).assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0600
* @tc.name testGetISOCountryCodeForNetwork_0600
* @tc.desc SlotId parameter input is 0, test getISOCountryCodeForNetwork() api by promise.
*/
it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500', 0, async function (done) {
try {
let data = await radio.getISOCountryCodeForNetwork(0);
console.log(
`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500 finish data:${JSON.stringify(data)}`);
expect(true).assertTrue();
} catch (err) {
console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500 fail err: ${err}`);
expect().assertFail();
done();
return;
}
done();
});
/**
* @tc.number Telephony_NetworkSearch_getSignalInformation_Async_0500
* @tc.name testGetSignalInformation_0500
* @tc.desc SlotId parameter input is 0, test getSignalInformation() api by callback.
*/
it('Telephony_NetworkSearch_getSignalInformation_Async_0500', 0, async function (done) {
radio.getSignalInformation(0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getSignalInformation_Async_0500 fail err: ${err}`);
expect().assertFail();
done();
return;
}
console.log(`Telephony_NetworkSearch_getSignalInformation_Async_0500 finish data: ${JSON.stringify(data)}`);
expect(true).assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_getSignalInformation_Async_0600
* @tc.name testGetSignalInformation_0600
* @tc.desc SlotId parameter input is 0, test getSignalInformation() api by promise.
*/
it('Telephony_NetworkSearch_getSignalInformation_Promise_0500', 0, async function (done) {
try {
let data = await radio.getSignalInformation(0);
console.log(
`Telephony_NetworkSearch_getSignalInformation_Promise_0500 pass data: ${JSON.stringify(data)}`);
expect(true).assertTrue();
} catch (err) {
console.log(`Telephony_NetworkSearch_getSignalInformation_Promise_0500 fail err: ${err}`);
expect().assertFail();
done();
return;
}
done();
});
console.log("************* radio Test end*************");
function assertCellInformation(data) {
expect(data !== '' && data != undefined && data != null).assertTrue();
...
...
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/
MainAbility/
test/SmsMmsJsunit.test.ets
→
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/SmsMmsJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -73,7 +73,40 @@ export default function smsUiJsunit() {
});
});
/*
* @tc.number Telephony_SmsMms_createMessage_Async_0300
* @tc.name testCreateMessage_0300
* @tc.desc Call interface CreateMessage,
* pass in the PDU(rawArray) in line with the coding specification, the specification is 3GPP,
* shortMessage Don't empty
*/
it('Telephony_SmsMms_createMessage_Promise_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
sms.createMessage(rawArray, '3gpp').then(shortMessage => {
expect(shortMessage.visibleMessageBody === MESSAGEBODY).assertTrue();
expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue();
expect(shortMessage.protocolId === 0).assertTrue();
expect(shortMessage.scAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.scTimestamp === SC_TIMESTAMP).assertTrue();
expect(shortMessage.isReplaceMessage).assertFalse();
expect(shortMessage.hasReplyPath).assertFalse();
expect(shortMessage.pdu.length > 0).assertTrue();
expect(shortMessage.status === 0).assertTrue();
expect(shortMessage.isSmsStatusReportMessage).assertTrue();
console.log('Telephony_SmsMms_createMessage_Promise_0100 finish');
done();
}).catch(err => {
expect().assertFail();
console.log('Telephony_SmsMms_createMessage_Promise_0100 fail');
done();
return;
});
});
/*
...
...
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/
MainAbility/
test/StatisticsJsunit.test.ets
→
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/StatisticsJsunit.test.ets
浏览文件 @
b0b65f15
...
...
@@ -13,7 +13,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
'hypium/index'
;
import statistics from '@ohos.net.statistics';
import utils from './Utils.ets'
export default function statisticsUiJsunit() {
...
...
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/
MainAbility/
test/Utils.ets
→
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/Utils.ets
浏览文件 @
b0b65f15
文件已移动
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/
MainAbility/
test/lib/Const.js
→
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/lib/Const.js
浏览文件 @
b0b65f15
文件已移动
telephony/telephonyjstest/radiostatistic/entry/src/main/resources/base/element/string.json
浏览文件 @
b0b65f15
...
...
@@ -7,6 +7,14 @@
{
"name"
:
"description_mainability"
,
"value"
:
"ETS_Empty Ability"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js
浏览文件 @
b0b65f15
...
...
@@ -258,11 +258,6 @@ describe('SimManagerTest', function () {
done
();
});
/**
* @tc.number Telephony_Sim_getDefaultVoiceSlotId_Async_0200
* @tc.name The test first sets the default card number and then calls
...
...
@@ -278,7 +273,7 @@ describe('SimManagerTest', function () {
done
();
return
;
}
expect
(
).
assertFail
();
expect
(
data
===
0
||
data
===
1
).
assertTrue
();
done
();
});
});
...
...
@@ -294,7 +289,7 @@ describe('SimManagerTest', function () {
try
{
let
data
=
await
sim
.
getDefaultVoiceSlotId
();
console
.
log
(
`
${
CASE_NAME
}
, data =
${
data
}
`
);
expect
(
).
assertFail
();
expect
(
data
===
0
||
data
===
1
).
assertTrue
();
}
catch
(
err
)
{
console
.
log
(
`
${
CASE_NAME
}
expect err:
${
err
.
message
}
`
);
console
.
log
(
`
${
CASE_NAME
}
finish`
);
...
...
@@ -302,17 +297,6 @@ describe('SimManagerTest', function () {
done
();
});
/**
* @tc.number Telephony_Sim_isSimActive_Async_0700
* @tc.name Test the slotId exception input parameter 2 during isSimActive interface card activation,
...
...
@@ -355,10 +339,6 @@ describe('SimManagerTest', function () {
done
();
});
/**
* @tc.number Telephony_Sim_hasSimCard_Async_0600
* @tc.name Test the slotId exception input parameter 2 of the hasSimCard interface,
...
...
@@ -401,19 +381,6 @@ describe('SimManagerTest', function () {
done
();
});
/**
* @tc.number Telephony_Sim_getMaxSimCount_0100
* @tc.name Test the getMaxSimCount interface and view the callback result
...
...
@@ -427,7 +394,6 @@ describe('SimManagerTest', function () {
done
();
});
/**
* @tc.number Telephony_Sim_GetCardType_Async_0400
* @tc.name Verify that the slotId of the GetCardType async callback interface is abnormal
...
...
@@ -468,10 +434,6 @@ describe('SimManagerTest', function () {
done
();
});
/**
* @tc.number Telephony_Sim_hasOperatorPrivileges_Async_0400
* @tc.name Test hasOperatorPrivileges interface slotId exception enter parameter 2,
...
...
@@ -511,4 +473,5 @@ describe('SimManagerTest', function () {
}
done
();
});
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录