提交 9bca7c1a 编写于 作者: I inter515

新增用例+用例名称整改

Signed-off-by: Ninter515 <ry.renyi@huawei.com>
上级 1a9f665d
......@@ -23,12 +23,12 @@ const ERR_MERSSAGE = 'value is not an available number';
export default function ActsBmsHasInstalldTest() {
describe('ActsBmsHasInstalldTest', function () {
/**
* @tc.number hasInstalled_0100
* @tc.name Package::hasInstalled
/*
* @tc.number SUB_BMS_HAP_STATUS_0001
* @tc.name testHasInstalled
* @tc.desc Test hasInstalled interface.
*/
it('hasInstalled_0100', 0, async function (done) {
it('testHasInstalled', 0, async function (done) {
let flag = 0;
pkg.hasInstalled({
bundleName: 'com.example.third2',
......@@ -49,54 +49,73 @@ describe('ActsBmsHasInstalldTest', function () {
});
});
/**
* @tc.number hasInstalled_0200
* @tc.name Package::hasInstalled
* @tc.desc Test hasInstalled interface.
/*
* @tc.number SUB_BMS_HAP_STATUS_0002
* @tc.name testHasInstalledNoSuccess
* @tc.desc Test hasInstalled interface without success function.
*/
it('hasInstalled_0200', 0, async function (done) {
let flag = 0;
it('testHasInstalledNoSuccess', 0, async function (done) {
pkg.hasInstalled({
bundleName: 'wrongName',
success: function success(data) {
console.info('hasInstalled success function in');
flag += 1;
expect(data.result).assertFalse();
},
bundleName: 'com.example.third2',
fail: function fail(data, code) {
console.info('hasInstalled fail function in');
expect().assertFail();
},
complete: function complete() {
console.info('hasInstalled complete function in');
expect(flag).assertEqual(1);
done();
}
});
});
/**
* @tc.number hasInstalled_0300
* @tc.name Package::hasInstalled
* @tc.desc Test hasInstalled interface.
/*
* @tc.number SUB_BMS_HAP_STATUS_0003
* @tc.name testHasInstalledNoFailComplete
* @tc.desc Test hasInstalled without fail function and complete function.
*/
it('hasInstalled_0300', 0, async function (done) {
it('testHasInstalledNoFailComplete', 0, async function (done) {
pkg.hasInstalled({
bundleName: 'wrongName',
bundleName: 'com.example.third2',
success: function success(data) {
console.info('hasInstalled success function in');
expect(data.result).assertTrue();
done();
}
});
});
/*
* @tc.number SUB_BMS_HAP_STATUS_0004
* @tc.name hasInstalledHapNotExist
* @tc.desc Test hasInstalled when hap not exist.
*/
it('hasInstalledHapNotExist', 0, async function (done) {
let flag = 0;
pkg.hasInstalled({
bundleName: 'wrongName',
success: function success(data) {
console.info('hasInstalled success function in' + JSON.stringify(data));
flag += 1;
expect(data.result).assertFalse();
},
fail: function fail(data, code) {
console.info('hasInstalled fail function in');
expect().assertFail();
},
complete: function complete() {
console.info('hasInstalled complete function in');
expect(flag).assertEqual(1);
done();
}
});
});
/**
* @tc.number hasInstalled_0400
* @tc.name Package::hasInstalled
* @tc.desc Test hasInstalled interface.
/*
* @tc.number SUB_BMS_HAP_STATUS_0007
* @tc.name testHasInstalledNumberParam
* @tc.desc Test hasInstalled when bundleName is number.
*/
it('hasInstalled_0400', 0, async function (done) {
it('testHasInstalledNumberParam', 0, async function (done) {
let flag = 0;
pkg.hasInstalled({
bundleName: NUM_TWO,
......@@ -111,41 +130,97 @@ describe('ActsBmsHasInstalldTest', function () {
expect(code).assertEqual(ERR_CODE);
},
complete: function complete() {
flag += 3;
console.info('hasInstalled complete function in');
expect(flag).assertEqual(5)
expect(flag).assertEqual(2)
done();
}
});
});
/*
* @tc.number: hasInstalled_0500
* @tc.name: test hasInstalled bundleName is number
* @tc.desc: test hasInstalled bundleName is number without function fail
* @tc.level 3
*/
it('hasInstalled_0500', 0, async function (done) {
* @tc.number SUB_BMS_HAP_STATUS_0008
* @tc.name testHasInstalledFailNotExist
* @tc.desc Test hasInstalled without function fail.
*/
it('testHasInstalledFailNotExist', 0, async function (done) {
pkg.hasInstalled({
bundleName: NUM_TWO,
success: function success(data) {
console.info('hasInstalled success' + JSON.stringify(data));
expect(error).assertFail();
console.info('hasInstalled success function in');
expect().assertFail();
},
complete: function complete() {
console.info('hasInstalled complete');
console.info('hasInstalled complete function in');
done();
}
})
});
});
/*
* @tc.number SUB_BMS_HAP_STATUS_0009
* @tc.name testHasInstalledCompleteNotExit
* @tc.desc Test hasInstalled without function complete.
*/
it('testHasInstalledCompleteNotExit', 0, async function (done) {
pkg.hasInstalled({
bundleName: undefined,
success: function success(data) {
console.info('hasInstalled success function in');
expect().assertFail();
done();
},
fail: function fail(data, code) {
console.info('hasInstalled fail function in');
expect(data).assertEqual(ERR_MERSSAGE);
expect(code).assertEqual(ERR_CODE);
done();
}
});
});
/*
* @tc.number SUB_BMS_HAP_STATUS_0010
* @tc.name testHasInstalledReturnNotExist
* @tc.desc Test hasInstalled without function fail and function complete.
*/
it('testHasInstalledReturnNotExist', 0, async function (done) {
let status = "normal";
pkg.hasInstalled({
bundleName: NUM_TWO,
success: function success(data) {
status = "success";
console.info('hasInstalled success function in');
expect().assertFail();
}
});
await sleep(500);
expect(status).assertEqual("normal");
done();
});
/*
* @tc.number SUB_BMS_HAP_STATUS_0013
* @tc.name testHasInstalledNoFailCompleteBundleNotExist
* @tc.desc Test hasInstalled interface without function fail and function complete bundleName not exiet
*/
it('testHasInstalledNoFailCompleteBundleNotExist', 0, async function (done) {
pkg.hasInstalled({
bundleName: 'wrongName',
success: function success(data) {
console.info('hasInstalled success function in');
expect(data.result).assertFalse();
done();
}
});
});
/*
* @tc.number: hasInstalled_0600
* @tc.name: test hasInstalled bundleName is number
* @tc.number: SUB_BMS_HAP_STATUS_0014
* @tc.name: testHasInstalledInvalidParamCompleteNotExit
* @tc.desc: test hasInstalled bundleName is number without function complete
* @tc.level 3
*/
it('hasInstalled_0600', 0, async function (done) {
it('testHasInstalledInvalidParamCompleteNotExit', 0, async function (done) {
pkg.hasInstalled({
bundleName: NUM_TWO,
success: function success(data) {
......@@ -161,4 +236,14 @@ describe('ActsBmsHasInstalldTest', function () {
}
})
});
async function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
})}
......@@ -44,7 +44,7 @@
"type": "page",
"isVisible": "true",
"launchType": "standard",
"orientation": "followrecent",
"orientation": "followRecent",
"language": "C++"
}
],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册