Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
dd1f49f6
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dd1f49f6
编写于
5月 21, 2022
作者:
B
bayanxing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加StartAbility的测试用例
Signed-off-by:
N
bayanxing
<
bayanxing@kaihongdigi.com
>
上级
976d4a2c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
214 addition
and
65 deletion
+214
-65
aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js
...itytest/entry/src/main/js/test/StartAbilityJsunit.test.js
+214
-65
未找到文件。
aafwk/aafwk_standard/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js
浏览文件 @
dd1f49f6
...
...
@@ -27,7 +27,7 @@ describe('ConnectAbilityTest', function () {
/*
* @tc.number: SUB_AA_JsApi_StartAbility_0100
* @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
)
{
let
parameter
=
{
...
...
@@ -44,19 +44,57 @@ describe('ConnectAbilityTest', function () {
})
/*
* @tc.number: SUB_AA_JsApi_StartAbility_0200
* @tc.name: testAbility0200.
* @tc.desc: StartAbility fail with error parameter.
* @tc.number: SUB_AA_JsApi_Ability_0200
* @tc.name: testAblity0200.
* @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
(
errCode1
).
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_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_0
2
00
"
,
0
,
async
function
(
done
)
{
it
(
"
SUB_AA_JsApi_StartAbility_0
4
00
"
,
0
,
async
function
(
done
)
{
let
parameter
=
{
'
StartAbilityParameter
'
:
{
'
want
'
:
{}
}
}
featureAbility
.
startAbility
((
parameter
),
(
error
,
data
)
=>
{
console
.
log
(
'
testAbility0
2
00 data:
'
+
JSON
.
stringify
(
data
))
console
.
log
(
'
testAbility0
2
00 error:
'
+
JSON
.
stringify
(
error
))
console
.
log
(
'
testAbility0
4
00 data:
'
+
JSON
.
stringify
(
data
))
console
.
log
(
'
testAbility0
4
00 error:
'
+
JSON
.
stringify
(
error
))
expect
(
errCode
).
assertEqual
(
error
.
code
)
done
()
})
...
...
@@ -65,7 +103,7 @@ describe('ConnectAbilityTest', function () {
/*
* @tc.number: SUB_AA_JsApi_Ability_0500
* @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
)
{
let
parameter
=
{
...
...
@@ -89,38 +127,35 @@ describe('ConnectAbilityTest', function () {
/*
* @tc.number: SUB_AA_JsApi_Ability_0600
* @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
)
{
let
parameter
=
{
'
want
'
:
{
'
action
'
:
'
action.ohos.acts.aafwk.jsapi.MainAbility
'
,
'
entities
'
:
'
abc123
'
'
entities
'
:
[
'
entity.com.example.mytestw.ENITIES22
'
]
}
}
await
featureAbility
.
startAbility
(
parameter
).
then
((
data
)
=>
{
console
.
log
(
'
testAblity0600 data:
'
+
JSON
.
stringify
(
data
))
expect
().
assertFail
()
}).
catch
((
error
)
=>
{
console
.
log
(
'
testAblity0600 error:
'
+
JSON
.
stringify
(
error
))
featureAbility
.
startAbility
((
parameter
),
(
error
,
data
)
=>
{
console
.
log
(
'
testAbility0600 data:
'
+
JSON
.
stringify
(
data
))
console
.
log
(
'
testAbility0600 error:
'
+
JSON
.
stringify
(
error
))
expect
(
errCode1
).
assertEqual
(
error
.
code
)
done
()
})
done
()
})
/*
* @tc.number: SUB_AA_JsApi_Ability_0700
* @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
)
{
let
parameter
=
{
'
startAbilityParameter
'
:
{
'
want
'
:
{
'
bundleName
'
:
bundleName
,
'
abilityName
'
:
mainAbilityName
}
'
want
'
:
{
'
action
'
:
'
action.ohos.acts.aafwk.jsapi.MainAbility
'
,
'
entities
'
:
'
abc123
'
}
}
await
featureAbility
.
startAbility
(
parameter
).
then
((
data
)
=>
{
...
...
@@ -128,7 +163,7 @@ describe('ConnectAbilityTest', function () {
expect
().
assertFail
()
}).
catch
((
error
)
=>
{
console
.
log
(
'
testAblity0700 error:
'
+
JSON
.
stringify
(
error
))
expect
(
errCode
).
assertEqual
(
error
.
code
)
expect
(
errCode
1
).
assertEqual
(
error
.
code
)
})
done
()
})
...
...
@@ -136,86 +171,200 @@ describe('ConnectAbilityTest', function () {
/*
* @tc.number: SUB_AA_JsApi_Ability_0800
* @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
)
{
let
parameter
=
{
'
want
'
:
{}
'
want
'
:
{
'
action
'
:
'
action.ohos.acts.aafwk.jsapi.MainAbility
'
,
'
entities
'
:
'
abc123
'
}
}
featureAbility
.
startAbility
(
parameter
,
(
err
,
data
)
=>
{
console
.
log
(
'
testAblity0800 data:
'
+
JSON
.
stringify
(
data
)
+
'
,err:
'
+
JSON
.
stringify
(
err
))
expect
(
errCode1
).
assertEqual
(
err
.
code
)
done
();
featureAbility
.
startAbility
((
parameter
),
(
error
,
data
)
=>
{
console
.
log
(
'
testAblity0800 data:
'
+
JSON
.
stringify
(
data
))
console
.
log
(
'
testAblity0800 error:
'
+
JSON
.
stringify
(
error
))
expect
(
errCode1
).
assertEqual
(
error
.
code
)
done
()
})
})
/*
* @tc.number: SUB_AA_JsApi_Ability_0900
* @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
)
{
let
parameter
=
{}
featureAbility
.
startAbility
(
parameter
,
(
err
,
data
)
=>
{
console
.
log
(
'
testAblity0900 data:
'
+
JSON
.
stringify
(
data
)
+
'
,err:
'
+
JSON
.
stringify
(
err
))
expect
(
errCode
).
assertEqual
(
err
.
code
)
done
();
let
parameter
=
{
'
startAbilityParameter
'
:
{
'
want
'
:
{
'
bundleName
'
:
bundleName
,
'
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.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
)
{
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 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
()
}).
catch
((
error
)
=>
{
console
.
log
(
'
testAblity1
0
00 error:
'
+
JSON
.
stringify
(
error
))
console
.
log
(
'
testAblity1
1
00 error:
'
+
JSON
.
stringify
(
error
))
expect
(
errCode
).
assertEqual
(
error
.
code
)
})
done
()
})
/*
* @tc.number: SUB_AA_JsApi_Ability_1200
* @tc.name: testAblity1200.
* @tc.desc: startAbility
ForResult: 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
)
{
let
parameter
=
{}
await
featureAbility
.
startAbilityForResult
(
parameter
).
then
((
data
)
=>
{
console
.
log
(
'
testAblity2900 data:
'
+
JSON
.
stringify
(
data
)
+
'
,err:
'
+
JSON
.
stringify
(
err
))
expect
.
assertFail
()
}).
catch
((
err
)
=>
{
console
.
log
(
'
testAblity1200
'
+
JSON
.
stringify
(
err
));
expect
().
assertEqual
(
err
.
code
)
featureAbility
.
startAbility
(
parameter
,
(
error
,
data
)
=>
{
console
.
log
(
'
testAblity1200 data:
'
+
JSON
.
stringify
(
data
))
console
.
log
(
'
testAblity1200 error:
'
+
JSON
.
stringify
(
error
))
expect
(
errCode
).
assertEqual
(
error
.
code
)
done
();
})
done
()
})
/*
* @tc.number: SUB_AA_JsApi_Ability_1300
* @tc.name: testAblity1300.
* @tc.desc: startAbility
ForResult: 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
)
{
featureAbility
.
startAbilityForResult
(
undefined
,
(
err
)
=>
{
console
.
log
(
'
testAblity1300
'
+
JSON
.
stringify
(
err
));
expect
(
errCode1
).
assertEqual
(
err
.
code
)
done
()
await
featureAbility
.
startAbility
(
undefined
).
then
((
data
)
=>
{
console
.
log
(
'
testAblity1300 data:
'
+
JSON
.
stringify
(
data
))
expect
().
assertFail
()
}).
catch
((
error
)
=>
{
console
.
log
(
'
testAblity1300 error:
'
+
JSON
.
stringify
(
error
))
expect
(
errCode
).
assertEqual
(
error
.
code
)
})
done
()
})
/*
* @tc.number: SUB_AA_JsApi_Ability_1400
* @tc.name: testAblity1400.
* @tc.desc: startAbility
ForResult-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
)
{
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
().
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
().
assertEqual
(
error
.
code
)
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
(
errCode1
).
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
(
errCode1
).
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 callback)
*/
it
(
"
SUB_AA_JsApi_Ability_1900
"
,
0
,
async
function
(
done
)
{
let
parameter
=
{
'
StartAbilityParameter
'
:
{
'
want
'
:
{
...
...
@@ -228,19 +377,19 @@ describe('ConnectAbilityTest', function () {
}
}
}
featureAbility
.
startAbilityForResult
(
parameter
,
(
err
,
data
)
=>
{
console
.
log
(
'
testAblity1
400
'
+
JSON
.
stringify
(
er
r
));
expect
(
errCode1
).
assertEqual
(
err
.
code
)
featureAbility
.
startAbilityForResult
(
parameter
,
(
err
or
,
data
)
=>
{
console
.
log
(
'
testAblity1
900
'
+
JSON
.
stringify
(
erro
r
));
expect
(
errCode1
).
assertEqual
(
err
or
.
code
)
done
()
})
})
/*
* @tc.number: SUB_AA_JsApi_Ability_2
1
00
* @tc.name: testAblity2
1
00.
* @tc.desc: startAbilityForResult-want-Set bundleName and abilityName+flag-flag to character strings.
* @tc.number: SUB_AA_JsApi_Ability_2
0
00
* @tc.name: testAblity2
0
00.
* @tc.desc: startAbilityForResult-want-Set bundleName and abilityName+flag-flag to character strings.
(by promise)
*/
it
(
"
SUB_AA_JsApi_Ability_2
1
00
"
,
0
,
async
function
(
done
)
{
it
(
"
SUB_AA_JsApi_Ability_2
0
00
"
,
0
,
async
function
(
done
)
{
let
parameter
=
{
'
want
'
:
{
'
bundleName
'
:
bundleName
,
...
...
@@ -253,11 +402,11 @@ describe('ConnectAbilityTest', function () {
}
}
await
featureAbility
.
startAbilityForResult
(
parameter
).
then
((
data
)
=>
{
console
.
log
(
'
testAblity2
1
00 data:
'
+
JSON
.
stringify
(
data
))
console
.
log
(
'
testAblity2
0
00 data:
'
+
JSON
.
stringify
(
data
))
expect
.
assertFail
()
}).
catch
((
err
)
=>
{
console
.
log
(
'
testAblity2
100
'
+
JSON
.
stringify
(
er
r
));
expect
(
undefined
).
assertEqual
(
err
.
code
)
}).
catch
((
err
or
)
=>
{
console
.
log
(
'
testAblity2
000
'
+
JSON
.
stringify
(
erro
r
));
expect
(
undefined
).
assertEqual
(
err
or
.
code
)
})
done
()
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录