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

!8691 【Openharmony4.0.7.1】【master分支】【sensor子系统】【ToC】【RK3568】【必现】新增计步检测用例

Merge pull request !8691 from ldy/master
......@@ -93,6 +93,18 @@
{
"name": "ohos.permission.GYROSCOPE",
"reason": "need use ohos.permission.GYROSCOPE"
},
{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason": "need use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason": "need use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name": "ohos.permission.ACTIVITY_MOTION",
"reason": "need use ohos.permission.ACTIVITY_MOTION"
}
],
"testRunner": {
......
......@@ -15,33 +15,32 @@
import SystemParameterTest from './SensorOnOffTest.test.js'
import SensorJsTest_sensor_2 from './SensorGeomagneticTest.test.js'
import SensorJsTest_sensor_1 from './SensorGeneralalgorithm.test.js'
import SensorJsTest_sensor_60 from './SensorOnOffTest.test_newSensorGeomagnetic.js'
import SensorJsTest_sensor_35 from './SensorOnOffTest.test_newGetSensorList.js'
import SensorJsTest_sensor_36 from './SensorOnOffTest.test_newGetSingleSensor.js'
import SensorJsTest_sensor_3 from './SensorOnOffTest.test_oldAccelerometer.js'
import SensorJsTest_sensor_25 from './Subscribe_subscribeAccelerometer.js'
import SensorJsTest_sensor_39 from './SensorOnOffTest.test_newAccelerometer.js'
import SensorJsTest_sensor_43 from './SensorOnOffTest.test_newGyroScope.js'
import SensorJsTest_sensor_5 from './SensorOnOffTest.test_oldGyroScope.js'
import SensorJsTest_sensor_29 from './Subscribe_subscribeGyroscope.js'
import SensorJsTest_sensor_41 from './SensorOnOffTest.test_newAmbient_Light.js'
import SensorJsTest_sensor_4 from './SensorOnOffTest.test_oldAmbient_light.js'
import SensorJsTest_sensor_31 from './Subscribe_subscribeLight.js'
import SensorJsTest_sensor_42 from './SensorOnOffTest.test_newGravity.js'
import SensorJsTest_sensor_9 from './SensorOnOffTest.test_oldGravity.js'
import SensorJsTest_sensor_37 from './SensorOnOffTest.test_newMagneticField.js'
import SensorJsTest_sensor_15 from './SensorOnOffTest.test_oldMagneticField.js'
import SensorJsTest_sensor_49 from './SensorOnOffTest.test_newRotatingVector.js'
import SensorJsTest_sensor_20 from './SensorOnOffTest.test_oldRotatingVector.js'
import SensorJsTest_sensor_45 from './SensorOnOffTest.test_newHall.js'
import SensorJsTest_sensor_7 from './SensorOnOffTest.test_oldHall.js'
import SensorJsTest_sensor_48 from './SensorOnOffTest.test_newOrientating.js'
import SensorJsTest_sensor_16 from './SensorOnOffTest.test_oldOrientating.js'
import SensorJsTest_sensor_27 from './Subscribe_subscribeDeviceOrientation.js'
import SensorJsTest_sensor_53 from './SensorOnOffTest.test_newBarometer.js'
import SensorJsTest_sensor_8 from './SensorOnOffTest.test_oldBarometer.js'
import SensorJsTest_sensor_26 from './Subscribe_subscribeBarometer.js'
import SensorJsTest_sensor_60 from './SensorOnOffTest.test_newSensorGeomagnetic.test.js'
import SensorJsTest_sensor_35 from './SensorOnOffTest.test_newGetSensorList.test.js'
import SensorJsTest_sensor_36 from './SensorOnOffTest.test_newGetSingleSensor.test.js'
import SensorJsTest_sensor_3 from './SensorOnOffTest.test_oldAccelerometer.test.js'
import SensorJsTest_sensor_25 from './Subscribe_subscribeAccelerometer.test.js'
import SensorJsTest_sensor_39 from './SensorOnOffTest.test_newAccelerometer.test.js'
import SensorJsTest_sensor_43 from './SensorOnOffTest.test_newGyroScope.test.js'
import SensorJsTest_sensor_5 from './SensorOnOffTest.test_oldGyroScope.test.js'
import SensorJsTest_sensor_29 from './Subscribe_subscribeGyroscope.test.js'
import SensorJsTest_sensor_41 from './SensorOnOffTest.test_newAmbient_Light.test.js'
import SensorJsTest_sensor_4 from './SensorOnOffTest.test_oldAmbient_light.test.js'
import SensorJsTest_sensor_31 from './Subscribe_subscribeLight.test.js'
import SensorJsTest_sensor_42 from './SensorOnOffTest.test_newGravity.test.js'
import SensorJsTest_sensor_9 from './SensorOnOffTest.test_oldGravity.test.js'
import SensorJsTest_sensor_37 from './SensorOnOffTest.test_newMagneticField.test.js'
import SensorJsTest_sensor_15 from './SensorOnOffTest.test_oldMagneticField.test.js'
import SensorJsTest_sensor_49 from './SensorOnOffTest.test_newRotatingVector.test.js'
import SensorJsTest_sensor_20 from './SensorOnOffTest.test_oldRotatingVector.test.js'
import SensorJsTest_sensor_45 from './SensorOnOffTest.test_newHall.test.js'
import SensorJsTest_sensor_7 from './SensorOnOffTest.test_oldHall.test.js'
import SensorJsTest_sensor_48 from './SensorOnOffTest.test_newOrientating.test.js'
import SensorJsTest_sensor_16 from './SensorOnOffTest.test_oldOrientating.test.js'
import SensorJsTest_sensor_27 from './Subscribe_subscribeDeviceOrientation.test.js'
import SensorJsTest_sensor_53 from './SensorOnOffTest.test_newBarometer.test.js'
import SensorJsTest_sensor_8 from './SensorOnOffTest.test_oldBarometer.test.js'
import SensorJsTest_sensor_26 from './Subscribe_subscribeBarometer.test.js'
export default function testsuite() {
SystemParameterTest()
......
/*
* 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, TestType, Size, Level } from '@ohos/hypium'
export default function SensorJsTest_sensor_57() {
describe("SensorJsTest_sensor_57", function () {
function callback(data) {
console.info("callback" + JSON.stringify(data));
expect(typeof (data.scalar)).assertEqual("number");
}
function callback2(data) {
console.info("callback2" + JSON.stringify(data));
expect(typeof (data.scalar)).assertEqual("number");
}
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')
})
const PARAMETER_ERROR_CODE = 401
const PARAMETER_ERROR_MSG = 'The parameter invalid.'
const SERVICE_EXCEPTION_CODE = 14500101
const SERVICE_EXCEPTION_MSG = 'Service exception.'
let invalid = -1;
let errMessages = ['ReferenceError: string is not defined','TypeError: is not callable',
'ReferenceError: xxx is not defined']
let errMessage
/*
* @tc.number:SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0120
* @tc.name: newPedometerDetection_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest012--------');
try {
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, callback);
} catch (error) {
console.info("newPedometerDetection_SensorJsTest012 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
setTimeout(() => {
expect(true).assertTrue();
done();
}, 500);
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0130
* @tc.name: newPedometerDetection_SensorJsTest013
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest013--------');
try {
sensor.on(sensor.SensorId.PEDOMETER_DETECTION ,callback, { 'interval': 100000000 });
} catch (error) {
console.info("newPedometerDetection_SensorJsTest013 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0140
* @tc.name: newPedometerDetection_SensorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest014--------');
function onSensorCallback(data) {
console.info('newPedometerDetection_SensorJsTest014 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
sensor.on(sensor.SensorId.PEDOMETER_DETECTION,
onSensorCallback, { 'interval': 100000000 }, 5);
} catch (error) {
console.info("newPedometerDetection_SensorJsTest014 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0150
* @tc.name: newPedometerDetection_SensorJsTest015
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest015--------');
try{
sensor.once(sensor.SensorId.PEDOMETER_DETECTION, callback);
} catch (error) {
console.info("newPedometerDetection_SensorJsTest015 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0160
* @tc.name: newPedometerDetection_SensorJsTest016
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest016--------');
function onceSensorCallback(data) {
console.info('newPedometerDetection_SensorJsTest016 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
sensor.once(sensor.SensorId.PEDOMETER_DETECTION, onceSensorCallback, 5);
} catch (error) {
console.info("newPedometerDetection_SensorJsTest016 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0170
* @tc.name: newPedometerDetection_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest017--------');
try {
sensor.off(string, "");
} catch (error) {
errMessage
console.info("newPedometerDetection_SensorJsTest017 error:" + error);
errMessage = error.toString();
expect(errMessage).assertEqual(errMessages[0]);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0180
* @tc.name: newPedometerDetection_SensorJsTest018
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest018--------');
function onSensorCallback(data) {
console.info('newPedometerDetection_SensorJsTest018 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, onSensorCallback);
sensor.off(sensor.SensorId.PEDOMETER_DETECTION);
} catch (error) {
console.info("newPedometerDetection_SensorJsTest018 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0190
* @tc.name: newPedometerDetection_SensorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest019--------');
function onSensorCallback(data) {
console.info('newPedometerDetection_SensorJsTest019 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
sensor.off(1000000, onSensorCallback);
} catch (error) {
console.info("newPedometerDetection_SensorJsTest019 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0200
* @tc.name: newPedometerDetection_SensorJsTest020
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest020--------');
function onSensorCallback(data) {
console.info('newPedometerDetection_SensorJsTest020 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
sensor.off(invalid, onSensorCallback);
} catch (error) {
console.info("newPedometerDetection_SensorJsTest020 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0210
* @tc.name: newPedometerDetection_SensorJsTest021
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest021--------');
function onSensorCallback(data) {
console.info('newPedometerDetection_SensorJsTest021 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
sensor.xxx(sensor.SensorId.PEDOMETER_DETECTION, onSensorCallback);
} catch (error) {
console.info("newPedometerDetection_SensorJsTest021 error:" + error);
errMessage = error.toString();
expect(errMessage).assertEqual(errMessages[1]);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0220
* @tc.name: newPedometerDetection_SensorJsTest022
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("newPedometerDetection_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest022--------');
function onSensorCallback(data) {
console.info('newPedometerDetection_SensorJsTest022 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
xxx.on(sensor.SensorId.PEDOMETER_DETECTION, onSensorCallback);
} catch (error) {
console.info("newPedometerDetection_SensorJsTest022 error:" + error);
errMessage = error.toString();
expect(errMessage).assertEqual(errMessages[2]);
done();
}
})
})
}
/*
* 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, TestType, Size, Level } from '@ohos/hypium'
export default function SensorJsTest_sensor_17() {
describe("SensorJsTest_sensor_17", function () {
function callback(data) {
console.info("callback" + JSON.stringify(data));
expect(typeof (data.scalar)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
function callback2(data) {
console.info("callback2" + JSON.stringify(data));
expect(typeof (data.scalar)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
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')
})
const PARAMETER_ERROR_CODE = 401
const PARAMETER_ERROR_MSG = 'The parameter invalid.'
const SERVICE_EXCEPTION_CODE = 14500101
const SERVICE_EXCEPTION_MSG = 'Service exception.'
let invalid = -1;
let errMessages = ['ReferenceError: string is not defined','TypeError: is not callable','ReferenceError: xxx is not defined']
let errMessage
/*
* @tc.number:SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0010
* @tc.name: PedometerDetection_SensorJsTest001
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('--------PedometerDetection_SensorJsTest001--------');
try {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback);
} catch (error) {
console.info("PedometerDetection_SensorJsTest001 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
setTimeout(() => {
expect(true).assertTrue();
done();
}, 500);
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0020
* @tc.name: PedometerDetection_SensorJsTest002
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest002--------');
try {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION ,callback, { 'interval': 100000000 });
} catch (error) {
console.info("PedometerDetection_SensorJsTest002 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0030
* @tc.name: PedometerDetection_SensorJsTest003
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest003--------');
function onSensorCallback(data) {
console.info('PedometerDetection_SensorJsTest003 on error');
expect(typeof (data.scalar)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
try {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,
onSensorCallback, { 'interval': 100000000 }, 5);
} catch (error) {
console.info("PedometerDetection_SensorJsTest003 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0040
* @tc.name: PedometerDetection_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest004--------');
try{
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback);
} catch (error) {
console.info("PedometerDetection_SensorJsTest004 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0050
* @tc.name: PedometerDetection_SensorJsTest005
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest005--------');
function onceSensorCallback(data) {
console.info('PedometerDetection_SensorJsTest005 on error');
expect(typeof (data.scalar)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
}
try {
sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, onceSensorCallback, 5);
} catch (error) {
console.info("PedometerDetection_SensorJsTest005 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0060
* @tc.name: PedometerDetection_SensorJsTest006
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest006--------');
try {
sensor.off(string, "");
} catch (error) {
errMessage
console.info("PedometerDetection_SensorJsTest006 error:" + error);
errMessage = error.toString();
expect(errMessage).assertEqual(errMessages[0]);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0070
* @tc.name: PedometerDetection_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest007--------');
function onSensorCallback(data) {
console.info('PedometerDetection_SensorJsTest007 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, onSensorCallback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION);
} catch (error) {
console.info("PedometerDetection_SensorJsTest007 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0080
* @tc.name: PedometerDetection_SensorJsTest008
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest008--------');
function onSensorCallback(data) {
console.info('PedometerDetection_SensorJsTest008 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
sensor.off(1000000, onSensorCallback);
} catch (error) {
console.info("PedometerDetection_SensorJsTest008 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0090
* @tc.name: PedometerDetection_SensorJsTest009
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest009--------');
function onSensorCallback(data) {
console.info('PedometerDetection_SensorJsTest009 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
sensor.off(invalid, onSensorCallback);
} catch (error) {
console.info("PedometerDetection_SensorJsTest009 error:" + error);
expect(error.code).assertEqual(PARAMETER_ERROR_CODE);
expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0100
* @tc.name: PedometerDetection_SensorJsTest010
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest010--------');
function onSensorCallback(data) {
console.info('PedometerDetection_SensorJsTest010 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
sensor.xxx(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, onSensorCallback);
} catch (error) {
console.info("PedometerDetection_SensorJsTest010 error:" + error);
errMessage = error.toString();
expect(errMessage).assertEqual(errMessages[1]);
done();
}
})
/*
* @tc.number: SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0110
* @tc.name: PedometerDetection_SensorJsTest011
* @tc.desc:Verification results of the incorrect parameters of the test interface
*/
it("PedometerDetection_SensorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest011--------');
function onSensorCallback(data) {
console.info('PedometerDetection_SensorJsTest011 on error');
expect(typeof (data.scalar)).assertEqual("number");
}
try {
xxx.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, onSensorCallback);
} catch (error) {
console.info("PedometerDetection_SensorJsTest011 error:" + error);
errMessage = error.toString();
expect(errMessage).assertEqual(errMessages[2]);
done();
}
})
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册