Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
046465f5
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看板
未验证
提交
046465f5
编写于
6月 27, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3826 hitracejs test suites bugfix
Merge pull request !3826 from chenxuihui/monthly_20220614
上级
10a1144d
10c61450
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
117 addition
and
16 deletion
+117
-16
hiviewdfx/hitracechainjstest/src/main/js/default/test/HiTraceChainJs.test.js
...ainjstest/src/main/js/default/test/HiTraceChainJs.test.js
+117
-16
未找到文件。
hiviewdfx/hitracechainjstest/src/main/js/default/test/HiTraceChainJs.test.js
浏览文件 @
046465f5
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
HiTraceChain
from
'
@ohos.H
iTraceChain
'
import
hiTraceChain
from
'
@ohos.h
iTraceChain
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
hilog
from
'
@ohos.hilog
'
...
...
@@ -37,7 +37,7 @@ describe('HiTraceJsTest', function () {
* @tc.name hitrace interface test
* @tc.desc hitrace begin interface test.
*/
it
(
'
testHi
AppEvent
Api01
'
,
1
,
async
function
(
done
)
{
it
(
'
testHi
trace
Api01
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi01 start
'
);
try
{
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace01
"
);
...
...
@@ -61,7 +61,7 @@ describe('HiTraceJsTest', function () {
* @tc.name hitrace interface test
* @tc.desc hitrace begin interface test.
*/
it
(
'
testHi
AppEvent
Api02
'
,
1
,
async
function
(
done
)
{
it
(
'
testHi
trace
Api02
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi02 start
'
);
try
{
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace02
"
,
hiTraceChain
.
HiTraceFlag
.
INCLUDE_ASYNC
|
...
...
@@ -86,15 +86,17 @@ describe('HiTraceJsTest', function () {
* @tc.name hitrace interface test
* @tc.desc hitrace begin interface test.
*/
it
(
'
testHi
AppEvent
Api03
'
,
1
,
async
function
(
done
)
{
it
(
'
testHi
trace
Api03
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi03 start
'
);
try
{
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace03
"
,
hiTraceChain
.
HiTraceFlag
.
TP_INFO
);
let
curTraceId
=
hiTraceChain
.
getId
();
if
(
traceId
!==
curTrace
Id
){
if
(
traceId
.
chainId
!=
curTraceId
.
chain
Id
){
expect
().
assertFail
();
console
.
log
(
`testHitraceApi03 got an error:
${
JSON
.
stringify
(
error
)}
`
);
}
hiTraceChain
.
tracepoint
(
hiTraceChain
.
HiTraceCommunicationMode
.
THREAD
,
hiTraceChain
.
HiTraceTracepointType
.
SS
,
traceId
,
"
hitrace api test.
"
);
hiTraceChain
.
end
(
traceId
);
}
catch
(
error
){
console
.
log
(
`testHitraceApi03 got an error:
${
JSON
.
stringify
(
error
)}
`
);
...
...
@@ -110,7 +112,7 @@ describe('HiTraceJsTest', function () {
* @tc.name hitrace interface test
* @tc.desc hitrace begin interface test.
*/
it
(
'
testHi
AppEvent
Api04
'
,
1
,
async
function
(
done
)
{
it
(
'
testHi
trace
Api04
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi04 start
'
);
try
{
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace04
"
,
hiTraceChain
.
HiTraceFlag
.
NO_BE_INFO
);
...
...
@@ -135,11 +137,11 @@ describe('HiTraceJsTest', function () {
* @tc.name hitrace interface test
* @tc.desc hitrace begin interface test.
*/
it
(
'
testHi
AppEvent
Api05
'
,
1
,
async
function
(
done
)
{
it
(
'
testHi
trace
Api05
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi05 start
'
);
try
{
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace05
"
);
hiTraceChain
.
enable
(
asyncT
raceId
,
hiTraceChain
.
HiTraceFlag
.
DISABLE_LOG
);
hiTraceChain
.
enable
Flag
(
t
raceId
,
hiTraceChain
.
HiTraceFlag
.
DISABLE_LOG
);
let
enabledDoNotCreateSpanFlag
=
hiTraceChain
.
isFlagEnabled
(
traceId
,
hiTraceChain
.
HiTraceFlag
.
DISABLE_LOG
);
if
(
!
enabledDoNotCreateSpanFlag
){
expect
().
assertFail
();
...
...
@@ -160,11 +162,11 @@ describe('HiTraceJsTest', function () {
* @tc.name hitrace interface test
* @tc.desc hitrace begin interface test.
*/
it
(
'
testHi
AppEvent
Api06
'
,
1
,
async
function
(
done
)
{
it
(
'
testHi
trace
Api06
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi06 start
'
);
try
{
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace06
"
);
hiTraceChain
.
enable
(
asyncT
raceId
,
hiTraceChain
.
HiTraceFlag
.
FAILURE_TRIGGER
);
hiTraceChain
.
enable
Flag
(
t
raceId
,
hiTraceChain
.
HiTraceFlag
.
FAILURE_TRIGGER
);
let
enabledDoNotCreateSpanFlag
=
hiTraceChain
.
isFlagEnabled
(
traceId
,
hiTraceChain
.
HiTraceFlag
.
FAILURE_TRIGGER
);
if
(
!
enabledDoNotCreateSpanFlag
){
...
...
@@ -186,7 +188,7 @@ describe('HiTraceJsTest', function () {
* @tc.name hitrace interface test
* @tc.desc hitrace begin interface test.
*/
it
(
'
testHi
AppEvent
Api07
'
,
1
,
async
function
(
done
)
{
it
(
'
testHi
trace
Api07
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi07 start
'
);
try
{
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace07
"
,
hiTraceChain
.
HiTraceFlag
.
D2D_TP_INFO
);
...
...
@@ -195,6 +197,8 @@ describe('HiTraceJsTest', function () {
expect
().
assertFail
();
console
.
log
(
`testHitraceApi07 got an error:
${
JSON
.
stringify
(
error
)}
`
);
}
hiTraceChain
.
tracepoint
(
hiTraceChain
.
HiTraceCommunicationMode
.
PROCESS
,
hiTraceChain
.
HiTraceTracepointType
.
CS
,
traceId
,
"
hitrace test
"
);
hiTraceChain
.
end
(
traceId
);
}
catch
(
error
){
console
.
log
(
`testHitraceApi07 got an error:
${
JSON
.
stringify
(
error
)}
`
);
...
...
@@ -210,17 +214,17 @@ describe('HiTraceJsTest', function () {
* @tc.name hitrace interface test
* @tc.desc hitrace begin interface test.
*/
it
(
'
testHi
AppEvent
Api08
'
,
1
,
async
function
(
done
)
{
it
(
'
testHi
trace
Api08
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi08 start
'
);
hiTraceChain
.
clearId
();
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace
08
"
,
hiTraceChain
.
HiTraceFlag
.
INCLUDE_ASYNC
);
let
traceId
=
hiTraceChain
.
begin
(
"
testHitraceApi
08
"
,
hiTraceChain
.
HiTraceFlag
.
INCLUDE_ASYNC
);
let
curChainId
=
traceId
.
chainId
;
new
Promise
(
function
(
resolve
,
reject
){
resolve
()
}).
then
(()
=>
{
console
.
info
(
'
in testHitraceApi08 then callback
'
)
console
.
info
(
`testHitraceApi08
${
hiTraceChain
.
getId
().
chainId
}
<>
${
curChainId
}
`
)
ex
cep
t
(
hiTraceChain
.
getId
().
chainId
==
curChainId
).
assertTrue
()
ex
pec
t
(
hiTraceChain
.
getId
().
chainId
==
curChainId
).
assertTrue
()
done
()
})
hiTraceChain
.
end
(
traceId
);
...
...
@@ -234,7 +238,7 @@ describe('HiTraceJsTest', function () {
* @tc.name hitrace interface test
* @tc.desc hitrace begin interface test.
*/
it
(
'
testHi
AppEvent
Api09
'
,
1
,
async
function
(
done
)
{
it
(
'
testHi
trace
Api09
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi09 start
'
);
hiTraceChain
.
clearId
();
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace09
"
,
hiTraceChain
.
HiTraceFlag
.
INCLUDE_ASYNC
);
...
...
@@ -244,11 +248,108 @@ describe('HiTraceJsTest', function () {
asyncTask
().
then
(()
=>
{
console
.
info
(
'
in testhiTraceApi09 then callback
'
)
console
.
info
(
`testHitraceApi09
${
hiTraceChain
.
getId
().
chainId
}
<>
${
curChainId
}
`
)
ex
cep
t
(
hiTraceChain
.
getId
().
chainId
==
curChainId
).
assertTrue
()
ex
pec
t
(
hiTraceChain
.
getId
().
chainId
==
curChainId
).
assertTrue
()
done
()
})
hiTraceChain
.
end
(
traceId
);
done
()
console
.
info
(
'
testHitraceApi09 end
'
);
})
/**
* @tc.name: 接口测试-hitrace接口支持跨设备跟踪
* @tc.number DFX_DFT_Hitrace_JS_010
* @tc.function A01010
* @tc.feature DFX_DFT_Hitrace
* @tc.level Level3
* @tc.type FUNC
* @tc.author chenxuhui
*/
it
(
'
testHitraceApi10
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi10 start
'
)
hiTraceChain
.
clearId
();
try
{
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace10
"
,
hiTraceChain
.
HiTraceFlag
.
D2D_TP_INFO
);
let
enabledDoNotCreateSpanFlag
=
hiTraceChain
.
isFlagEnabled
(
traceId
,
hiTraceChain
.
HiTraceFlag
.
D2D_TP_INFO
);
if
(
!
enabledDoNotCreateSpanFlag
){
expect
().
assertFail
();
console
.
log
(
`testHitraceApi10 got an error:
${
JSON
.
stringify
(
error
)}
`
);
}
hiTraceChain
.
tracepoint
(
hiTraceChain
.
HiTraceCommunicationMode
.
DEVICE
,
hiTraceChain
.
HiTraceTracepointType
.
CR
,
traceId
,
"
hitrace test
"
);
hiTraceChain
.
end
(
traceId
);
}
catch
(
error
)
{
console
.
log
(
`testHitraceApi10 got an error:
${
JSON
.
stringify
(
error
)}
`
);
expect
().
assertFail
();
done
()
}
console
.
info
(
'
testHitraceApi10 end
'
)
done
()
});
/**
* @tc.name: 接口测试-hitrace接口支持跨设备跟踪
* @tc.number DFX_DFT_Hitrace_JS_011
* @tc.function A01011
* @tc.feature DFX_DFT_Hitrace
* @tc.level Level3
* @tc.type FUNC
* @tc.author chenxuhui
*/
it
(
'
testHitraceApi11
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi11 start
'
)
hiTraceChain
.
setId
(
12345678
);
hiTraceChain
.
clearId
();
try
{
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace11
"
,
hiTraceChain
.
HiTraceFlag
.
D2D_TP_INFO
);
let
flags
=
traceId
.
flags
let
parentSpanId
=
traceId
.
parentSpanId
let
spanId
=
traceId
.
spanId
let
enabledDoNotCreateSpanFlag
=
hiTraceChain
.
isFlagEnabled
(
traceId
,
hiTraceChain
.
HiTraceFlag
.
D2D_TP_INFO
);
if
(
!
enabledDoNotCreateSpanFlag
){
expect
().
assertFail
();
console
.
log
(
`testHitraceApi11 got an error:
${
JSON
.
stringify
(
error
)}
`
);
}
hiTraceChain
.
tracepoint
(
hiTraceChain
.
HiTraceCommunicationMode
.
DEFAULT
,
hiTraceChain
.
HiTraceTracepointType
.
SR
,
traceId
,
"
hitrace test
"
);
hiTraceChain
.
end
(
traceId
);
}
catch
(
error
)
{
console
.
log
(
`testHitraceApi11 got an error:
${
JSON
.
stringify
(
error
)}
`
);
expect
().
assertFail
();
done
()
}
console
.
info
(
'
testHitraceApi11 end
'
)
done
()
});
/**
* @tc.name: 接口测试-hitrace接口支持跨设备跟踪
* @tc.number DFX_DFT_Hitrace_JS_012
* @tc.function A01010
* @tc.feature DFX_DFT_Hitrace
* @tc.level Level3
* @tc.type FUNC
* @tc.author chenxuhui
*/
it
(
'
testHitraceApi12
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testHitraceApi12 start
'
)
try
{
let
traceId
=
hiTraceChain
.
begin
(
"
hitrace12
"
,
hiTraceChain
.
HiTraceFlag
.
D2D_TP_INFO
);
let
enabledDoNotCreateSpanFlag
=
hiTraceChain
.
isFlagEnabled
(
traceId
,
hiTraceChain
.
HiTraceFlag
.
D2D_TP_INFO
);
if
(
!
enabledDoNotCreateSpanFlag
){
expect
().
assertFail
();
console
.
log
(
`testHitraceApi12 got an error:
${
JSON
.
stringify
(
error
)}
`
);
}
hiTraceChain
.
tracepoint
(
hiTraceChain
.
HiTraceCommunicationMode
.
DEVICE
,
hiTraceChain
.
HiTraceTracepointType
.
GENERAL
,
traceId
,
"
hitrace test
"
);
hiTraceChain
.
end
(
traceId
);
}
catch
(
error
)
{
console
.
log
(
`testHitraceApi12 got an error:
${
JSON
.
stringify
(
error
)}
`
);
expect
().
assertFail
();
done
()
}
console
.
info
(
'
testHitraceApi12 end
'
)
done
()
});
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录