提交 faf02efb 编写于 作者: O openharmony_ci 提交者: Gitee

!1032 Modify test code

Merge pull request !1032 from blackleon/master_1102
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"test-timeout": "120000",
"package": "com.example.amsZipfileUnzipfileST",
"shell-timeout": "60000"
},
......@@ -24,16 +24,33 @@
{
"type": "PushKit",
"push": [
"amsZipfileUnzipfileST.hap->/data/test/amsZipfileUnzipfileST.hap"
"ceshi.txt->/data/test/ceshi.txt"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /data/test/*.hap"
"chmod 777 /data/test/*"
]
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /data/testA"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 777 /data/testA/*"
]
}
]
}
......@@ -19,20 +19,21 @@
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /system/vendor"
"mkdir /data/test"
]
},
{
"type": "PushKit",
"push": [
"amsStDataAbility.hap->/system/vendor/amsStDataAbility.hap"
"amsStDataAbility.hap->/data/test/amsStDataAbility.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /system/vendor/*.hap"
"chmod 644 /data/test/*.hap",
"bm install -p /data/test/amsStDataAbility.hap"
]
}
]
......
......@@ -26,7 +26,8 @@ group("bundlemanager") {
"actsbmsmoduleusagerecordtest:ActsBmsModuleUsageRecordTest",
"actsbundlemanagertest:ActsBundleManagerTest",
"actsbundlemanageruninstall:ActsBundleManagerUninstall",
"bmscheckpermissiontest:BmsCheckPermissionTest",
# "bmscheckpermissiontest:BmsCheckPermissionTest",
"sceneProject/bmsgetinfosfifthscene:bmsThirdBundleTest5",
"sceneProject/bmsgetinfosfirstscene:bmsThirdBundleTest1",
"sceneProject/bmsgetinfosfirstsceneupdate:bmsThirdBundleTestA1",
......
......@@ -19,7 +19,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
const BUNDLE_NAME = 'com.example.actsbmscheckpermissiontest';
const PERMISSION_ONE = 'com.permission.PERMISSION_A';
const PERMISSION_TWO = 'com.permission.PERMISSION_B';
const TIMEOUT = 1000;
const NAMECOUNT = 10000;
describe('ActsBmsCheckPermissionTest', function () {
......@@ -34,9 +33,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, PERMISSION_ONE)
expect(data).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0100==================end');
}, TIMEOUT)
})
/*
......@@ -51,9 +47,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(0);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0200==================end');
}, TIMEOUT)
})
/*
......@@ -67,9 +60,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission('', PERMISSION_ONE)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0300==================end');
}, TIMEOUT)
})
/*
......@@ -85,9 +75,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0400==================end');
}, TIMEOUT)
})
/*
......@@ -101,9 +88,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, '')
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0500==================end');
}, TIMEOUT)
})
/*
......@@ -119,9 +103,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0600==================end');
}, TIMEOUT)
})
/*
......@@ -135,9 +116,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, '@\n,. 。测试@abc1^%12345')
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0700==================end');
}, TIMEOUT)
})
/*
......@@ -153,9 +131,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_0800==================end');
}, TIMEOUT)
})
/*
......@@ -169,9 +144,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission('@\n,. 。测试@abc1^%12345', PERMISSION_ONE)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_0900==================end');
}, TIMEOUT)
})
/*
......@@ -187,9 +159,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_1000==================end');
}, TIMEOUT)
})
/*
......@@ -207,9 +176,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, permissionName)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_1100==================end');
}, TIMEOUT)
})
/*
......@@ -229,9 +195,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_1200==================end');
}, TIMEOUT)
})
/*
......@@ -249,9 +212,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(bundleName, PERMISSION_ONE)
expect(data).assertEqual(-1);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_1300==================end');
}, TIMEOUT)
})
/*
......@@ -271,9 +231,6 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(-1);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_1400==================end');
}, TIMEOUT)
})
/*
......@@ -287,9 +244,6 @@ describe('ActsBmsCheckPermissionTest', function () {
var data = await bundle.checkPermission(BUNDLE_NAME, PERMISSION_TWO)
expect(data).assertEqual(0);
done();
setTimeout(function () {
console.info('=====================bms_checkPermission_1500==================end');
}, TIMEOUT)
})
/*
......@@ -305,8 +259,5 @@ describe('ActsBmsCheckPermissionTest', function () {
expect(data).assertEqual(0);
done();
})
setTimeout(function () {
console.info('=====================bms_checkPermission_1600==================end');
}, TIMEOUT)
})
})
\ No newline at end of file
......@@ -9,8 +9,8 @@
"kits": [
{
"test-file-name": [
"ActsBmsKitTest.hap",
"bmsThirdBundleTest1.hap"
"bmsThirdBundleTest1.hap",
"ActsBmsKitTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -18,7 +18,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
import featureAbility from '@ohos.ability.featureability'
import commonEvent from '@ohos.commonevent'
const TIMEOUT = 2000;
const STRESSLEVEL = 20;
const BUNDLE_NAME = 'com.example.actsbmskittest';
const PERMISSION_NAME = 'com.permission.PERMISSION_A';
......@@ -64,9 +63,6 @@ describe('ActsBmsKitTest', function () {
}
}
)
setTimeout(function () {
console.info('==================beforeAll==================end');
}, TIMEOUT)
})
/*
* @tc.number: ActsBmsKit_getAllShortcutInfo_0100
......@@ -85,9 +81,6 @@ describe('ActsBmsKitTest', function () {
break;
}
done();
setTimeout(function () {
console.info('==================ActsBmsKit_getAllShortcutInfo_0100==================end');
}, TIMEOUT)
});
/*
......@@ -112,9 +105,6 @@ describe('ActsBmsKitTest', function () {
}
})
}
setTimeout(function () {
console.info('=====================ActsBmsKit_getAllShortcutInfo_0200==================end');
}, TIMEOUT)
})
/*
......@@ -133,9 +123,6 @@ describe('ActsBmsKitTest', function () {
}
}
done();
setTimeout(function () {
console.info('=====================ActsBmsKit_checkPermission_0100==================end');
}, TIMEOUT)
})
/*
......@@ -159,9 +146,6 @@ describe('ActsBmsKitTest', function () {
}
})
}
setTimeout(function () {
console.info('=====================ActsBmsKit_checkPermission_0200==================end');
}, TIMEOUT)
})
/*
......@@ -213,9 +197,6 @@ describe('ActsBmsKitTest', function () {
count++;
});
}
setTimeout(function () {
console.debug('==========ActsBmsKit_getModuleUsageRecordTest_0200==================end');
}, TIMEOUT)
})
function checkModuleUsageRecord(data, caseName) {
console.debug('======================check ModuleUsageRecord begin==========================');
......@@ -226,21 +207,21 @@ describe('ActsBmsKitTest', function () {
console.debug('=============bundleName is=========' + JSON.stringify(data[i].bundleName));
expect(data[i].bundleName.length).assertLarger(0);
console.debug('=============appLabelId==============' + JSON.stringify(data[i].appLabelId));
expect(data[i].appLabelId).assertLarger(0);
expect(data[i].appLabelId >= 0).assertTrue();
console.debug('=============name==============' + JSON.stringify(data[i].name));
expect(data[i].name.length).assertLarger(0);
console.debug('=============labelId==============' + JSON.stringify(data[i].labelId));
expect(data[i].labelId >=0 ).assertTrue();
expect(data[i].labelId >= 0).assertTrue();
console.debug('=============descriptionId==============' + JSON.stringify(data[i].descriptionId));
expect(data[i].descriptionId).assertEqual(0);
console.debug('=============abilityName==============' + JSON.stringify(data[i].abilityName));
expect(data[i].abilityName.length).assertLarger(0);
console.debug('=============abilityLabelId==============' + JSON.stringify(data[i].abilityLabelId));
expect(data[i].abilityLabelId).assertLarger(0);
expect(data[i].abilityLabelId >= 0).assertTrue();
console.debug('===========abilityDescriptionId===========' + JSON.stringify(data[i].abilityDescriptionId));
expect(data[i].abilityDescriptionId).assertLarger(0);
expect(data[i].abilityDescriptionId >= 0).assertTrue();
console.debug('=============abilityIconId==============' + JSON.stringify(data[i].abilityIconId));
expect(data[i].abilityIconId).assertLarger(0);
expect(data[i].abilityIconId >= 0).assertTrue();
console.debug('=============launchedCount==============' + JSON.stringify(data[i].launchedCount));
expect(data[i].launchedCount).assertLarger(0);
console.debug('=============lastLaunchTime==============' + JSON.stringify(data[i].lastLaunchTime));
......
......@@ -20,7 +20,7 @@ group("publish_test") {
#"badgedisplayed:badgedisplayed",
#"enablenotification:enablenotification",
"getactive:getactive",
"getwantagentinfo:getwantagentinfo",
"getwantagentinfo:ActsAnsGetWantAgentInfoTest",
#"publishcontentype:publishcontentype",
#"subscribe:subscribe",
......
......@@ -13,18 +13,14 @@
import("//test/xts/tools/build/suite.gni")
ohos_hap("localcandisplay") {
ohos_js_hap_suite("localcandisplay") {
hap_profile = "./entry/src/main/config.json"
hap_name = "localcandisplay"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "localcandisplay"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
......
......@@ -16,7 +16,7 @@
import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000
var errorCode = 67108870
var ERR_ANS_INVALID_BUNDLE = 67108870
describe('ActsAnsEnableNotificationTest', function () {
console.info("===========ActsAnsEnableNotificationTest start====================>");
/*
......@@ -78,14 +78,13 @@ describe('ActsAnsEnableNotificationTest', function () {
* @tc.desc: verify the function of isNotificationEnabled
*/
it('ActsGetEnable_test_0400', 0, async function (done) {
var promise = await notify.isNotificationEnabled({
notify.isNotificationEnabled({
bundle:"wrong BundleName",
})
expect(promise).assertEqual(false)
done();
setTimeout(function(){
console.debug("====>time out ActsGetEnable_test_0400====>");
}, time);
}).then().catch((err)=>{
console.debug("====>ActsGetEnable_test_0400 promsie====>"+err.code);
expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE)
done();
})
})
/*
* @tc.number: ActsGetEnable_test_0500
......@@ -98,9 +97,6 @@ describe('ActsAnsEnableNotificationTest', function () {
expect(typeof(data)).assertEqual('boolean')
})
done();
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0500====>");
}, time);
})
/*
* @tc.number: ActsGetEnable_test_0600
......@@ -111,9 +107,6 @@ describe('ActsAnsEnableNotificationTest', function () {
var promise = await notify.isNotificationEnabled("#$#$%$%^")
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("====>time out ActsGetEnable_test_0600====>");
}, time);
})
/*
* @tc.number: ActsGetDisplay_test_0700
......@@ -126,9 +119,6 @@ describe('ActsAnsEnableNotificationTest', function () {
expect(typeof(data)).assertEqual('boolean')
})
done();
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0700====>");
}, time);
})
/*
* @tc.number: ActsGetEnable_test_0800
......@@ -139,9 +129,6 @@ describe('ActsAnsEnableNotificationTest', function () {
var promise = await notify.isNotificationEnabled({})
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("====>time out ActsGetEnable_test_0800====>");
}, time);
})
/*
* @tc.number: ActsGetEnable_test_0900
......@@ -162,9 +149,6 @@ describe('ActsAnsEnableNotificationTest', function () {
done();
})
})
setTimeout(function(){
console.debug("====>time out ActsGetDisplay_test_0900====>");
}, time);
})
/*
* @tc.number: ActsGetEnable_test_1000
......@@ -184,9 +168,6 @@ describe('ActsAnsEnableNotificationTest', function () {
expect(promise).assertEqual(true)
done();
})
setTimeout(function(){
console.debug("===>time out ActsGetDisplay_test_1000===>");
}, time);
})
/*
* @tc.number: ActsSetEnable_test_0100
......@@ -200,9 +181,6 @@ describe('ActsAnsEnableNotificationTest', function () {
console.log("===>ActsSetEnable_test_0100 success===>"+err)
})
done();
setTimeout(function(){
console.debug("====>time out ActsSetEnable_test_0100====>");
}, time);
})
/*
* @tc.number: ActsSetEnable_test_0200
......@@ -215,9 +193,6 @@ describe('ActsAnsEnableNotificationTest', function () {
},100)
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("===>time out ActsSetEnable_test_0200===>");
}, time);
})
/*
* @tc.number: ActsSetEnable_test_0300
......@@ -229,12 +204,9 @@ describe('ActsAnsEnableNotificationTest', function () {
bundle:"Wrong BundleName"
},true,(err) => {
console.log("===>ActsSetEnable_test_0300 success===>"+err.code)
expect(err.code).assertEqual(errorCode)
expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE)
})
done();
setTimeout(function(){
console.debug("====>time out ActsSetDisplay_test_0300====>");
}, time);
})
/*
* @tc.number: ActsSetEnable_test_0400
......@@ -242,14 +214,13 @@ describe('ActsAnsEnableNotificationTest', function () {
* @tc.desc: verify the function of enableNotification
*/
it('ActsSetEnable_test_0400', 0, async function (done) {
var promise = await notify.enableNotification({
notify.enableNotification({
bundle:"Wrong BundleName"
},true)
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("===>time out ActsSetEnable_test_0400===>");
}, time);
},true).then().catch((err)=>{
console.log("===>ActsSetEnable_test_0400 err===>"+err.code)
expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE)
done();
})
})
/*
* @tc.number: ActsSetEnable_test_0500
......@@ -346,7 +317,7 @@ describe('ActsAnsEnableNotificationTest', function () {
await notify.isNotificationEnabled({
bundle:"com.example.actsanslocalnotificationtest",
},(err,data) => {
console.log("===>ActsGetEnable_test_0100 success===>"+err+data)
console.log("===>ActsSetEnable_test_0900 success===>"+err+data)
expect(typeof(data)).assertEqual('boolean')
expect(data).assertEqual(false)
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册