Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
97a05f5e
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,发现更多精彩内容 >>
未验证
提交
97a05f5e
编写于
7月 01, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 01, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4018 add sensor tests
Merge pull request !4018 from liuzixuan/master
上级
524f1c41
44ea1e4c
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
574 addition
and
0 deletion
+574
-0
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_GetSensorLists.js
...in/js/default/test/SensorOnOffTest.test_GetSensorLists.js
+187
-0
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_GetSingleSensor.js
...n/js/default/test/SensorOnOffTest.test_GetSingleSensor.js
+387
-0
未找到文件。
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_GetSensorLists.js
0 → 100644
浏览文件 @
97a05f5e
/*
* Copyright (C) 2021 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
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest_sensor_35
"
,
function
()
{
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll caled
'
)
})
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll caled
'
)
})
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach caled
'
)
})
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach caled
'
)
})
let
errMessage
;
let
invild
;
let
errMessages
=
[
'
Wrong argument type, should be function
'
,
'
The number of parameters is not valid
'
,
'
xxx is not defined
'
];
/**
* @tc.number:SUB_SensorsSystem_GetSensorLists_JSTest_0010
* @tc.name: getSensorLists_SensorJsTest001
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
"
getSensorLists_SensorJsTest001
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest001----------------------------------
"
);
sensor
.
getSensorList
().
then
((
data
)
=>
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest001 in-----------
"
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
"
getSensorLists_SensorJsTest001
"
+
JSON
.
stringify
(
data
[
i
]));
}
done
();
},
(
error
)
=>
{
console
.
info
(
'
getSensorLists_SensorJsTest001 failed
'
);
expect
(
false
).
assertTrue
();
});
})
/**
* @tc.number:SUB_SensorsSystem_GetSensorLists_JSTest_0020
* @tc.name: getSensorLists_SensorJsTest002
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
"
getSensorLists_SensorJsTest002
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest002----------------------------------
"
);
sensor
.
getSensorList
((
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
getSensorLists_SensorJsTest002 error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest002 in-----------
"
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
"
getSensorLists_SensorJsTest002
"
+
JSON
.
stringify
(
data
[
i
]));
}
done
()
}
});
})
/**
* @tc.number:SUB_SensorsSystem_GetSensorLists_JSTest_0030
* @tc.name: getSensorLists_SensorJsTest003
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
"
getSensorLists_SensorJsTest003
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest003----------------------------------
"
);
try
{
sensor
.
getSensorList
(
null
)
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
23
,
62
);
console
.
info
(
'
getSensorLists_SensorJsTest003 error:
'
+
error
);
console
.
info
(
'
getSensorLists_SensorJsTest003 errMessage:
'
+
errMessage
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
}
})
/**
* @tc.number:SUB_SensorsSystem_GetSensorLists_JSTest_0040
* @tc.name: getSensorLists_SensorJsTest004
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
'
getSensorLists_SensorJsTest004
'
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
------------------getSensorLists_SensorJsTest004-------------------------
"
);
try
{
sensor
.
getSensorList
(
invild
)
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
23
,
62
);
console
.
info
(
'
getSensorLists_SensorJsTest004 error:
'
+
error
);
console
.
info
(
'
getSensorLists_SensorJsTest004 errMessage:
'
+
errMessage
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
}
})
/**
* @tc.number:SUB_SensorsSystem_GetSensorLists_JSTest_0050
* @tc.name: getSensorLists_SensorJsTest005
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
'
getSensorLists_SensorJsTest005
'
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
------------------getSensorLists_SensorJsTest005-------------------------
"
);
try
{
sensor
.
getSensorList
(
'
xxx
'
)
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
23
,
62
);
console
.
info
(
'
getSensorLists_SensorJsTest005 error:
'
+
error
);
console
.
info
(
'
getSensorLists_SensorJsTest005 errMessage:
'
+
errMessage
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
}
})
/**
* @tc.number:SUB_SensorsSystem_GetSensorLists_JSTest_0060
* @tc.name: getSensorLists_SensorJsTest006
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
"
getSensorLists_SensorJsTest006
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest006----------------------------------
"
);
sensor
.
getSensorList
((
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
getSensorLists_SensorJsTest006 error
'
);
expect
(
true
).
assertTrue
();
done
()
}
else
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest006 in-----------
"
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
"
getSensorLists_SensorJsTest006
"
+
JSON
.
stringify
(
data
[
i
]));
}
done
()
}
});
sensor
.
getSensorList
((
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
getSensorLists_SensorJsTest006 error
'
);
expect
(
true
).
assertTrue
();
done
()
}
else
{
console
.
info
(
"
---------------------------getSensorLists_SensorJsTest006 in-----------
"
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
info
(
"
getSensorLists_SensorJsTest006
"
+
JSON
.
stringify
(
data
[
i
]));
}
done
()
}
});
})
})
sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test_GetSingleSensor.js
0 → 100644
浏览文件 @
97a05f5e
/*
* Copyright (C) 2021 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
sensor
from
'
@ohos.sensor
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
"
SensorJsTest_sensor_36
"
,
function
()
{
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll caled
'
)
})
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll caled
'
)
})
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach caled
'
)
})
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach caled
'
)
})
let
errMessage
;
let
invild
;
let
testNullSensorId
=
-
1
;
let
errMessages
=
[
'
Wrong argument type, get number fail
'
,
'
The number of parameters is not valid
'
,
'
xxx is not defined
'
,
'
[object Object]
'
];
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0010
* @tc.name: GetSingleSensor_JSTest_001
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
'
GetSingleSensor_JSTest_0010
'
,
FUNCTION
|
MEDIUMTEST
|
LEVEL0
,
async
function
(
done
)
{
console
.
info
(
"
------------------GetSingleSensor_JSTest_001-------------------------
"
);
sensor
.
getSingleSensor
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
GetSingleSensor_JSTest_001 failed
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
)
},
500
)
}
else
{
console
.
info
(
"
GetSingleSensor_JSTest_001
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
sensorName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
vendorName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
firmwareVersion
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
hardwareVersion
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
sensorTypeId
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
maxRange
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
precision
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
power
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
done
();
},
500
)
}
})
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0020
* @tc.name: GetSingleSensor_JSTest_002
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
'
GetSingleSensor_JSTest_002
'
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
------------------GetSingleSensor_JSTest_002-------------------------
"
);
try
{
sensor
.
getSingleSensor
()
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
25
,
62
);
console
.
info
(
'
GetSingleSensor_JSTest_002 error:
'
+
error
);
console
.
info
(
'
GetSingleSensor_JSTest_002 errMessage:
'
+
errMessage
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
}
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0030
* @tc.name: GetSingleSensor_JSTest_003
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
'
GetSingleSensor_JSTest_003
'
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
------------------GetSingleSensor_JSTest_003-------------------------
"
);
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
GetSingleSensor_JSTest_003 failed
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
)
},
500
)
}
else
{
console
.
info
(
"
GetSingleSensor_JSTest_003
"
+
JSON
.
stringify
(
data
));
setTimeout
(()
=>
{
done
();
},
500
)
}
},
255
)
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
25
,
62
);
console
.
info
(
'
GetSingleSensor_JSTest_003 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
}
})
/**
* @tc.number: SUB_SensorsSystem_GetSingleSensor_JSTest_0040
* @tc.name: GetSingleSensor_JSTest_004
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
'
GetSingleSensor_JSTest_004
'
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
------------------GetSingleSensor_JSTest_004-------------------------
"
);
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
GetSingleSensor_JSTest_004 failed
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
)
},
500
)
}
else
{
console
.
info
(
"
GetSingleSensor_JSTest_004
"
+
JSON
.
stringify
(
data
));
setTimeout
(()
=>
{
done
();
},
500
)
}
},
invild
)
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
25
,
62
);
console
.
info
(
'
GetSingleSensor_JSTest_004 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
}
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0050
* @tc.name: GetSingleSensor_JSTest_005
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
'
GetSingleSensor_JSTest_005
'
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
------------------GetSingleSensor_JSTest_005-------------------------
"
);
try
{
sensor
.
getSingleSensor
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
,
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
GetSingleSensor_JSTest_005 failed
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
)
},
500
)
}
else
{
console
.
info
(
"
GetSingleSensor_JSTest_005
"
+
JSON
.
stringify
(
data
));
setTimeout
(()
=>
{
done
();
},
500
)
}
},
testNullSensorId
)
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
25
,
62
);
console
.
info
(
'
GetSingleSensor_JSTest_005 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
done
();
}
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0060
* @tc.name: GetSingleSensor_JSTest_006
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
'
GetSingleSensor_JSTest_006
'
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
------------------GetSingleSensor_JSTest_006-------------------------
"
);
try
{
sensor
.
getSingleSensor
(
xxx
)
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
16
,
35
);
console
.
info
(
'
GetSingleSensor_JSTest_006 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
2
]);
done
();
}
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0070
* @tc.name: GetSingleSensor_JSTest_007
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
'
GetSingleSensor_JSTest_007
'
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
------------------GetSingleSensor_JSTest_007-------------------------
"
);
try
{
sensor
.
getSingleSensor
(
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
GetSingleSensor_JSTest_007 failed
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
)
},
500
)
}
else
{
console
.
info
(
"
GetSingleSensor_JSTest_007
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
sensorName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
vendorName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
firmwareVersion
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
hardwareVersion
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
sensorTypeId
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
maxRange
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
precision
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
power
)).
assertEqual
(
"
number
"
);
setTimeout
(()
=>
{
done
();
},
500
)
}
})
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
25
,
61
);
console
.
info
(
'
GetSingleSensor_JSTest_007 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
}
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0080
* @tc.name: GetSingleSensor_JSTest_008
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
"
GetSingleSensor_JSTest_008
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
------------------------GetSingleSensor_JSTest_008------------------
"
);
sensor
.
getSingleSensor
(
testNullSensorId
,
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
'
GetSingleSensor_JSTest_008 error
'
+
error
);
expect
(
true
).
assertTrue
();
done
()
}
else
{
console
.
info
(
"
GetSingleSensor_JSTest_008
"
+
JSON
.
stringify
(
data
));
expect
(
false
).
assertTrue
();
}
});
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0090
* @tc.name: GetSingleSensor_JSTest_009
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
"
GetSingleSensor_JSTest_009
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
-------------------GetSingleSensor_JSTest_009----------------------
"
);
sensor
.
getSingleSensor
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
).
then
((
data
)
=>
{
console
.
info
(
"
GetSingleSensor_JSTest_009 success
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
sensorName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
vendorName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
firmwareVersion
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
hardwareVersion
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
sensorTypeId
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
maxRange
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
precision
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
power
)).
assertEqual
(
"
number
"
);
done
()
},
(
error
)
=>
{
console
.
info
(
'
GetSingleSensor_JSTest_009 failed
'
);
expect
(
false
).
assertTrue
();
});
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0100
* @tc.name: GetSingleSensor_JSTest_010
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
"
GetSingleSensor_JSTest_010
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
----------------GetSingleSensor_JSTest_010-----------------------
"
);
sensor
.
getSingleSensor
(
testNullSensorId
).
then
((
data
)
=>
{
console
.
info
(
"
GetSingleSensor_JSTest_010 success
"
+
JSON
.
stringify
(
data
));
expect
(
false
).
assertTrue
();
done
()
},
(
error
)
=>
{
errMessage
=
error
.
toString
();
console
.
info
(
'
GetSingleSensor_JSTest_010 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
3
]);
done
();
});
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0110
* @tc.name: GetSingleSensor_JSTest_011
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
"
GetSingleSensor_JSTest_011
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
-------------------GetSingleSensor_JSTest_011----------------------
"
);
sensor
.
getSingleSensor
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
).
then
((
data
)
=>
{
console
.
info
(
"
GetSingleSensor_JSTest_011 success
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
sensorName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
vendorName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
firmwareVersion
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
hardwareVersion
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
sensorTypeId
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
maxRange
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
precision
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
power
)).
assertEqual
(
"
number
"
);
done
()
},
(
error
)
=>
{
console
.
info
(
'
GetSingleSensor_JSTest_011 failed
'
);
expect
(
false
).
assertTrue
();
});
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0120
* @tc.name: GetSingleSensor_JSTest_012
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
"
GetSingleSensor_JSTest_012
"
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
-------------------GetSingleSensor_JSTest_012----------------------
"
);
sensor
.
getSingleSensor
(
sensor
.
SensorType
.
SENSOR_TYPE_ID_ACCELEROMETER
).
then
((
data
)
=>
{
console
.
info
(
"
GetSingleSensor_JSTest_012 success
"
+
JSON
.
stringify
(
data
));
expect
(
typeof
(
data
.
sensorName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
vendorName
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
firmwareVersion
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
hardwareVersion
)).
assertEqual
(
"
string
"
);
expect
(
typeof
(
data
.
sensorTypeId
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
maxRange
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
precision
)).
assertEqual
(
"
number
"
);
expect
(
typeof
(
data
.
power
)).
assertEqual
(
"
number
"
);
done
()
},
(
error
)
=>
{
console
.
info
(
'
GetSingleSensor_JSTest_012 failed
'
);
expect
(
false
).
assertTrue
();
});
})
/**
* @tc.number:SUB_SensorsSystem_GetSingleSensor_JSTest_0130
* @tc.name: GetSingleSensor_JSTest_013
* @tc.desc: Verification results of the incorrect parameters of the test interface.
*/
it
(
'
GetSingleSensor_JSTest_013
'
,
FUNCTION
|
MEDIUMTEST
|
LEVEL3
,
async
function
(
done
)
{
console
.
info
(
"
------------------GetSingleSensor_JSTest_013-------------------------
"
);
try
{
sensor
.
getSingleSensor
(
null
)
}
catch
(
error
)
{
errMessage
=
error
.
toString
().
slice
(
25
,
61
);
console
.
info
(
'
GetSingleSensor_JSTest_013 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
done
();
}
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录