同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
The X test suite (XTS) subsystem contains a set of OpenHarmony certification test suites, including the currently supported application compatibility test suite (ACTS) and the device compatibility test suite (DCTS) that will be supported in the future.
This subsystem contains the ACTS and tools software package.
OpenHarmony supports the following device types:
Mini-System Devices (reference memory ≥ 128 KB)
Such devices are equipped with MCU processors such as ARM Cortex-M and 32-bit RISC-V. They provide rich short-distance connection and peripheral bus access capabilities. Typical products include LinkIoT module devices and sensors in the smart home field. The LinkIoT module is usually used for smart Internet of Things (IoT) devices as the hardware module that implements connectivity functions. In the smart home field, the LinkIoT module is integrated into devices by vendors. For example, a LinkIoT module provides WLAN/Bluetooth access and data connection, and it usually communicates with the chip of smart home devices via a universal asynchronous receiver-transmitter (UART) or general-purpose input/output (GPIO) interface.
Small-System Devices (reference memory ≥ 1 MB)
Such devices are equipped with application processors such as ARM Cortex-A. They provide higher security capabilities, standard graphics framework, and multimedia capabilities for video encoding and decoding. Typical products include IP cameras, electronic cat eyes, and routers in the smart home field, as well as event data recorders (EDRs) in the smart travel field.
/test/xts
├── acts # Test code
│ └── subsystem # Source code of subsystem test cases for large-system devices
│ └── subsystem_lite # Source code of subsystems test cases for mini- and small-system devices
│ └── BUILD.gn # Build configuration of test cases for large-system devices
│ └── build_lite # Build configuration of test cases for mini-and small-system devices
│ └── build_lite # Build configuration
└── tools # Test tool code
Test cases for mini system devices must be developed based on C, and those for small system devices must be developed based on C++.
Table 1 Test case levels
Table 2 Test case granularities
Table 3 Test types
You should select the appropriate programming language and your target test framework to develop test cases for the devices to test.
Table 4 Test frameworks and test case languages for different devices
Developing test cases for mini-system devices
The HCTest framework is used to support test cases developed with the C language. HCTest is enhanced and adapted based on the open-source test framework Unity.
Access the test/xts/acts repository where the test cases will be stored.
├── acts
│ └──subsystem_lite
│ │ └── module_hal
│ │ │ └── BUILD.gn
│ │ │ └── src
│ └──build_lite
│ │ └── BUILD.gn
Write the test case in the src directory.
1 Import the test framework header file.
#include "hctest.h"
/**
* @brief Registers a test suite named IntTestSuite.
* @param test Subsystem name
* @param example Module name
* @param IntTestSuite Test suite name
*/
LITE_TEST_SUIT(test, example, IntTestSuite);
Format: Test suite name+Setup, Test suite name+TearDown.
The Setup and TearDown functions must exist, but function bodies can be empty.
Three parameters are involved: test suite name, test case name, and test case properties (including type, granularity, and level).
LITE_TEST_CASE(IntTestSuite, TestCase001, Function | MediumTest | Level1)
{
// Do something
};
RUN_TEST_SUITE(IntTestSuite);
Create the configuration file (BUILD.gn) of the test module.
Create a BUILD.gn (example) compilation file in each test module directory. Specify the name of the compiled static library and its dependent header file and library in the compilation file. The format is as follows:
import("//test/xts/tools/lite/build/suite_lite.gni")
hctest_suite("ActsDemoTest") {
suite_name = "acts"
sources = [
"src/test_demo.c",
]
include_dirs = [ ]
cflags = [ "-Wno-error" ]
}
Add compilation options to the BUILD.gn file in the acts directory.
You need to add the test module to the test/xts/acts/build_lite/BUILD.gn script in the acts directory.
lite_component("acts") {
...
if(board_name == "liteos_m") {
features += [
...
"//xts/acts/subsystem_lite/module_hal:ActsDemoTest"
]
}
}
Run compilation commands.
Test suites are compiled along with version compilation. The ACTS is compiled together with the debug version.
NOTE: The ACTS compiles middleware as a static library, which will be linked to the image.
Executing test cases for mini-system devices
Burn the image into the development board.
Executing the test
Analyzing the test result
View the serial port logs, whose format is as follows:
The log for each test suite starts with Start to run test suite: and ends with xx Tests xx Failures xx Ignored.
xts_acts
xts_tools
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。