diff --git a/powermgr/powermgrbattery/Test.json b/powermgr/powermgrbattery/Test.json index b7ac14baa0bfe07ecb410328a63c5db264bfac39..fa78e7e02851dace7b5efe17e9cfe9996620b863 100755 --- a/powermgr/powermgrbattery/Test.json +++ b/powermgr/powermgrbattery/Test.json @@ -7,6 +7,12 @@ "shell-timeout": "60000" }, "kits": [ + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup" + ] + }, { "test-file-name": [ "ActsPowerMgrBatteryTest.hap" @@ -15,5 +21,4 @@ "cleanup-apps": true } ] -} - +} \ No newline at end of file diff --git a/powermgr/powermgrbattery/src/main/js/default/test/batterymanager_performance.test.js b/powermgr/powermgrbattery/src/main/js/default/test/batterymanager_performance.test.js index a1461680a9e794b82a44e7aa4c40691ace69e924..1ed8f670c442f74ca8b4bdfd92b74a9c731b7577 100644 --- a/powermgr/powermgrbattery/src/main/js/default/test/batterymanager_performance.test.js +++ b/powermgr/powermgrbattery/src/main/js/default/test/batterymanager_performance.test.js @@ -14,7 +14,7 @@ */ import batteryInfo from '@ohos.batteryInfo'; -import {describe, it, expect} from 'deccjsunit/index'; +import { describe, it, expect } from 'deccjsunit/index'; describe('appInfoTest', function () { @@ -41,40 +41,6 @@ describe('appInfoTest', function () { 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.name battery_pluggedtype_test @@ -92,7 +58,7 @@ describe('appInfoTest', function () { avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); }) - /** + /** * @tc.number BatteryPerformance_005 * @tc.name battery_technology_test * @tc.desc Battery acquisition kit diff --git a/powermgr/powermgrpower/src/main/js/default/test/power_performance_test.js b/powermgr/powermgrpower/src/main/js/default/test/power_performance_test.js index 82bcaa08b332d4e9b89bd3d7e4509220015c27c7..fa4dd0e7f6c373b43f630c5288878d68e2c38d5d 100644 --- a/powermgr/powermgrpower/src/main/js/default/test/power_performance_test.js +++ b/powermgr/powermgrpower/src/main/js/default/test/power_performance_test.js @@ -16,13 +16,13 @@ import runningLock from '@ohos.runningLock'; import power from '@ohos.power'; import brightness from '@ohos.brightness'; -import {describe, it, expect} from 'deccjsunit/index'; +import { describe, it, expect } from 'deccjsunit/index'; describe('appInfoTest', function () { console.log("*************Power Performance Test Begin*************"); const MAXNUM = 1000; - const MIDNUM =100; + const MIDNUM = 100; const MS_TO_US = 1000; const LIMIT_TIME = 1500; const LIMIT_TIME_LONG = 4000; @@ -44,32 +44,6 @@ describe('appInfoTest', function () { 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.name lock_test @@ -87,8 +61,8 @@ describe('appInfoTest', function () { avgTime = avgTime + waitTime; //us console.info(`PowerPerformance_003: Promise: runningLock.lock Wait Time : ${waitTime}`); avgTime < LIMIT_TIME ? expect(true).assertTrue() : expect(false).assertTrue(); - runningLock.unlock(); - done(); + runningLock.unlock(); + done(); } else { console.log('PowerPerformance_003: ' + error); console.info('PowerPerformance_003: lock is ' + runningLock);