提交 a49442fd 编写于 作者: C chengxingzhen

元能力用例修改

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 3d8da962
......@@ -31,6 +31,7 @@ group("ability_runtime") {
"actsshellcommandfunctionalitytest:actsshellcommandfunctionalitytest",
"actsstartrunnertest:ActsStartRunnerTest",
"actsstserviceabilityclientcase:ActsStServiceAbilityClientCaseTest",
"actssupportfunction:actssupportfunction",
"actsusers:actsusers",
"amscontextualinforquery:amscontextualinforquery",
"amsdatauriutils:ActsAmsDataUriUtilsTest",
......@@ -49,7 +50,6 @@ group("ability_runtime") {
"non_concurrent:non_concurrent",
"processmultiinstance:processmultiinstance",
"stage:stage",
"supportfunctiontest:supportfunctiontest",
"want:want",
"workercontextcover:workercontextcover",
......
......@@ -13,14 +13,14 @@
import("//test/xts/tools/build/suite.gni")
group("supportfunctiontest") {
group("actssupportfunction") {
testonly = true
if (is_standard_system) {
deps = [
"actssupportfunctiontest:ActsSupportFunctionTest",
"fasupportfunction:fasupportfunction",
"fasupportfunctionthree:fasupportfunctionthree",
"stagesupportfunction:StageSupportFunction",
"supportfunction:SupportFunction",
]
}
}
......@@ -13,30 +13,30 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("SupportFunction") {
ohos_js_hap_suite("ActsSupportFunctionTest") {
hap_profile = "entry/src/main/module.json"
deps = [
":supportfunction_js_assets",
":supportfunction_resources",
":actssupportfunctiontest_js_assets",
":actssupportfunctiontest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "SupportFunction"
hap_name = "ActsSupportFunctionTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("supportfunction_app_profile") {
ohos_app_scope("actssupportfunctiontest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("supportfunction_js_assets") {
ohos_js_assets("actssupportfunctiontest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("supportfunction_resources") {
ohos_resources("actssupportfunctiontest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":supportfunction_app_profile" ]
deps = [ ":actssupportfunctiontest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
......@@ -11,7 +11,7 @@
"kits": [
{
"test-file-name": [
"SupportFunction.hap",
"ActsSupportFunctionTest.hap",
"FaSupportFunction.hap",
"FaSupportFunctionTwo.hap",
"FaSupportFunctionThree.hap",
......
......@@ -23,6 +23,8 @@ ohos_js_hap_suite("ActsFaApiCoverTest") {
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsFaApiCoverTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_js_assets("faapicoverhaptest_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
......
......@@ -33,7 +33,7 @@
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": "com.example.faapicoverhaptest.MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
......@@ -46,7 +46,7 @@
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcLanguage": "ets",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
......@@ -62,7 +62,7 @@
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "com.example.entry",
"package": "com.example.faapicoverhaptest",
"srcPath": "",
"name": ".entry",
"js": [
......@@ -81,6 +81,10 @@
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
......
......@@ -19,11 +19,32 @@ import commonEvent from '@ohos.commonEvent';
import appManager from "@ohos.application.appManager";
import wantConstant from '@ohos.ability.wantConstant';
import rpc from "@ohos.rpc";
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
var TAG
export default function verificationTest(){
describe('VerificationTestTest', function() {
let sleepTimeOne = 1000;
let TAG1 = "SUB_AA_OpenHarmony == ";
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
afterEach(async (done) => {
console.log(TAG1 + "afterEach called");
let cmd = "aa force-stop ohos.acts.aafwk.test.faauxiliary";
await abilityDelegator.executeShellCommand(cmd).then((data) => {
console.log(TAG1 + "executeShellCommand : data : " + data.stdResult);
console.log(TAG1 + "executeShellCommand : data : " + data.exitCode);
}).catch((error) => {
console.log(TAG1 + "executeShellCommand error : " + JSON.stringify(error));
})
setTimeout(() => {
console.log(TAG1 + "afterEach end");
done();
}, sleepTimeOne);
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_HasWindowFocus_0100
* @tc.name Start ability to judge whether there is window focus.
......@@ -65,7 +86,7 @@ export default function verificationTest(){
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility'
}
}
ability_featureAbility.startAbility(wantNum).then((data) => {
await ability_featureAbility.startAbility(wantNum).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
......@@ -162,7 +183,7 @@ export default function verificationTest(){
flags: wantConstant.Flags.FLAG_ABILITY_CONTINUATION
}
}
ability_featureAbility.startAbility(wantNum1).then((data) => {
await ability_featureAbility.startAbility(wantNum1).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
number3 = err.code
......@@ -176,7 +197,7 @@ export default function verificationTest(){
flags: wantConstant.Flags.FLAG_ABILITY_MISSION_TOP
}
}
ability_featureAbility.startAbility(wantNum2).then((data) => {
await ability_featureAbility.startAbility(wantNum2).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
......@@ -191,7 +212,7 @@ export default function verificationTest(){
flags: wantConstant.Flags.FLAG_INSTALL_ON_DEMAND
}
}
ability_featureAbility.startAbility(wantNum3).then((data) => {
await ability_featureAbility.startAbility(wantNum3).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
......@@ -205,6 +226,79 @@ export default function verificationTest(){
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_GetWindow_0100
* @tc.name Call GetWindow interface.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_GetWindow_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_GetWindow_0100 ==>';
try {
ability_featureAbility.getWindow((err, data) => {
console.info(TAG + "getWindow err = " + JSON.stringify(err));
console.info(TAG + "getWindow data = " + data);
done();
})
} catch (err) {
console.info(TAG + "getWindow catch err = " + JSON.stringify(err));
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_TerminateSelfWithResult_0100
* @tc.name CTerminate ability through TerminateSelfWithResult.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_TerminateSelfWithResult_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_TerminateSelfWithResult_0100 ==>';
try {
let resultCode = undefined
let subscriber = null
let subscribeInfo = {
events: ["Fa_Auxiliary_MainAbility6_onDestroy"]
}
function SubscribeInfoCallback(err, data) {
console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_MainAbility6_onDestroy") {
setTimeout(()=>{
expect(resultCode).assertEqual(661);
commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback)
}, 1000)
}
}
function UnSubscribeInfoCallback(err, data) {
console.info(TAG + "===UnSubscribeInfoCallback===")
done()
}
commonEvent.createSubscriber(subscribeInfo, (err, data) => {
console.info(TAG + "===CreateSubscriberCallback===")
subscriber = data
commonEvent.subscribe(subscriber, SubscribeInfoCallback)
})
let wantNum = {
want: {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility6'
}
}
await ability_featureAbility.startAbilityForResult(wantNum).then((data) => {
console.info(TAG + "startAbilityForResult data = " + JSON.stringify(data));
resultCode = data.resultCode
}).catch((err) => {
console.info(TAG + "startAbilityForResult err = " + JSON.stringify(err));
expect().assertFail();
done();
});
} catch (err) {
console.info(TAG + "getWindow catch err = " + JSON.stringify(err));
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_ServiceAbility_0100
* @tc.name Start and stop serviceability.
......@@ -241,7 +335,7 @@ export default function verificationTest(){
abilityName: 'ohos.acts.aafwk.test.faauxiliary.ServiceAbility'
}
}
ability_featureAbility.startAbility(wantNum).then((data) => {
await ability_featureAbility.startAbility(wantNum).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
......@@ -274,11 +368,11 @@ export default function verificationTest(){
let subscribeInfo = {
events: ["Fa_Auxiliary_ServiceAbility2_onConnect", "Fa_Auxiliary_ServiceAbility2_onDisconnect"]
}
function SubscribeInfoCallback(err, data) {
async function SubscribeInfoCallback(err, data) {
console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_ServiceAbility2_onConnect") {
liseList.push("onConnect")
ability_featureAbility.disconnectAbility(num).then((data) => {
await ability_featureAbility.disconnectAbility(num).then((data) => {
console.info(TAG + "disconnectAbility data = " + JSON.stringify(data));
}).catch((err) => {
console.info(TAG + "disconnectAbility err = " + JSON.stringify(err));
......@@ -346,78 +440,5 @@ export default function verificationTest(){
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_GetWindow_0100
* @tc.name Call GetWindow interface.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_GetWindow_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_GetWindow_0100 ==>';
try {
ability_featureAbility.getWindow((err, data) => {
console.info(TAG + "getWindow err = " + JSON.stringify(err));
console.info(TAG + "getWindow data = " + data);
done();
})
} catch (err) {
console.info(TAG + "getWindow catch err = " + JSON.stringify(err));
done();
}
})
/*
* @tc.number SUB_AA_OpenHarmony_Test_TerminateSelfWithResult_0100
* @tc.name CTerminate ability through TerminateSelfWithResult.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_OpenHarmony_Test_TerminateSelfWithResult_0100', 0, async function(done) {
TAG = 'SUB_AA_OpenHarmony_Test_TerminateSelfWithResult_0100 ==>';
try {
let resultCode = undefined
let subscriber = null
let subscribeInfo = {
events: ["Fa_Auxiliary_MainAbility6_onDestroy"]
}
function SubscribeInfoCallback(err, data) {
console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_MainAbility6_onDestroy") {
setTimeout(()=>{
expect(resultCode).assertEqual(661);
commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback)
}, 1000)
}
}
function UnSubscribeInfoCallback(err, data) {
console.info(TAG + "===UnSubscribeInfoCallback===")
done()
}
commonEvent.createSubscriber(subscribeInfo, (err, data) => {
console.info(TAG + "===CreateSubscriberCallback===")
subscriber = data
commonEvent.subscribe(subscriber, SubscribeInfoCallback)
})
let wantNum = {
want: {
bundleName: 'ohos.acts.aafwk.test.faauxiliary',
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility6'
}
}
ability_featureAbility.startAbilityForResult(wantNum).then((data) => {
console.info(TAG + "startAbilityForResult data = " + JSON.stringify(data));
resultCode = data.resultCode
}).catch((err) => {
console.info(TAG + "startAbilityForResult err = " + JSON.stringify(err));
expect().assertFail();
done();
});
} catch (err) {
console.info(TAG + "getWindow catch err = " + JSON.stringify(err));
done();
}
})
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册