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

!3274 【Power】电源测试用例调整

Merge pull request !3274 from logic42/master
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
"shell-timeout": "60000" "shell-timeout": "60000"
}, },
"kits": [ "kits": [
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup"
]
},
{ {
"test-file-name": [ "test-file-name": [
"ActsPowerMgrBatteryTest.hap" "ActsPowerMgrBatteryTest.hap"
...@@ -16,4 +22,3 @@ ...@@ -16,4 +22,3 @@
} }
] ]
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import batteryInfo from '@ohos.batteryInfo'; import batteryInfo from '@ohos.batteryInfo';
import {describe, it, expect} from 'deccjsunit/index'; import { describe, it, expect } from 'deccjsunit/index';
describe('appInfoTest', function () { describe('appInfoTest', function () {
...@@ -41,40 +41,6 @@ describe('appInfoTest', function () { ...@@ -41,40 +41,6 @@ describe('appInfoTest', function () {
avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
}) })
/**
* @tc.number BatteryPerformance_002
* @tc.name battery_chargingstatus_test
* @tc.desc Battery acquisition kit
*/
it('BatteryPerformance_002', 0, function () {
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
batteryInfo.chargingStatus;
}
let waitTime = new Date().getTime() - startTime;
let avgTime = waitTime / MAXNUM * MS_TO_US; //us
console.info(`BATTERY_Performance_002: Promise: batteryInfo.chargingStatus Average Time : ${waitTime}`);
avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
})
/**
* @tc.number BatteryPerformance_003
* @tc.name battery_healthstatus_test
* @tc.desc Battery acquisition kit
*/
it('BatteryPerformance_003', 0, function () {
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
batteryInfo.healthStatus;
}
let waitTime = new Date().getTime() - startTime;
let avgTime = waitTime / MAXNUM * MS_TO_US; //us
console.info(`BatteryPerformance_003: Promise: batteryInfo.healthStatus Average Time : ${waitTime}`);
avgTime < HEALTH_LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
})
/** /**
* @tc.number BatteryPerformance_004 * @tc.number BatteryPerformance_004
* @tc.name battery_pluggedtype_test * @tc.name battery_pluggedtype_test
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
import runningLock from '@ohos.runningLock'; import runningLock from '@ohos.runningLock';
import power from '@ohos.power'; import power from '@ohos.power';
import brightness from '@ohos.brightness'; import brightness from '@ohos.brightness';
import {describe, it, expect} from 'deccjsunit/index'; import { describe, it, expect } from 'deccjsunit/index';
describe('appInfoTest', function () { describe('appInfoTest', function () {
console.log("*************Power Performance Test Begin*************"); console.log("*************Power Performance Test Begin*************");
const MAXNUM = 1000; const MAXNUM = 1000;
const MIDNUM =100; const MIDNUM = 100;
const MS_TO_US = 1000; const MS_TO_US = 1000;
const LIMIT_TIME = 1500; const LIMIT_TIME = 1500;
const LIMIT_TIME_LONG = 4000; const LIMIT_TIME_LONG = 4000;
...@@ -44,32 +44,6 @@ describe('appInfoTest', function () { ...@@ -44,32 +44,6 @@ describe('appInfoTest', function () {
done(); done();
}) })
/**
* @tc.number PowerPerformance_002
* @tc.name isUsed_test
* @tc.desc Interface is called normally
*/
it('PowerPerformance_002', 0, async function (done) {
let avgTime = 0;
runningLock.createRunningLock("test", runningLock.RunningLockType.BACKGROUND, (error, runningLock) => {
if (typeof error === "undefined") {
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
runningLock.isUsed();
}
let waitTime = new Date().getTime() - startTime;
avgTime = waitTime / MAXNUM * MS_TO_US; //us
console.info(`PowerPerformance_002: Promise: runningLock.isUsed Wait Time : ${waitTime}`);
avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue();
done();
} else {
console.log('PowerPerformance_002: ' + error);
console.info('PowerPerformance_002: isUsed is ' + runningLock);
done();
}
})
})
/** /**
* @tc.number PowerPerformance_003 * @tc.number PowerPerformance_003
* @tc.name lock_test * @tc.name lock_test
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册