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

!4022 XTS元能力用例整改

Merge pull request !4022 from chengxingzhen/OpenHarmony-3.1-Release
...@@ -18,16 +18,14 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from ...@@ -18,16 +18,14 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
let resultCode = 123; let resultCode = 123;
let bundleName = 'ohso.act.aafwk'; let bundleName = 'ohso.act.aafwk';
let mainAbilityName = 'ohos.acts.aafwk.jsap'; let mainAbilityName = 'ohos.acts.aafwk.jsap';
const errCode = -104; const errCode = 1;
const errCode1 = 2097152;
const errCode2 = 29360157;
describe('ConnectAbilityTest', function () { describe('ConnectAbilityTest', function () {
/* /*
* @tc.number: SUB_AA_JsApi_StartAbility_0100 * @tc.number: SUB_AA_JsApi_StartAbility_0100
* @tc.name: testAbility0100. * @tc.name: testAbility0100.
* @tc.desc: StartAbility fail with want nothing. * @tc.desc: StartAbility fail with want nothing.(by promise)
*/ */
it("SUB_AA_JsApi_StartAbility_0100", 0, async function (done) { it("SUB_AA_JsApi_StartAbility_0100", 0, async function (done) {
let parameter = { let parameter = {
...@@ -38,25 +36,63 @@ describe('ConnectAbilityTest', function () { ...@@ -38,25 +36,63 @@ describe('ConnectAbilityTest', function () {
expect().assertFail() expect().assertFail()
}).catch((error) => { }).catch((error) => {
console.log('testAbility0100 error: ' + JSON.stringify(error)) console.log('testAbility0100 error: ' + JSON.stringify(error))
expect(errCode1).assertEqual(error.code) expect(errCode).assertEqual(error.code)
}) })
done() done()
}) })
/* /*
* @tc.number: SUB_AA_JsApi_StartAbility_0200 * @tc.number: SUB_AA_JsApi_Ability_0200
* @tc.name: testAbility0200. * @tc.name: testAblity0200.
* @tc.desc: StartAbility fail with error parameter. * @tc.desc: StartAbility fail with want nothing.(by callback)
*/
it("SUB_AA_JsApi_Ability_0200", 0, async function (done) {
let parameter = {
'want': {}
}
featureAbility.startAbility(parameter, (error, data) => {
console.log('testAbility0200 data: ' + JSON.stringify(data))
console.log('testAbility0200 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code)
done();
})
})
/*
* @tc.number: SUB_AA_JsApi_StartAbility_0300
* @tc.name: testAbility0300.
* @tc.desc: StartAbility fail with error parameter.(by promise)
*/ */
it("SUB_AA_JsApi_StartAbility_0200", 0, async function (done) { it("SUB_AA_JsApi_StartAbility_0300", 0, async function (done) {
let parameter = {
'StartAbilityParameter': {
'want': {}
}
}
await featureAbility.startAbility(parameter).then((data) => {
console.log('testAbility0300 data: ' + JSON.stringify(data))
expect().assertFail()
}).catch((error) => {
console.log('testAbility0300 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code)
})
done()
})
/*
* @tc.number: SUB_AA_JsApi_StartAbility_0400
* @tc.name: testAbility0400.
* @tc.desc: StartAbility fail with error parameter.(by callback)
*/
it("SUB_AA_JsApi_StartAbility_0400", 0, async function (done) {
let parameter = { let parameter = {
'StartAbilityParameter': { 'StartAbilityParameter': {
'want': {} 'want': {}
} }
} }
featureAbility.startAbility((parameter), (error, data) => { featureAbility.startAbility((parameter), (error, data) => {
console.log('testAbility0200 data: ' + JSON.stringify(data)) console.log('testAbility0400 data: ' + JSON.stringify(data))
console.log('testAbility0200 error: ' + JSON.stringify(error)) console.log('testAbility0400 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code) expect(errCode).assertEqual(error.code)
done() done()
}) })
...@@ -65,7 +101,7 @@ describe('ConnectAbilityTest', function () { ...@@ -65,7 +101,7 @@ describe('ConnectAbilityTest', function () {
/* /*
* @tc.number: SUB_AA_JsApi_Ability_0500 * @tc.number: SUB_AA_JsApi_Ability_0500
* @tc.name: testAblity0500. * @tc.name: testAblity0500.
* @tc.desc: startAbility-want configure action+entities- there is no Ability corresponding to entities. * @tc.desc: startAbility-want configure action+entities- there is no Ability corresponding to entities.(by promise)
*/ */
it("SUB_AA_JsApi_Ability_0500", 0, async function (done) { it("SUB_AA_JsApi_Ability_0500", 0, async function (done) {
let parameter = { let parameter = {
...@@ -81,7 +117,7 @@ describe('ConnectAbilityTest', function () { ...@@ -81,7 +117,7 @@ describe('ConnectAbilityTest', function () {
expect().assertFail() expect().assertFail()
}).catch((error) => { }).catch((error) => {
console.log('testAblity0500 error: ' + JSON.stringify(error)) console.log('testAblity0500 error: ' + JSON.stringify(error))
expect(errCode1).assertEqual(error.code) expect(errCode).assertEqual(error.code)
}) })
done() done()
}) })
...@@ -89,38 +125,35 @@ describe('ConnectAbilityTest', function () { ...@@ -89,38 +125,35 @@ describe('ConnectAbilityTest', function () {
/* /*
* @tc.number: SUB_AA_JsApi_Ability_0600 * @tc.number: SUB_AA_JsApi_Ability_0600
* @tc.name: testAblity0600. * @tc.name: testAblity0600.
* @tc.desc: startAbility-want-configuration action+entities-entities is configured as a string. * @tc.desc: startAbility-want configure action+entities- there is no Ability corresponding to entities.(by callback)
*/ */
it("SUB_AA_JsApi_Ability_0600", 0, async function (done) { it("SUB_AA_JsApi_Ability_0600", 0, async function (done) {
let parameter = { let parameter = {
'want': { 'want': {
'action': 'action.ohos.acts.aafwk.jsapi.MainAbility', 'action': 'action.ohos.acts.aafwk.jsapi.MainAbility',
'entities': 'abc123' 'entities': [
'entity.com.example.mytestw.ENITIES22'
]
} }
} }
await featureAbility.startAbility(parameter).then((data) => { featureAbility.startAbility((parameter), (error, data) => {
console.log('testAblity0600 data: ' + JSON.stringify(data)) console.log('testAbility0600 data: ' + JSON.stringify(data))
expect().assertFail() console.log('testAbility0600 error: ' + JSON.stringify(error))
}).catch((error) => { expect(errCode).assertEqual(error.code)
console.log('testAblity0600 error: ' + JSON.stringify(error)) done()
expect(errCode1).assertEqual(error.code)
}) })
done()
}) })
/* /*
* @tc.number: SUB_AA_JsApi_Ability_0700 * @tc.number: SUB_AA_JsApi_Ability_0700
* @tc.name: testAblity0700. * @tc.name: testAblity0700.
* @tc.desc: startAbility-want configure action+entities- entities is configurd as a string. * @tc.desc: startAbility-want-configuration action+entities-entities is configured as a string.(by promise)
*/ */
it("SUB_AA_JsApi_Ability_0700", 0, async function (done) { it("SUB_AA_JsApi_Ability_0700", 0, async function (done) {
let parameter = { let parameter = {
'startAbilityParameter': { 'want': {
'want': { 'action': 'action.ohos.acts.aafwk.jsapi.MainAbility',
'bundleName': bundleName, 'entities': 'abc123'
'abilityName': mainAbilityName
}
} }
} }
await featureAbility.startAbility(parameter).then((data) => { await featureAbility.startAbility(parameter).then((data) => {
...@@ -136,86 +169,229 @@ describe('ConnectAbilityTest', function () { ...@@ -136,86 +169,229 @@ describe('ConnectAbilityTest', function () {
/* /*
* @tc.number: SUB_AA_JsApi_Ability_0800 * @tc.number: SUB_AA_JsApi_Ability_0800
* @tc.name: testAblity0800. * @tc.name: testAblity0800.
* @tc.desc: startAbility-want configure action+entities- entities is configurd as a string. * @tc.desc: startAbility-want-configuration action+entities-entities is configured as a string.(by callback)
*/ */
it("SUB_AA_JsApi_Ability_0800", 0, async function (done) { it("SUB_AA_JsApi_Ability_0800", 0, async function (done) {
let parameter = { let parameter = {
'want': {} 'want': {
'action': 'action.ohos.acts.aafwk.jsapi.MainAbility',
'entities': 'abc123'
}
} }
featureAbility.startAbility(parameter, (err, data) => { featureAbility.startAbility((parameter), (error, data) => {
console.log('testAblity0800 data: ' + JSON.stringify(data) + ',err: ' + JSON.stringify(err)) console.log('testAblity0800 data: ' + JSON.stringify(data))
expect(errCode1).assertEqual(err.code) console.log('testAblity0800 error: ' + JSON.stringify(error))
done(); expect(errCode).assertEqual(error.code)
done()
}) })
}) })
/* /*
* @tc.number: SUB_AA_JsApi_Ability_0900 * @tc.number: SUB_AA_JsApi_Ability_0900
* @tc.name: testAblity0900. * @tc.name: testAblity0900.
* @tc.desc: startAbility: The input parameter want is not configured (the value is {}). * @tc.desc: startAbility-want configure action+entities- entities is configurd as a string.(by promise)
*/ */
it("SUB_AA_JsApi_Ability_0900", 0, async function (done) { it("SUB_AA_JsApi_Ability_0900", 0, async function (done) {
let parameter = {} let parameter = {
featureAbility.startAbility(parameter, (err, data) => { 'startAbilityParameter': {
console.log('testAblity0900 data: ' + JSON.stringify(data) + ',err: ' + JSON.stringify(err)) 'want': {
expect(errCode).assertEqual(err.code) 'bundleName': bundleName,
done(); 'abilityName': mainAbilityName
}
}
}
await featureAbility.startAbility(parameter).then((data) => {
console.log('testAblity0900 data: ' + JSON.stringify(data))
expect().assertFail()
}).catch((error) => {
console.log('testAblity0900 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code)
}) })
done()
}) })
/* /*
* @tc.number: SUB_AA_JsApi_Ability_1000 * @tc.number: SUB_AA_JsApi_Ability_1000
* @tc.name: testAblity1000. * @tc.name: testAblity1000.
* @tc.desc: startAbility: The input parameter is uddefined. * @tc.desc: startAbility-want configure action+entities- entities is configurd as a string.(by callback)
*/ */
it("SUB_AA_JsApi_Ability_1000", 0, async function (done) { it("SUB_AA_JsApi_Ability_1000", 0, async function (done) {
await featureAbility.startAbility(undefined).then((data) => { let parameter = {
'startAbilityParameter': {
'want': {
'bundleName': bundleName,
'abilityName': mainAbilityName
}
}
}
featureAbility.startAbility((parameter), (error, data) => {
console.log('testAblity1000 data: ' + JSON.stringify(data)) console.log('testAblity1000 data: ' + JSON.stringify(data))
console.log('testAblity1000 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code)
done()
})
})
/*
* @tc.number: SUB_AA_JsApi_Ability_1100
* @tc.name: testAblity1100.
* @tc.desc: startAbility: The input parameter want is not configured (the value is {}).(by promise)
*/
it("SUB_AA_JsApi_Ability_1100", 0, async function (done) {
let parameter = {}
await featureAbility.startAbility(parameter).then((data) => {
console.log('testAblity1100 data: ' + JSON.stringify(data))
expect().assertFail() expect().assertFail()
}).catch((error) => { }).catch((error) => {
console.log('testAblity1000 error: ' + JSON.stringify(error)) console.log('testAblity1100 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code) expect(errCode).assertEqual(error.code)
}) })
done() done()
}) })
/* /*
* @tc.number: SUB_AA_JsApi_Ability_1200 * @tc.number: SUB_AA_JsApi_Ability_1200
* @tc.name: testAblity1200. * @tc.name: testAblity1200.
* @tc.desc: startAbilityForResult: The input parameter want is not configured (the value is {}). * @tc.desc: startAbility: The input parameter want is not configured (the value is {}).(by callback)
*/ */
it("SUB_AA_JsApi_Ability_1200", 0, async function (done) { it("SUB_AA_JsApi_Ability_1200", 0, async function (done) {
let parameter = {} let parameter = {}
await featureAbility.startAbilityForResult(parameter).then((data) => { featureAbility.startAbility(parameter, (error, data) => {
console.log('testAblity2900 data: ' + JSON.stringify(data) + ',err: ' + JSON.stringify(err)) console.log('testAblity1200 data: ' + JSON.stringify(data))
expect.assertFail() console.log('testAblity1200 error: ' + JSON.stringify(error))
}).catch((err) => { expect(errCode).assertEqual(error.code)
console.log('testAblity1200' + JSON.stringify(err)); done();
expect().assertEqual(err.code)
}) })
done()
}) })
/* /*
* @tc.number: SUB_AA_JsApi_Ability_1300 * @tc.number: SUB_AA_JsApi_Ability_1300
* @tc.name: testAblity1300. * @tc.name: testAblity1300.
* @tc.desc: startAbilityForResult: The input parameter optParam is undefined. * @tc.desc: startAbility: The input parameter is uddefined.(by promise)
*/ */
it("SUB_AA_JsApi_Ability_1300", 0, async function (done) { it("SUB_AA_JsApi_Ability_1300", 0, async function (done) {
featureAbility.startAbilityForResult(undefined, (err) => { await featureAbility.startAbility(undefined).then((data) => {
console.log('testAblity1300' + JSON.stringify(err)); console.log('testAblity1300 data: ' + JSON.stringify(data))
expect(errCode1).assertEqual(err.code) expect().assertFail()
done() }).catch((error) => {
console.log('testAblity1300 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code)
}) })
done()
}) })
/* /*
* @tc.number: SUB_AA_JsApi_Ability_1400 * @tc.number: SUB_AA_JsApi_Ability_1400
* @tc.name: testAblity1400. * @tc.name: testAblity1400.
* @tc.desc: startAbilityForResult-wrong input parameter format want a layer outside. * @tc.desc: startAbility: The input parameter is uddefined.(by callback)
*/ */
it("SUB_AA_JsApi_Ability_1400", 0, async function (done) { it("SUB_AA_JsApi_Ability_1400", 0, async function (done) {
featureAbility.startAbility(undefined, (error, data) => {
console.log('testAblity1400 data: ' + JSON.stringify(data))
console.log('testAblity1400 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code)
done();
})
})
/*
* @tc.number: SUB_AA_JsApi_Ability_1500
* @tc.name: testAblity1500.
* @tc.desc: startAbilityForResult: The input parameter want is not configured (the value is {}).(by promise)
*/
it("SUB_AA_JsApi_Ability_1500", 0, async function (done) {
let parameter = {}
await featureAbility.startAbilityForResult(parameter).then((data) => {
console.log('testAblity1500 data: ' + JSON.stringify(data))
expect.assertFail()
}).catch((error) => {
console.log('testAblity1500' + JSON.stringify(error));
expect(errCode).assertEqual(error.code)
})
done()
})
/*
* @tc.number: SUB_AA_JsApi_Ability_1600
* @tc.name: testAblity1600.
* @tc.desc: startAbilityForResult: The input parameter want is not configured (the value is {}).(by callback)
*/
it("SUB_AA_JsApi_Ability_1600", 0, async function (done) {
let parameter = {}
featureAbility.startAbilityForResult(parameter, (error, data) => {
console.log('testAblity1600 data: ' + JSON.stringify(data))
console.log('testAblity1600 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code)
console.log('testAblity1600-1 error: ' + JSON.stringify(error))
done();
})
})
/*
* @tc.number: SUB_AA_JsApi_Ability_1700
* @tc.name: testAblity1700.
* @tc.desc: startAbilityForResult: The input parameter optParam is undefined.(by promise)
*/
it("SUB_AA_JsApi_Ability_1700", 0, async function (done) {
await featureAbility.startAbilityForResult(undefined).then((data) => {
console.log('testAblity1700 data: ' + JSON.stringify(data))
expect.assertFail()
}).catch((error) => {
console.log('testAblity1700' + JSON.stringify(error));
expect(errCode).assertEqual(error.code)
})
done()
})
/*
* @tc.number: SUB_AA_JsApi_Ability_1800
* @tc.name: testAblity1800.
* @tc.desc: startAbilityForResult: The input parameter optParam is undefined.(by callback)
*/
it("SUB_AA_JsApi_Ability_1800", 0, async function (done) {
featureAbility.startAbilityForResult(undefined, (error) => {
console.log('testAblity1800' + JSON.stringify(error));
expect(errCode).assertEqual(error.code)
done()
})
})
/*
* @tc.number: SUB_AA_JsApi_Ability_1900
* @tc.name: testAblity1900.
* @tc.desc: startAbilityForResult-wrong input parameter format want a layer outside.(by promise)
*/
it("SUB_AA_JsApi_Ability_1900", 0, async function (done) {
let parameter = {
'StartAbilityParameter': {
'want': {
'bundleName': bundleName,
'abilityName': mainAbilityName,
'parameters': {
'key': resultCode,
'terminate': true
}
}
}
}
await featureAbility.startAbilityForResult(parameter).then((data) => {
console.log('testAblity1900 data: ' + JSON.stringify(data))
expect.assertFail()
}).catch((error) => {
console.log('testAblity1900 err:' + JSON.stringify(error));
expect(errCode).assertEqual(error.code)
})
done()
})
/*
* @tc.number: SUB_AA_JsApi_Ability_2000
* @tc.name: testAblity2000.
* @tc.desc: startAbilityForResult-wrong input parameter format want a layer outside.(by callback)
*/
it("SUB_AA_JsApi_Ability_2000", 0, async function (done) {
let parameter = { let parameter = {
'StartAbilityParameter': { 'StartAbilityParameter': {
'want': { 'want': {
...@@ -228,17 +404,17 @@ describe('ConnectAbilityTest', function () { ...@@ -228,17 +404,17 @@ describe('ConnectAbilityTest', function () {
} }
} }
} }
featureAbility.startAbilityForResult(parameter, (err, data) => { featureAbility.startAbilityForResult(parameter, (error, data) => {
console.log('testAblity1400' + JSON.stringify(err)); console.log('testAblity2000' + JSON.stringify(error));
expect(errCode1).assertEqual(err.code) expect(errCode).assertEqual(error.code)
done() done()
}) })
}) })
/* /*
* @tc.number: SUB_AA_JsApi_Ability_2100 * @tc.number: SUB_AA_JsApi_Ability_2100
* @tc.name: testAblity2100. * @tc.name: testAblity2100.
* @tc.desc: startAbilityForResult-want-Set bundleName and abilityName+flag-flag to character strings. * @tc.desc: startAbilityForResult-want-Set bundleName and abilityName+flag-flag to character strings.(by promise)
*/ */
it("SUB_AA_JsApi_Ability_2100", 0, async function (done) { it("SUB_AA_JsApi_Ability_2100", 0, async function (done) {
let parameter = { let parameter = {
...@@ -255,10 +431,34 @@ describe('ConnectAbilityTest', function () { ...@@ -255,10 +431,34 @@ describe('ConnectAbilityTest', function () {
await featureAbility.startAbilityForResult(parameter).then((data) => { await featureAbility.startAbilityForResult(parameter).then((data) => {
console.log('testAblity2100 data: ' + JSON.stringify(data)) console.log('testAblity2100 data: ' + JSON.stringify(data))
expect.assertFail() expect.assertFail()
}).catch((err) => { }).catch((error) => {
console.log('testAblity2100' + JSON.stringify(err)); console.log('testAblity2100' + JSON.stringify(error));
expect(undefined).assertEqual(err.code) expect(errCode).assertEqual(error.code)
}) })
done() done()
}) })
/*
* @tc.number: SUB_AA_JsApi_Ability_2200
* @tc.name: testAblity2200.
* @tc.desc: startAbilityForResult-want-Set bundleName and abilityName+flag-flag to character strings.(by callback)
*/
it("SUB_AA_JsApi_Ability_2200", 0, async function (done) {
let parameter = {
'want': {
'bundleName': bundleName,
'abilityName': mainAbilityName,
'flages': 'abc',
'parameters': {
'key': resultCode,
'terminate': true
}
}
}
featureAbility.startAbilityForResult(parameter, (error, data) => {
console.log('testAblity2200' + JSON.stringify(error));
expect(errCode).assertEqual(error.code)
done()
})
})
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册