提交 a49442fd 编写于 作者: C chengxingzhen

元能力用例修改

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 3d8da962
...@@ -31,6 +31,7 @@ group("ability_runtime") { ...@@ -31,6 +31,7 @@ group("ability_runtime") {
"actsshellcommandfunctionalitytest:actsshellcommandfunctionalitytest", "actsshellcommandfunctionalitytest:actsshellcommandfunctionalitytest",
"actsstartrunnertest:ActsStartRunnerTest", "actsstartrunnertest:ActsStartRunnerTest",
"actsstserviceabilityclientcase:ActsStServiceAbilityClientCaseTest", "actsstserviceabilityclientcase:ActsStServiceAbilityClientCaseTest",
"actssupportfunction:actssupportfunction",
"actsusers:actsusers", "actsusers:actsusers",
"amscontextualinforquery:amscontextualinforquery", "amscontextualinforquery:amscontextualinforquery",
"amsdatauriutils:ActsAmsDataUriUtilsTest", "amsdatauriutils:ActsAmsDataUriUtilsTest",
...@@ -49,7 +50,6 @@ group("ability_runtime") { ...@@ -49,7 +50,6 @@ group("ability_runtime") {
"non_concurrent:non_concurrent", "non_concurrent:non_concurrent",
"processmultiinstance:processmultiinstance", "processmultiinstance:processmultiinstance",
"stage:stage", "stage:stage",
"supportfunctiontest:supportfunctiontest",
"want:want", "want:want",
"workercontextcover:workercontextcover", "workercontextcover:workercontextcover",
......
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
group("supportfunctiontest") { group("actssupportfunction") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"actssupportfunctiontest:ActsSupportFunctionTest",
"fasupportfunction:fasupportfunction", "fasupportfunction:fasupportfunction",
"fasupportfunctionthree:fasupportfunctionthree", "fasupportfunctionthree:fasupportfunctionthree",
"stagesupportfunction:StageSupportFunction", "stagesupportfunction:StageSupportFunction",
"supportfunction:SupportFunction",
] ]
} }
} }
...@@ -13,30 +13,30 @@ ...@@ -13,30 +13,30 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("SupportFunction") { ohos_js_hap_suite("ActsSupportFunctionTest") {
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
deps = [ deps = [
":supportfunction_js_assets", ":actssupportfunctiontest_js_assets",
":supportfunction_resources", ":actssupportfunctiontest_resources",
] ]
ets2abc = true ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "SupportFunction" hap_name = "ActsSupportFunctionTest"
subsystem_name = "ability" subsystem_name = "ability"
part_name = "ability_runtime" part_name = "ability_runtime"
} }
ohos_app_scope("supportfunction_app_profile") { ohos_app_scope("actssupportfunctiontest_app_profile") {
app_profile = "AppScope/app.json" app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ] sources = [ "AppScope/resources" ]
} }
ohos_js_assets("supportfunction_js_assets") { ohos_js_assets("actssupportfunctiontest_js_assets") {
source_dir = "entry/src/main/ets" source_dir = "entry/src/main/ets"
} }
ohos_resources("supportfunction_resources") { ohos_resources("actssupportfunctiontest_resources") {
sources = [ "entry/src/main/resources" ] sources = [ "entry/src/main/resources" ]
deps = [ ":supportfunction_app_profile" ] deps = [ ":actssupportfunctiontest_app_profile" ]
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"kits": [ "kits": [
{ {
"test-file-name": [ "test-file-name": [
"SupportFunction.hap", "ActsSupportFunctionTest.hap",
"FaSupportFunction.hap", "FaSupportFunction.hap",
"FaSupportFunctionTwo.hap", "FaSupportFunctionTwo.hap",
"FaSupportFunctionThree.hap", "FaSupportFunctionThree.hap",
......
...@@ -23,6 +23,8 @@ ohos_js_hap_suite("ActsFaApiCoverTest") { ...@@ -23,6 +23,8 @@ ohos_js_hap_suite("ActsFaApiCoverTest") {
ets2abc = true ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsFaApiCoverTest" hap_name = "ActsFaApiCoverTest"
subsystem_name = "ability"
part_name = "ability_runtime"
} }
ohos_js_assets("faapicoverhaptest_ets_assets") { ohos_js_assets("faapicoverhaptest_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility" source_dir = "./entry/src/main/ets/MainAbility"
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"orientation": "unspecified", "orientation": "unspecified",
"visible": true, "visible": true,
"srcPath": "MainAbility", "srcPath": "MainAbility",
"name": "com.example.faapicoverhaptest.MainAbility", "name": ".MainAbility",
"srcLanguage": "ets", "srcLanguage": "ets",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:MainAbility_desc", "description": "$string:MainAbility_desc",
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
"orientation": "unspecified", "orientation": "unspecified",
"formsEnabled": false, "formsEnabled": false,
"name": ".TestAbility", "name": ".TestAbility",
"srcLanguage": "js", "srcLanguage": "ets",
"srcPath": "TestAbility", "srcPath": "TestAbility",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:TestAbility_desc", "description": "$string:TestAbility_desc",
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
"deliveryWithInstall": true, "deliveryWithInstall": true,
"moduleName": "entry" "moduleName": "entry"
}, },
"package": "com.example.entry", "package": "com.example.faapicoverhaptest",
"srcPath": "", "srcPath": "",
"name": ".entry", "name": ".entry",
"js": [ "js": [
...@@ -81,6 +81,10 @@ ...@@ -81,6 +81,10 @@
} }
}, },
{ {
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [ "pages": [
"pages/index" "pages/index"
], ],
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test' import testsuite from '../test/List.test'
export default { export default {
......
...@@ -19,11 +19,32 @@ import commonEvent from '@ohos.commonEvent'; ...@@ -19,11 +19,32 @@ import commonEvent from '@ohos.commonEvent';
import appManager from "@ohos.application.appManager"; import appManager from "@ohos.application.appManager";
import wantConstant from '@ohos.ability.wantConstant'; import wantConstant from '@ohos.ability.wantConstant';
import rpc from "@ohos.rpc"; import rpc from "@ohos.rpc";
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
var TAG var TAG
export default function verificationTest(){ export default function verificationTest(){
describe('VerificationTestTest', function() { 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.number SUB_AA_OpenHarmony_Test_HasWindowFocus_0100
* @tc.name Start ability to judge whether there is window focus. * @tc.name Start ability to judge whether there is window focus.
...@@ -65,7 +86,7 @@ export default function verificationTest(){ ...@@ -65,7 +86,7 @@ export default function verificationTest(){
abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility' 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)); console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err)); console.info(TAG + "startAbility err = " + JSON.stringify(err));
...@@ -162,7 +183,7 @@ export default function verificationTest(){ ...@@ -162,7 +183,7 @@ export default function verificationTest(){
flags: wantConstant.Flags.FLAG_ABILITY_CONTINUATION 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)); console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
number3 = err.code number3 = err.code
...@@ -176,7 +197,7 @@ export default function verificationTest(){ ...@@ -176,7 +197,7 @@ export default function verificationTest(){
flags: wantConstant.Flags.FLAG_ABILITY_MISSION_TOP 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)); console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err)); console.info(TAG + "startAbility err = " + JSON.stringify(err));
...@@ -191,7 +212,7 @@ export default function verificationTest(){ ...@@ -191,7 +212,7 @@ export default function verificationTest(){
flags: wantConstant.Flags.FLAG_INSTALL_ON_DEMAND 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)); console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err)); console.info(TAG + "startAbility err = " + JSON.stringify(err));
...@@ -205,6 +226,79 @@ export default function verificationTest(){ ...@@ -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.number SUB_AA_OpenHarmony_Test_ServiceAbility_0100
* @tc.name Start and stop serviceability. * @tc.name Start and stop serviceability.
...@@ -241,7 +335,7 @@ export default function verificationTest(){ ...@@ -241,7 +335,7 @@ export default function verificationTest(){
abilityName: 'ohos.acts.aafwk.test.faauxiliary.ServiceAbility' 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)); console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err)); console.info(TAG + "startAbility err = " + JSON.stringify(err));
...@@ -274,11 +368,11 @@ export default function verificationTest(){ ...@@ -274,11 +368,11 @@ export default function verificationTest(){
let subscribeInfo = { let subscribeInfo = {
events: ["Fa_Auxiliary_ServiceAbility2_onConnect", "Fa_Auxiliary_ServiceAbility2_onDisconnect"] 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)) console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data))
if (data.event == "Fa_Auxiliary_ServiceAbility2_onConnect") { if (data.event == "Fa_Auxiliary_ServiceAbility2_onConnect") {
liseList.push("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)); console.info(TAG + "disconnectAbility data = " + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.info(TAG + "disconnectAbility err = " + JSON.stringify(err)); console.info(TAG + "disconnectAbility err = " + JSON.stringify(err));
...@@ -346,78 +440,5 @@ export default function verificationTest(){ ...@@ -346,78 +440,5 @@ export default function verificationTest(){
done(); 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.
先完成此消息的编辑!
想要评论请 注册