Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
5b2e803e
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
5b2e803e
编写于
8月 16, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 16, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9763 应用事件接口参数变更用例适配
Merge pull request !9763 from chenxuihui/master
上级
821b3f11
2318baaa
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
188 addition
and
4 deletion
+188
-4
hiviewdfx/hiappeventtest/hiappeventjstest/src/main/js/test/HiAppEvent.test.js
...test/hiappeventjstest/src/main/js/test/HiAppEvent.test.js
+184
-0
hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/test/HiAppEventSubSecond.test.js
...entsubjstest/src/main/js/test/HiAppEventSubSecond.test.js
+4
-4
未找到文件。
hiviewdfx/hiappeventtest/hiappeventjstest/src/main/js/test/HiAppEvent.test.js
浏览文件 @
5b2e803e
...
...
@@ -45,6 +45,28 @@ describe('HiAppEventApiTest', function () {
});
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_0200
* @tc.name testHiAppEventApi02
* @tc.desc 验证write(API7)接口,使用Promise异步回调可打点32以内各类型参数的事件,可调用成功,无返回错误码.
*/
it
(
'
testHiAppEventApi02
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventApi02 start
'
)
HiAppEvent
.
write
(
"
write
"
,
HiAppEvent
.
EventType
.
FAULT
,
{
"
key_int
"
:
100
,
"
key_string
"
:
"
demo
"
,
"
key_bool
"
:
true
,
"
key_float
"
:
1.1
,
"
key_array_int
"
:
[
1
,
2
,
3
],
"
key_array_float
"
:
[
1.1
,
2.2
,
3.3
],
"
key_array_str
"
:
[
"
a
"
,
"
b
"
,
"
c
"
],
"
key_array_bool
"
:
[
true
,
false
],
"
key_array_int2
"
:
[
1
,
2
,
3
],
"
key_arr_float2
"
:
[
1.1
,
2.2
,
3.3
],
"
key_arr_str2
"
:
[
"
a
"
,
"
b
"
,
"
c
"
],
"
key_array_bool2
"
:
[
true
,
false
]
}).
then
((
value
)
=>
{
console
.
log
(
`testHiAppEventApi02 success to write event:
${
value
}
`
);
expect
(
value
==
0
).
assertTrue
();
done
();
}).
catch
((
err
)
=>
{
console
.
error
(
`testHiAppEventApi02 failed to write event because
${
err
.
code
}
`
);
expect
().
assertFail
();
done
();
});
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_0300
* @tc.name testHiAppEventApi03
...
...
@@ -615,9 +637,11 @@ describe('HiAppEventApiTest', function () {
}
}).
then
((
value
)
=>
{
console
.
log
(
`success to write event:
${
value
}
`
);
expect
(
value
==
0
).
assertTrue
()
done
();
}).
catch
((
err
)
=>
{
console
.
error
(
`failed to write event because
${
err
.
code
}
`
);
expect
().
assertFail
()
});
console
.
info
(
'
testHiAppEventApi26 end
'
)
})
...
...
@@ -642,12 +666,172 @@ describe('HiAppEventApiTest', function () {
},
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`failed to write event because
${
err
.
code
}
`
);
expect
().
assertFail
();
done
();
}
console
.
log
(
`success to write event:
${
value
}
`
)
expect
(
value
==
0
).
assertTrue
()
done
();
});
console
.
info
(
'
testHiAppEventApi27 end
'
)
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2800
* @tc.name testHiAppEventApi28
* @tc.desc 验证Write(API9)接口传入参数为特殊number,中文字符,可调用成功,无返回错误码.
*/
it
(
'
testHiAppEventApi28
'
,
2
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventApi28 start
'
)
HiAppEventV9
.
write
({
domain
:
"
test_domain
"
,
name
:
"
test_event
"
,
eventType
:
HiAppEventV9
.
EventType
.
FAULT
,
params
:
{
"
key_max
"
:
Number
.
MAX_VALUE
,
"
key_min
"
:
Number
.
MIN_VALUE
,
"
key_chinese
"
:
"
中文
"
}
},
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`testHiAppEventApi28 failed to write event because
${
err
.
code
}
`
);
expect
().
assertFail
();
done
();
}
console
.
log
(
`testHiAppEventApi28 success to write event:
${
value
}
`
)
expect
(
value
==
0
).
assertTrue
()
done
();
});
console
.
info
(
'
testHiAppEventApi28 end
'
)
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2900
* @tc.name testHiAppEventApi29
* @tc.desc 验证Write(API9)接口成功,传入参数名称可以符合规格.
*/
it
(
'
testHiAppEventApi29
'
,
2
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventApi29 start
'
)
HiAppEventV9
.
write
({
domain
:
"
test_domain
"
,
name
:
"
test_event
"
,
eventType
:
HiAppEventV9
.
EventType
.
FAULT
,
params
:
{
"
kEy9_int
"
:
100
,
"
KEy99_strinG_KEY
"
:
"
demo
"
,
"
$kEy9_bool9
"
:
true
}
},
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`testHiAppEventApi29 failed to write event because
${
err
.
code
}
`
);
expect
().
assertFail
();
done
();
}
console
.
log
(
`testHiAppEventApi29 success to write event:
${
value
}
`
)
expect
(
value
==
0
).
assertTrue
()
done
();
});
console
.
info
(
'
testHiAppEventApi29 end
'
)
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_3000
* @tc.name testHiAppEventApi30
* @tc.desc 验证Write(API9)接口成功,传入事件名称大写字母、小写字母、数字、_为中间字符,大写字母为开头和结尾.
*/
it
(
'
testHiAppEventApi30
'
,
2
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventApi30 start
'
)
HiAppEventV9
.
write
({
domain
:
"
test_domain
"
,
name
:
"
TEst9_evenT
"
,
eventType
:
HiAppEventV9
.
EventType
.
FAULT
,
params
:
{
"
key_int
"
:
100
,
"
key_string
"
:
"
demo
"
}
},
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`testHiAppEventApi30 failed to write event because
${
err
.
code
}
`
);
expect
().
assertFail
();
done
();
}
console
.
log
(
`testHiAppEventApi30 success to write event:
${
value
}
`
)
expect
(
value
==
0
).
assertTrue
()
done
();
});
console
.
info
(
'
testHiAppEventApi30 end
'
)
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_3100
* @tc.name testHiAppEventApi31
* @tc.desc 验证Write(API9)接口成功,传入事件名称大写字母、小写字母、数字、_为中间字符,小写字母为开头和结尾.
*/
it
(
'
testHiAppEventApi31
'
,
2
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventApi31 start
'
)
HiAppEventV9
.
write
({
domain
:
"
test_domain
"
,
name
:
"
tEst9_event
"
,
eventType
:
HiAppEventV9
.
EventType
.
FAULT
,
params
:
{
"
key_int
"
:
100
,
"
key_string
"
:
"
demo
"
}
},
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`testHiAppEventApi31 failed to write event because
${
err
.
code
}
`
);
expect
().
assertFail
();
done
();
}
console
.
log
(
`testHiAppEventApi31 success to write event:
${
value
}
`
)
expect
(
value
==
0
).
assertTrue
()
done
();
});
console
.
info
(
'
testHiAppEventApi31 end
'
)
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_3200
* @tc.name testHiAppEventApi32
* @tc.desc 验证Write(API9)接口成功,传入事件名称大写字母、小写字母、数字、_为中间字符,$开头,以数字结尾,长度48字符.
*/
it
(
'
testHiAppEventApi32
'
,
2
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventApi32 start
'
)
HiAppEventV9
.
write
({
domain
:
"
test_domain
"
,
name
:
"
$tEst9_event9_tEst9_event9_tEst9_event9_tEst9_e9
"
,
eventType
:
HiAppEventV9
.
EventType
.
FAULT
,
params
:
{
"
key_int
"
:
100
,
"
key_string
"
:
"
demo
"
}
},
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
error
(
`testHiAppEventApi32 failed to write event because
${
err
.
code
}
`
);
expect
().
assertFail
();
done
();
}
console
.
log
(
`testHiAppEventApi32 success to write event:
${
value
}
`
)
expect
(
value
==
0
).
assertTrue
()
done
();
});
console
.
info
(
'
testHiAppEventApi32 end
'
)
})
/**
* @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_3300
* @tc.name testHiAppEventApi33
* @tc.desc HiAppEvent configure interface with disable option set false.
*/
it
(
'
testHiAppEventApi33
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testHiAppEventApi33 start
'
)
try
{
HiAppEventV9
.
configure
({
disable
:
true
});
HiAppEventV9
.
configure
({});
HiAppEventV9
.
configure
({
disable
:
false
});
HiAppEventV9
.
configure
({
maxStorage
:
'
100M
'
})
expect
(
true
).
assertTrue
()
}
catch
(
err
)
{
console
.
info
(
`testHiAppEventApi33 err ,err code is
${
err
.
code
}
, err message is
${
err
.
message
}
`
)
expect
().
assertFail
();
}
console
.
info
(
'
testHiAppEventApi33 end
'
)
done
()
})
})
}
\ No newline at end of file
hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/test/HiAppEventSubSecond.test.js
浏览文件 @
5b2e803e
...
...
@@ -410,7 +410,7 @@ describe('HiAppEventSubSecondTest', function () {
/**
* @tc.number DFX_DFT_HiAppEvent_Sub_4200
* @tc.name 验证调用write接口,事件名称
大写字母
开头,打点错误,返回错误码11101002
* @tc.name 验证调用write接口,事件名称
数字
开头,打点错误,返回错误码11101002
* @tc.desc HiAppEvent write interface test.
*/
it
(
'
HiAppEventSub42
'
,
3
,
async
function
(
done
)
{
...
...
@@ -418,7 +418,7 @@ describe('HiAppEventSubSecondTest', function () {
try
{
HiAppEventV9
.
write
({
domain
:
"
test_domain
"
,
name
:
"
Test_event
"
,
name
:
"
9
Test_event
"
,
eventType
:
HiAppEventV9
.
EventType
.
FAULT
,
params
:
{
int_data
:
100
,
...
...
@@ -643,7 +643,7 @@ describe('HiAppEventSubSecondTest', function () {
/**
* @tc.number DFX_DFT_HiAppEvent_Sub_4900
* @tc.name 验证调用write接口,事件参数名称
大写字母
开头,忽略相关事件参数,返回错误码11101005
* @tc.name 验证调用write接口,事件参数名称
数字
开头,忽略相关事件参数,返回错误码11101005
* @tc.desc HiAppEvent write interface test.
*/
it
(
'
HiAppEventSub49
'
,
3
,
async
function
(
done
)
{
...
...
@@ -654,7 +654,7 @@ describe('HiAppEventSubSecondTest', function () {
name
:
"
test_event
"
,
eventType
:
HiAppEventV9
.
EventType
.
FAULT
,
params
:
{
Int_data
:
100
,
"
9Int_data
"
:
100
,
str_data
:
"
strValue
"
}
},
(
err
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录