提交 d1943e3b 编写于 作者: W wenfei

issue: I4S878 add aafwk and appexecfwk xts

Signed-off-by: Nwenfei <wenfei9@huawei.com>
上级 eab83d83
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/lite/build/suite_lite.gni")
hctest_suite("ActsAbilityMgrTest") {
suite_name = "acts"
sources = [ "src/ability_mgr_test.c" ]
include_dirs = [
"${aafwk_lite_path}/interfaces/kits/want_lite",
"${aafwk_lite_path}/interfaces/kits/ability_lite",
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
"//foundation/communication/ipc_lite/interfaces/kits",
]
cflags = [ "-Wno-error" ]
}
{
"description": "Config for $module test cases",
"environment": [
{
"type": "device",
"label": "wifiiot"
}
],
"kits": [
{
"type": "DeployKit",
"timeout": "20000",
"burn_file": "$subsystem/$module.bin"
}
],
"driver": {
"type": "CTestLite"
}
}
\ No newline at end of file
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <stdlib.h>
#include "hctest.h"
#include "ohos_types.h"
#include "ability_manager.h"
#include "want.h"
/**
* @brief register a test suit named AbilityMgrTestSuite
* @param subsystem name is aafwk
* @param module name is abilitymgr
* @param test suit name is AbilityMgrTestSuite
*/
LITE_TEST_SUIT(aafwk, abilitymgr, AbilityMgrTestSuite);
static BOOL AbilityMgrTestSuiteSetUp(void)
{
printf("----------test case with AbilityMgrTest start-------------\n");
return TRUE;
}
static BOOL AbilityMgrTestSuiteTearDown(void)
{
printf("----------test case with AbilityMgrTest end-------------\n");
return TRUE;
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0001
* @tc.name : testClearElement parameter legal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(AbilityMgrTestSuite, testClearElement, Function | MediumTest | Level0)
{
printf("------start testClearElement------\n");
ElementName element = { 0 };
bool ret = SetElementAbilityName(&element, "SecondAbility");
if (ret) {
char aName[] = "SecondAbility";
TEST_ASSERT_EQUAL_STRING(element.abilityName, aName);
ClearElement(&element);
TEST_ASSERT_EQUAL_STRING(element.abilityName, NULL);
}
printf("------end testClearElement------\n");
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0002
* @tc.name : testClearElement parameter illegal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(AbilityMgrTestSuite, testClearElementIllegal, Function | MediumTest | Level0)
{
printf("------start testClearElementIllegal------\n");
ElementName element = { 0 };
bool ret = SetElementAbilityName(&element, "SecondAbility");
if (ret) {
char aName[] = "SecondAbility";
TEST_ASSERT_EQUAL_STRING(element.abilityName, aName);
ClearElement(NULL);
TEST_ASSERT_EQUAL_STRING(element.abilityName, aName);
}
printf("------end testClearElementIllegal------\n");
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0003
* @tc.name : testSetWantElement parameter legal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantElement, Function | MediumTest | Level0)
{
printf("------start testSetWantElement------\n");
Want want = { 0 };
ElementName element = { 0 };
SetElementDeviceID(&element, "0001000");
SetElementBundleName(&element, "com.openharmony.testnative");
SetElementAbilityName(&element, "SecondAbility");
if (element.abilityName != NULL) {
bool ret = SetWantElement(&want, element);
if (ret) {
TEST_ASSERT_EQUAL_STRING(want.element->deviceId, "0001000");
TEST_ASSERT_EQUAL_STRING(want.element->abilityName, "SecondAbility");
TEST_ASSERT_EQUAL_STRING(want.element->bundleName, "com.openharmony.testnative");
}
}
ClearElement(&element);
ClearWant(&want);
printf("------end testSetWantElement------\n");
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0004
* @tc.name : testSetWantElement parameter illegal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantElementIllegal, Function | MediumTest | Level2)
{
printf("------start testSetWantElementIllegal------\n");
Want want= { 0 };
ElementName element = { 0 };
bool ret = SetWantElement(&want, element);
if (ret) {
TEST_ASSERT_EQUAL_STRING(want.element->deviceId, NULL);
TEST_ASSERT_EQUAL_STRING(want.element->abilityName, NULL);
TEST_ASSERT_EQUAL_STRING(want.element->bundleName, NULL);
}
ClearElement(&element);
TEST_ASSERT_EQUAL_STRING(element.abilityName, NULL);
ClearWant(&want);
TEST_ASSERT_EQUAL_STRING(want.element, NULL);
printf("------end testSetWantElementIllegal------\n");
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0005
* @tc.name : testClearWant parameter illegal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(AbilityMgrTestSuite, testClearWantIllegal, Function | MediumTest | Level2)
{
printf("------start testClearWantIllegal------\n");
Want want = { 0 };
ElementName element = { 0 };
bool ret = SetElementAbilityName(&element, "SecondAbility");
if (ret) {
ret = SetWantElement(&want, element);
if (ret) {
char aName[] = "SecondAbility";
TEST_ASSERT_EQUAL_STRING(want.element->abilityName, aName);
ClearWant(NULL);
TEST_ASSERT_EQUAL_STRING(want.element->abilityName, aName);
}
}
ClearElement(&element);
ClearWant(&want);
printf("------end testClearWantIllegal------\n");
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0006
* @tc.name : testSetWantDate parameter legal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantDate, Function | MediumTest | Level0)
{
printf("------start testSetWantDate------\n");
Want want = { 0 };
SetWantData(&want, "test", 5);
if (want.data != NULL) {
TEST_ASSERT_EQUAL_STRING((char*)(want.data), "test");
TEST_ASSERT_TRUE(want.dataLength == 5);
}
ClearWant(&want);
printf("------end testSetWantDate------\n");
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0007
* @tc.name : testSetWantDate parameter illegal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantDateIllegal, Function | MediumTest | Level2)
{
printf("------start testSetWantDateIllegal------\n");
Want want = { 0 };
SetWantData(&want, "test", -1);
TEST_ASSERT_EQUAL_STRING((char*)(want.data), NULL);
TEST_ASSERT_FALSE(want.dataLength);
SetWantData(&want, NULL, 0);
TEST_ASSERT_EQUAL_STRING((char*)(want.data), NULL);
TEST_ASSERT_FALSE(want.dataLength);
printf("------end testSetWantDateIllegal------\n");
}
RUN_TEST_SUITE(AbilityMgrTestSuite);
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/lite/build/suite_lite.gni")
hctest_suite("ActsBundleMgrTest") {
suite_name = "acts"
sources = [ "src/bundle_mgr_test.c" ]
include_dirs = [
"${aafwk_lite_path}/interfaces/kits/want_lite",
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
]
cflags = [ "-Wno-error" ]
}
{
"description": "Config for $module test cases",
"environment": [
{
"type": "device",
"label": "wifiiot"
}
],
"kits": [
{
"type": "DeployKit",
"timeout": "20000",
"burn_file": "$subsystem/$module.bin"
}
],
"driver": {
"type": "CTestLite"
}
}
\ No newline at end of file
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <string.h>
#include <unistd.h>
#include "hctest.h"
#include "securec.h"
#include "bundle_info.h"
#include "bundle_manager.h"
#include "want.h"
/**
* @brief register a test suit named BundleMgrTestSuite
* @param subsystem name is appexecfwk
* @param module name is bundlemgr
* @param test suit name is BundleMgrTestSuite
*/
LITE_TEST_SUIT(appexecfwk, bundlemgr, BundleMgrTestSuite);
static BOOL BundleMgrTestSuiteSetUp(void)
{
printf("----------test case with BundleMgrTest start-------------\n");
return TRUE;
}
static BOOL BundleMgrTestSuiteTearDown(void)
{
printf("----------test case with BundleMgrTest end-------------\n");
return TRUE;
}
/**
* @tc.number : SUB_APPEXECFWK_0001
* @tc.name : testClearAbilityInfo parameter illegal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoIllegal, Function | MediumTest | Level2)
{
printf("------start testClearAbilityInfoIllegal------\n");
AbilityInfo abilityInfo = { 0 };
memset_s(&abilityInfo, sizeof(abilityInfo), 0, sizeof(abilityInfo));
abilityInfo.bundleName = "com.openharmony.testjsdemo";
ClearAbilityInfo(NULL);
TEST_ASSERT_EQUAL_STRING(abilityInfo.bundleName, "com.openharmony.testjsdemo");
printf("------end testClearAbilityInfoIllegal------\n");
}
/**
* @tc.number : SUB_APPEXECFWK_0002
* @tc.name : testClearBundleInfo parameter legal test with bundle name
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoIllegal, Function | MediumTest | Level2)
{
printf("------start testClearBundleInfoIllegal------\n");
BundleInfo bundleInfo = { 0 };
memset_s(&bundleInfo, sizeof(bundleInfo), 0, sizeof(bundleInfo));
bundleInfo.bundleName = "com.openharmony.testjsdemo";
ClearBundleInfo(NULL);
TEST_ASSERT_EQUAL_STRING(bundleInfo.bundleName, "com.openharmony.testjsdemo");
printf("------end testClearBundleInfoIllegal------\n");
}
/**
* @tc.number : SUB_APPEXECFWK_0003
* @tc.name : testSetElementAbilityName parameter legal test
* @tc.desc : [C- SOFTWARE -0100]
*/
LITE_TEST_CASE(BundleMgrTestSuite, testSetElementAbilityName, Function | MediumTest | Level0)
{
printf("------start testSetElementAbilityName------\n");
Want want = { 0 };
ElementName element = { 0 };
SetElementAbilityName(&element, "SecondAbility");
SetWantElement(&want, element);
char *aName = "SecondAbility";
TEST_ASSERT_EQUAL_STRING(want.element->abilityName, aName);
ClearElement(&element);
ClearWant(&want);
printf("------end testSetElementAbilityName------\n");
}
/**
* @tc.number : SUB_APPEXECFWK_0004
* @tc.name : testSetElementAbilityName parameter illegal test
* @tc.desc : [C- SOFTWARE -0100]
*/
LITE_TEST_CASE(BundleMgrTestSuite, testSetElementAbilityNameIllegal, Function | MediumTest | Level2)
{
printf("------start testSetElementAbilityNameIllegal------\n");
Want want = { 0 };
ElementName element = { 0 };
char *aName = "";
SetElementAbilityName(&element, aName);
SetWantElement(&want, element);
TEST_ASSERT_EQUAL_STRING(want.element->abilityName, "");
SetElementAbilityName(&element, NULL);
SetWantElement(&want, element);
TEST_ASSERT_EQUAL_STRING(want.element->abilityName, NULL);
ClearElement(&element);
ClearWant(&want);
printf("------end testSetElementAbilityNameIllegal------\n");
}
/**
* @tc.number : SUB_APPEXECFWK_0005
* @tc.name : testSetElementBundleName parameter legal test
* @tc.desc : [C- SOFTWARE -0100]
*/
LITE_TEST_CASE(BundleMgrTestSuite, testSetElementBundleName, Function | MediumTest | Level0)
{
printf("------start testSetElementBundleName------\n");
Want want = { 0 };
ElementName element = { 0 };
SetElementBundleName(&element, "com.openharmony.testjsdemo");
SetWantElement(&want, element);
char *bName = "com.openharmony.testjsdemo";
TEST_ASSERT_EQUAL_STRING(want.element->bundleName, bName);
ClearElement(&element);
ClearWant(&want);
printf("------end testSetElementBundleName------\n");
}
/**
* @tc.number : SUB_APPEXECFWK_0006
* @tc.name : testSetElementBundleName parameter illegal test
* @tc.desc : [C- SOFTWARE -0100]
*/
LITE_TEST_CASE(BundleMgrTestSuite, testSetElementBundleNameIllegal, Function | MediumTest | Level2)
{
printf("------start testSetElementBundleNameIllegal------\n");
Want want = { 0 };
ElementName element = { 0 };
SetElementBundleName(&element, "");
SetWantElement(&want, element);
char *bName = "";
TEST_ASSERT_EQUAL_STRING(want.element->bundleName, bName);
SetElementBundleName(&element, NULL);
SetWantElement(&want, element);
TEST_ASSERT_EQUAL_STRING(want.element->bundleName, NULL);
ClearElement(&element);
ClearWant(&want);
printf("------end testSetElementBundleNameIllegal------\n");
}
/**
* @tc.number : SUB_APPEXECFWK_0007
* @tc.name : testSetElementDeviceID parameter legal test
* @tc.desc : [C- SOFTWARE -0100]
*/
LITE_TEST_CASE(BundleMgrTestSuite, testSetElementDeviceID, Function | MediumTest | Level0)
{
printf("------start testSetElementDeviceID------\n");
Want want = { 0 };
ElementName element = { 0 };
SetElementDeviceID(&element, "0001000");
SetWantElement(&want, element);
char *dID = "0001000";
TEST_ASSERT_EQUAL_STRING(want.element->deviceId, dID);
ClearElement(&element);
ClearWant(&want);
printf("------end testSetElementDeviceID------\n");
}
/**
* @tc.number : SUB_APPEXECFWK_0008
* @tc.name : testSetElementDeviceID parameter illegal test
* @tc.desc : [C- SOFTWARE -0100]
*/
LITE_TEST_CASE(BundleMgrTestSuite, testSetElementDeviceIDIllegal, Function | MediumTest | Level2)
{
printf("------start testSetElementDeviceIDIllegal------\n");
Want want = { 0 };
ElementName element = { 0 };
SetElementDeviceID(&element, "");
SetWantElement(&want, element);
char *dID = "";
TEST_ASSERT_EQUAL_STRING(want.element->deviceId, dID);
SetElementDeviceID(&element, NULL);
SetWantElement(&want, element);
TEST_ASSERT_EQUAL_STRING(want.element->deviceId, NULL);
ClearElement(&element);
ClearWant(&want);
printf("------end testSetElementDeviceIDIllegal------\n");
}
RUN_TEST_SUITE(BundleMgrTestSuite);
...@@ -32,6 +32,8 @@ lite_component("acts_component") { ...@@ -32,6 +32,8 @@ lite_component("acts_component") {
} else { } else {
if (ohos_kernel_type == "liteos_m") { if (ohos_kernel_type == "liteos_m") {
all_features += [ all_features += [
"//test/xts/acts/aafwk_lite/ability_hal:ActsAbilityMgrTest",
"//test/xts/acts/appexecfwk_lite/appexecfwk_hal:ActsBundleMgrTest",
"//test/xts/acts/communication_lite/lwip_hal:ActsLwipTest", "//test/xts/acts/communication_lite/lwip_hal:ActsLwipTest",
"//test/xts/acts/communication_lite/wifiservice_hal:ActsWifiServiceTest", "//test/xts/acts/communication_lite/wifiservice_hal:ActsWifiServiceTest",
"//test/xts/acts/utils_lite/file_hal:ActsUtilsFileTest", "//test/xts/acts/utils_lite/file_hal:ActsUtilsFileTest",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册