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

!4637 XTS元能力startAbility失败用例适配

Merge pull request !4637 from chengxingzhen/OpenHarmony-3.1-Release
...@@ -17,18 +17,18 @@ import Utils from './Utils'; ...@@ -17,18 +17,18 @@ import Utils from './Utils';
import ability_featureAbility from '@ohos.ability.featureAbility'; import ability_featureAbility from '@ohos.ability.featureAbility';
import abilityManager from "@ohos.application.appManager" import abilityManager from "@ohos.application.appManager"
const TAG_TEST_0100 = ' context_isUpdatingConfigurations_test_0100 '; const TAG_TEST_0100 = 'context_isUpdatingConfigurations_test_0100';
const TAG_TEST_0200 = ' context_isUpdatingConfigurations_test_0200 '; const TAG_TEST_0200 = 'context_isUpdatingConfigurations_test_0200';
const TAG_TEST_0300 = ' context_printDrawnCompleted_test_0100 '; const TAG_TEST_0300 = 'context_printDrawnCompleted_test_0100';
const TAG_TEST_0400 = ' context_printDrawnCompleted_test_0200 '; const TAG_TEST_0400 = 'context_printDrawnCompleted_test_0200';
const TAG_TEST_0500 = ' context_getAppMemorySize_test_0100 '; const TAG_TEST_0500 = 'context_getAppMemorySize_test_0100';
const TAG_TEST_0600 = ' context_getAppMemorySize_test_0200 '; const TAG_TEST_0600 = 'context_getAppMemorySize_test_0200';
const TAG_TEST_0700 = ' context_isRamConstrainedDevice_test_0100 '; const TAG_TEST_0700 = 'context_isRamConstrainedDevice_test_0100';
const TAG_TEST_0800 = ' context_isRamConstrainedDevice_test_0200 '; const TAG_TEST_0800 = 'context_isRamConstrainedDevice_test_0200';
const TAG_TEST_0900 = ' context_featureAbility_test_0100 '; const TAG_TEST_0900 = 'context_featureAbility_test_0100';
const TAG_TEST_0010 = ' context_featureAbility_test_0200 '; const TAG_TEST_0010 = 'context_featureAbility_test_0200';
const TAG_TEST_0011 = ' context_featureAbility_test_0300 '; const TAG_TEST_0011 = 'context_featureAbility_test_0300';
const TAG_TEST_0012 = ' context_featureAbility_test_0400 '; const TAG_TEST_0012 = 'context_featureAbility_test_0400';
export default function addContextAndAbilityJsunit() { export default function addContextAndAbilityJsunit() {
describe('addContextTest', function () { describe('addContextTest', function () {
......
...@@ -19,6 +19,7 @@ let resultCode = 123; ...@@ -19,6 +19,7 @@ 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 = 1; const errCode = 1;
const errCode1 = 202;
describe('ConnectAbilityTest', function () { describe('ConnectAbilityTest', function () {
...@@ -64,12 +65,10 @@ describe('ConnectAbilityTest', function () { ...@@ -64,12 +65,10 @@ describe('ConnectAbilityTest', function () {
* @tc.desc: StartAbility fail with error parameter.(by promise) * @tc.desc: StartAbility fail with error parameter.(by promise)
*/ */
it("SUB_AA_JsApi_StartAbility_0300", 0, async function (done) { it("SUB_AA_JsApi_StartAbility_0300", 0, async function (done) {
let parameter = { let startAbilityParameter = {
'StartAbilityParameter': { 'want': {}
'want': {}
}
} }
await featureAbility.startAbility(parameter).then((data) => { await featureAbility.startAbility(startAbilityParameter).then((data) => {
console.log('testAbility0300 data: ' + JSON.stringify(data)) console.log('testAbility0300 data: ' + JSON.stringify(data))
expect().assertFail() expect().assertFail()
}).catch((error) => { }).catch((error) => {
...@@ -85,12 +84,10 @@ describe('ConnectAbilityTest', function () { ...@@ -85,12 +84,10 @@ describe('ConnectAbilityTest', function () {
* @tc.desc: StartAbility fail with error parameter.(by callback) * @tc.desc: StartAbility fail with error parameter.(by callback)
*/ */
it("SUB_AA_JsApi_StartAbility_0400", 0, async function (done) { it("SUB_AA_JsApi_StartAbility_0400", 0, async function (done) {
let parameter = { let startAbilityParameter = {
'StartAbilityParameter': { 'want': {}
'want': {}
}
} }
featureAbility.startAbility((parameter), (error, data) => { featureAbility.startAbility((startAbilityParameter), (error, data) => {
console.log('testAbility0400 data: ' + JSON.stringify(data)) console.log('testAbility0400 data: ' + JSON.stringify(data))
console.log('testAbility0400 error: ' + JSON.stringify(error)) console.log('testAbility0400 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code) expect(errCode).assertEqual(error.code)
...@@ -192,16 +189,13 @@ describe('ConnectAbilityTest', function () { ...@@ -192,16 +189,13 @@ describe('ConnectAbilityTest', function () {
* @tc.desc: startAbility-want configure action+entities- entities is configurd as a string.(by promise) * @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 startAbilityParameter = {
'startAbilityParameter': { 'want': {
'want': { 'bundleName': bundleName,
'bundleName': bundleName, 'abilityName': mainAbilityName
'abilityName': mainAbilityName
}
} }
} }
await featureAbility.startAbility(parameter).then((data) => { await featureAbility.startAbility(startAbilityParameter).then((data) => {
console.log('testAblity0900 data: ' + JSON.stringify(data)) console.log('testAblity0900 data: ' + JSON.stringify(data))
expect().assertFail() expect().assertFail()
}).catch((error) => { }).catch((error) => {
...@@ -217,16 +211,13 @@ describe('ConnectAbilityTest', function () { ...@@ -217,16 +211,13 @@ describe('ConnectAbilityTest', function () {
* @tc.desc: startAbility-want configure action+entities- entities is configurd as a string.(by callback) * @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) {
let parameter = { let startAbilityParameter = {
'startAbilityParameter': { 'want': {
'want': { 'bundleName': bundleName,
'bundleName': bundleName, 'abilityName': mainAbilityName
'abilityName': mainAbilityName
}
} }
} }
featureAbility.startAbility((parameter), (error, data) => { featureAbility.startAbility((startAbilityParameter), (error, data) => {
console.log('testAblity1000 data: ' + JSON.stringify(data)) console.log('testAblity1000 data: ' + JSON.stringify(data))
console.log('testAblity1000 error: ' + JSON.stringify(error)) console.log('testAblity1000 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code) expect(errCode).assertEqual(error.code)
...@@ -246,7 +237,7 @@ describe('ConnectAbilityTest', function () { ...@@ -246,7 +237,7 @@ describe('ConnectAbilityTest', function () {
expect().assertFail() expect().assertFail()
}).catch((error) => { }).catch((error) => {
console.log('testAblity1100 error: ' + JSON.stringify(error)) console.log('testAblity1100 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code) expect(errCode1).assertEqual(error.code)
}) })
done() done()
}) })
...@@ -261,7 +252,7 @@ describe('ConnectAbilityTest', function () { ...@@ -261,7 +252,7 @@ describe('ConnectAbilityTest', function () {
featureAbility.startAbility(parameter, (error, data) => { featureAbility.startAbility(parameter, (error, data) => {
console.log('testAblity1200 data: ' + JSON.stringify(data)) console.log('testAblity1200 data: ' + JSON.stringify(data))
console.log('testAblity1200 error: ' + JSON.stringify(error)) console.log('testAblity1200 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code) expect(errCode1).assertEqual(error.code)
done(); done();
}) })
}) })
...@@ -277,7 +268,7 @@ describe('ConnectAbilityTest', function () { ...@@ -277,7 +268,7 @@ describe('ConnectAbilityTest', function () {
expect().assertFail() expect().assertFail()
}).catch((error) => { }).catch((error) => {
console.log('testAblity1300 error: ' + JSON.stringify(error)) console.log('testAblity1300 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code) expect(errCode1).assertEqual(error.code)
}) })
done() done()
}) })
...@@ -291,7 +282,7 @@ describe('ConnectAbilityTest', function () { ...@@ -291,7 +282,7 @@ describe('ConnectAbilityTest', function () {
featureAbility.startAbility(undefined, (error, data) => { featureAbility.startAbility(undefined, (error, data) => {
console.log('testAblity1400 data: ' + JSON.stringify(data)) console.log('testAblity1400 data: ' + JSON.stringify(data))
console.log('testAblity1400 error: ' + JSON.stringify(error)) console.log('testAblity1400 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code) expect(errCode1).assertEqual(error.code)
done(); done();
}) })
}) })
...@@ -308,7 +299,7 @@ describe('ConnectAbilityTest', function () { ...@@ -308,7 +299,7 @@ describe('ConnectAbilityTest', function () {
expect.assertFail() expect.assertFail()
}).catch((error) => { }).catch((error) => {
console.log('testAblity1500' + JSON.stringify(error)); console.log('testAblity1500' + JSON.stringify(error));
expect(errCode).assertEqual(error.code) expect(errCode1).assertEqual(error.code)
}) })
done() done()
}) })
...@@ -323,7 +314,7 @@ describe('ConnectAbilityTest', function () { ...@@ -323,7 +314,7 @@ describe('ConnectAbilityTest', function () {
featureAbility.startAbilityForResult(parameter, (error, data) => { featureAbility.startAbilityForResult(parameter, (error, data) => {
console.log('testAblity1600 data: ' + JSON.stringify(data)) console.log('testAblity1600 data: ' + JSON.stringify(data))
console.log('testAblity1600 error: ' + JSON.stringify(error)) console.log('testAblity1600 error: ' + JSON.stringify(error))
expect(errCode).assertEqual(error.code) expect(errCode1).assertEqual(error.code)
console.log('testAblity1600-1 error: ' + JSON.stringify(error)) console.log('testAblity1600-1 error: ' + JSON.stringify(error))
done(); done();
}) })
...@@ -340,7 +331,7 @@ describe('ConnectAbilityTest', function () { ...@@ -340,7 +331,7 @@ describe('ConnectAbilityTest', function () {
expect.assertFail() expect.assertFail()
}).catch((error) => { }).catch((error) => {
console.log('testAblity1700' + JSON.stringify(error)); console.log('testAblity1700' + JSON.stringify(error));
expect(errCode).assertEqual(error.code) expect(errCode1).assertEqual(error.code)
}) })
done() done()
}) })
...@@ -353,7 +344,7 @@ describe('ConnectAbilityTest', function () { ...@@ -353,7 +344,7 @@ describe('ConnectAbilityTest', function () {
it("SUB_AA_JsApi_Ability_1800", 0, async function (done) { it("SUB_AA_JsApi_Ability_1800", 0, async function (done) {
featureAbility.startAbilityForResult(undefined, (error) => { featureAbility.startAbilityForResult(undefined, (error) => {
console.log('testAblity1800' + JSON.stringify(error)); console.log('testAblity1800' + JSON.stringify(error));
expect(errCode).assertEqual(error.code) expect(errCode1).assertEqual(error.code)
done() done()
}) })
}) })
...@@ -364,19 +355,17 @@ describe('ConnectAbilityTest', function () { ...@@ -364,19 +355,17 @@ describe('ConnectAbilityTest', function () {
* @tc.desc: startAbilityForResult-wrong input parameter format want a layer outside.(by promise) * @tc.desc: startAbilityForResult-wrong input parameter format want a layer outside.(by promise)
*/ */
it("SUB_AA_JsApi_Ability_1900", 0, async function (done) { it("SUB_AA_JsApi_Ability_1900", 0, async function (done) {
let parameter = { let startAbilityParameter = {
'StartAbilityParameter': { 'want': {
'want': { 'bundleName': bundleName,
'bundleName': bundleName, 'abilityName': mainAbilityName,
'abilityName': mainAbilityName, 'parameters': {
'parameters': { 'key': resultCode,
'key': resultCode, 'terminate': true
'terminate': true
}
} }
} }
} }
await featureAbility.startAbilityForResult(parameter).then((data) => { await featureAbility.startAbilityForResult(startAbilityParameter).then((data) => {
console.log('testAblity1900 data: ' + JSON.stringify(data)) console.log('testAblity1900 data: ' + JSON.stringify(data))
expect.assertFail() expect.assertFail()
}).catch((error) => { }).catch((error) => {
...@@ -392,19 +381,17 @@ describe('ConnectAbilityTest', function () { ...@@ -392,19 +381,17 @@ describe('ConnectAbilityTest', function () {
* @tc.desc: startAbilityForResult-wrong input parameter format want a layer outside.(by callback) * @tc.desc: startAbilityForResult-wrong input parameter format want a layer outside.(by callback)
*/ */
it("SUB_AA_JsApi_Ability_2000", 0, async function (done) { it("SUB_AA_JsApi_Ability_2000", 0, async function (done) {
let parameter = { let startAbilityParameter = {
'StartAbilityParameter': { 'want': {
'want': { 'bundleName': bundleName,
'bundleName': bundleName, 'abilityName': mainAbilityName,
'abilityName': mainAbilityName, 'parameters': {
'parameters': { 'key': resultCode,
'key': resultCode, 'terminate': true
'terminate': true
}
} }
} }
} }
featureAbility.startAbilityForResult(parameter, (error, data) => { featureAbility.startAbilityForResult(startAbilityParameter, (error, data) => {
console.log('testAblity2000' + JSON.stringify(error)); console.log('testAblity2000' + JSON.stringify(error));
expect(errCode).assertEqual(error.code) expect(errCode).assertEqual(error.code)
done() done()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册