<tdclass="cellrowborder"valign="top"width="33.383338333833386%"headers="mcps1.2.4.1.3 "><pid="p174824517456"><aname="p174824517456"></a><aname="p174824517456"></a>Verifies basic functionalities of key features and basic DFX attributes with the most common input. The pass result indicates that the features are runnable.</p>
<tdclass="cellrowborder"valign="top"width="33.383338333833386%"headers="mcps1.2.4.1.3 "><pid="p648184584514"><aname="p648184584514"></a><aname="p648184584514"></a>Verifies basic functionalities of key features and basic DFX attributes with common input. The pass result indicates that the features are testable.</p>
<tdclass="cellrowborder"valign="top"width="33.383338333833386%"headers="mcps1.2.4.1.3 "><pid="p348945124510"><aname="p348945124510"></a><aname="p348945124510"></a>Verifies basic functionalities of key features and basic DFX attributes with common input and errors. The pass result indicates that the features are functional and ready for beta testing.</p>
<tdclass="cellrowborder"valign="top"width="33.383338333833386%"headers="mcps1.2.4.1.3 "><pid="p8481245104519"><aname="p8481245104519"></a><aname="p8481245104519"></a>Verifies functionalities of all key features, and all DFX attributes with common and uncommon input combinations or normal and abnormal preset conditions.</p>
<tdclass="cellrowborder"valign="top"width="33.383338333833386%"headers="mcps1.2.4.1.3 "><pid="p1248445164516"><aname="p1248445164516"></a><aname="p1248445164516"></a>Verifies functionalities of key features under extremely abnormal presets and uncommon input combinations.</p>
</td>
</tr>
</tbody>
</table>
| Level | Definition | Scope |
| ----- | ----------- | ------- |
| Level0 | Smoke | Verifies basic functionalities of key features and basic DFX attributes with the most common input. The pass result indicates that the features are runnable. |
| Level1 | Basic | Verifies basic functionalities of key features and basic DFX attributes with common input. The pass result indicates that the features are testable. |
| Level2 | Major | Verifies basic functionalities of key features and basic DFX attributes with common input and errors. The pass result indicates that the features are functional and ready for beta testing. |
| Level3 | Regular | Verifies functionalities of all key features, and all DFX attributes with common and uncommon input combinations or normal and abnormal preset conditions. |
| Level4 | Rare | Verifies functionalities of key features under extremely abnormal presets and uncommon input combinations. |
<tdclass="cellrowborder"valign="top"width="35.17351735173517%"headers="mcps1.2.4.1.2 "><pid="p20414104113101"><aname="p20414104113101"></a><aname="p20414104113101"></a>Service functionalities, all-scenario features, and mechanical power environment (MPE) and scenario-level DFX</p>
</td>
<tdclass="cellrowborder"valign="top"width="45.23452345234523%"headers="mcps1.2.4.1.3 "><pid="p5414841121013"><aname="p5414841121013"></a><aname="p5414841121013"></a>Devices close to real devices</p>
<tdclass="cellrowborder"valign="top"width="35.17351735173517%"headers="mcps1.2.4.1.2 "><pid="p114141241141018"><aname="p114141241141018"></a><aname="p114141241141018"></a>Modules, subsystem functionalities after module integration, and DFX</p>
</td>
<tdclass="cellrowborder"valign="top"width="45.23452345234523%"headers="mcps1.2.4.1.3 "><pid="p14414941111015"><aname="p14414941111015"></a><aname="p14414941111015"></a>Single device that is actually used. You can perform message simulation, but do not mock functions.</p>
<tdclass="cellrowborder"valign="top"width="35.17351735173517%"headers="mcps1.2.4.1.2 "><pid="p54141541181018"><aname="p54141541181018"></a><aname="p54141541181018"></a>Modules, classes, and functions</p>
</td>
<tdclass="cellrowborder"valign="top"width="45.23452345234523%"headers="mcps1.2.4.1.3 "><pid="p1841494131013"><aname="p1841494131013"></a><aname="p1841494131013"></a>Local PC. Use a large number of mocks to replace dependencies with other modules.</p>
</td>
</tr>
</tbody>
</table>
| Test Scale | Test Objects | Test Environment |
| ----- | ----------- | ------- |
| LargeTest | Service functionalities, all-scenario features, and mechanical power environment (MPE) and scenario-level DFX | Devices close to real devices. |
| MediumTest | Modules, subsystem functionalities after module integration, and DFX | Single device that is actually used. You can perform message simulation, but do not mock functions. |
| SmallTest | Modules, classes, and functions | Local PC. Use a large number of mocks to replace dependencies with other modules. |
<tdclass="cellrowborder"valign="top"width="80.96%"headers="mcps1.2.3.1.2 "><pid="p16917344104618"><aname="p16917344104618"></a><aname="p16917344104618"></a>Tests the correctness of both service and platform functionalities provided by the tested object for end users or developers.</p>
<tdclass="cellrowborder"valign="top"width="80.96%"headers="mcps1.2.3.1.2 "><pid="p15917154410463"><aname="p15917154410463"></a><aname="p15917154410463"></a>Tests the processing capability of the tested object under specific preset conditions and load models. The processing capability is measured by the service volume that can be processed in a unit time, for example, call per second, frame per second, or event processing volume per second.</p>
<tdclass="cellrowborder"valign="top"width="80.96%"headers="mcps1.2.3.1.2 "><pid="p159171544104616"><aname="p159171544104616"></a><aname="p159171544104616"></a>Tests the power consumption of the tested object in a certain period of time under specific preset conditions and load models.</p>
<tdclass="cellrowborder"valign="top"width="80.96%"headers="mcps1.2.3.1.2 "><pid="p11917194416465"><aname="p11917194416465"></a><aname="p11917194416465"></a>Tests the service performance of the tested object under common and uncommon input conditions, or specified service volume pressure and long-term continuous running pressure. The test covers stability, pressure handling, fault injection, and Monkey test times.</p>
<tdclass="cellrowborder"valign="top"width="80.96%"headers="mcps1.2.3.1.2 "><aname="ul112421652121513"></a><aname="ul112421652121513"></a><ulid="ul112421652121513"><li>Tests the capability of defending against security threats, including but not limited to unauthorized access, use, disclosure, damage, modification, and destruction, to ensure information confidentiality, integrity, and availability.</li><li>Tests the privacy protection capability to ensure that the collection, use, retention, disclosure, and disposal of users' private data comply with laws and regulations.</li><li>Tests the compliance with various security specifications, such as security design, security requirements, and security certification of the Ministry of Industry and Information Technology (MIIT).</li></ul>
<tdclass="cellrowborder"valign="top"width="80.96%"headers="mcps1.2.3.1.2 "><pid="p179186444465"><aname="p179186444465"></a><aname="p179186444465"></a>Tests the internationalized data and localization capabilities of the tested object, including multi-language display, various input/output habits, time formats, and regional features, such as currency, time, and culture taboos.</p>
<tdclass="cellrowborder"valign="top"width="80.96%"headers="mcps1.2.3.1.2 "><aname="ul186961827111612"></a><aname="ul186961827111612"></a><ulid="ul186961827111612"><li>Tests backward compatibility of an application with its own data, the forward and backward compatibility with the system, and the compatibility with different user data, such as audio file content of the player and smart SMS messages.</li><li>Tests system backward compatibility with its own data and the compatibility of common applications in the ecosystem.</li><li>Tests software compatibility with related hardware.</li></ul>
<tdclass="cellrowborder"valign="top"width="80.96%"headers="mcps1.2.3.1.2 "><pid="p1291844494611"><aname="p1291844494611"></a><aname="p1291844494611"></a>Tests user experience of the object in real user scenarios. All conclusions and comments should come from the users, which are all subjective evaluation in this case.</p>
<tdclass="cellrowborder"valign="top"width="80.96%"headers="mcps1.2.3.1.2 "><pid="p0918124424614"><aname="p0918124424614"></a><aname="p0918124424614"></a>Tests the compliance with industry and company-specific standards, protocols, and specifications. The standards here do not include any security standards that should be classified into the security test.</p>
<tdclass="cellrowborder"valign="top"width="80.96%"headers="mcps1.2.3.1.2 "><pid="p1291818443468"><aname="p1291818443468"></a><aname="p1291818443468"></a>Tests the safety property of the tested object to avoid possible hazards to personal safety, health, and the object itself.</p>
<tdclass="cellrowborder"valign="top"width="80.96%"headers="mcps1.2.3.1.2 "><pid="p891815444462"><aname="p891815444462"></a><aname="p891815444462"></a>Tests the resilience property of the tested object to ensure that it can withstand and maintain the defined running status (including downgrading) when being attacked, and recover from and adapt defense to the attacks to approach mission assurance.</p>
</td>
</tr>
</tbody>
</table>
| Type | Definition |
| ----------- | ------- |
| Function | Tests the correctness of both service and platform functionalities provided by the tested object for end users or developers. |
| Performance | Tests the processing capability of the tested object under specific preset conditions and load models. The processing capability is measured by the service volume that can be processed in a unit time, for example, call per second, frame per second, or event processing volume per second. |
| Power | Tests the power consumption of the tested object in a certain period of time under specific preset conditions and load models. |
| Reliability | Tests the service performance of the tested object under common and uncommon input conditions, or specified service volume pressure and long-term continuous running pressure. The test covers stability, pressure handling, fault injection, and Monkey test times. |
| Security | <ul><li>Tests the capability of defending against security threats, including but not limited to unauthorized access, use, disclosure, damage, modification, and destruction, to ensure information confidentiality, integrity, and availability.</li><li>Tests the privacy protection capability to ensure that the collection, use, retention, disclosure, and disposal of users' private data comply with laws and regulations.</li><li>Tests the compliance with various security specifications, such as security design, security requirements, and security certification of the Ministry of Industry and Information Technology (MIIT).</li></ul> |
| Global | Tests the internationalized data and localization capabilities of the tested object, including multi-language display, various input/output habits, time formats, and regional features, such as currency, time, and culture taboos. |
| Compatibility | <ul><li>Tests backward compatibility of an application with its own data, the forward and backward compatibility with the system, and the compatibility with different user data, such as audio file content of the player and smart SMS messages.</li><li>Tests system backward compatibility with its own data and the compatibility of common applications in the ecosystem.</li><li>Tests software compatibility with related hardware.</li></ul> |
| User | Tests user experience of the object in real user scenarios. All conclusions and comments should come from the users, which are all subjective evaluation in this case. |
| Standard | Tests the compliance with industry and company-specific standards, protocols, and specifications. The standards here do not include any security standards that should be classified into the security test. |
| Safety | Tests the safety property of the tested object to avoid possible hazards to personal safety, health, and the object itself. |
| Resilience | Tests the resilience property of the tested object to ensure that it can withstand and maintain the defined running status (including downgrading) when being attacked, and recover from and adapt defense to the attacks to approach mission assurance. |
## Test Case Development Guidelines
...
...
@@ -202,38 +86,11 @@ The test framework and programming language vary with the system type.
**Table 4** Test frameworks and test case languages for different systems
<tdclass="cellrowborder"valign="top"width="33.33333333333333%"headers="mcps1.2.4.1.2 "><pid="p10419443171416"><aname="p10419443171416"></a><aname="p10419443171416"></a>HJSUnit and HCPPTest</p>
</td>
<tdclass="cellrowborder"valign="top"width="33.33333333333333%"headers="mcps1.2.4.1.3 "><pid="p9419143181414"><aname="p9419143181414"></a><aname="p9419143181414"></a>JavaScript and C++</p>
</td>
</tr>
</tbody>
</table>
| System | Test Framework | Language |
| ----- | ----------- | ------- |
| Mini | HCTest | C |
| Small | HCPPTest | C++ |
| Standard | HJSUnit and HCPPTest | JavaScript and C++ |
### Developing Test Cases in C (for the Mini System\)
...
...
@@ -500,67 +357,16 @@ The HJSUnit framework is used to support automated test of OpenHarmony apps that
The test cases are developed with the JavaScript language and must meet the programming specifications of the language.
<tdclass="cellrowborder"valign="top"width="68.88688868886888%"headers="mcps1.2.4.1.2 "><pid="p198111352526"><aname="p198111352526"></a><aname="p198111352526"></a>Presets a test-suite-level action executed only once before all test cases are executed. You can pass the action function as the only parameter.</p>
<tdclass="cellrowborder"valign="top"width="68.88688868886888%"headers="mcps1.2.4.1.2 "><pid="p39811935115217"><aname="p39811935115217"></a><aname="p39811935115217"></a>Presets a test-suite-level clear action executed only once after all test cases are executed. You can pass the clear function as the only parameter.</p>
<tdclass="cellrowborder"valign="top"width="68.88688868886888%"headers="mcps1.2.4.1.2 "><pid="p149811335175215"><aname="p149811335175215"></a><aname="p149811335175215"></a>Presets a test-case-level action executed before each test case is executed. The number of execution times is the same as the number of test cases defined by <strongid="b32523248388"><aname="b32523248388"></a><aname="b32523248388"></a>it</strong>. You can pass the action function as the only parameter.</p>
<tdclass="cellrowborder"valign="top"width="68.88688868886888%"headers="mcps1.2.4.1.2 "><pid="p1398213575219"><aname="p1398213575219"></a><aname="p1398213575219"></a>Presets a test-case-level clear action executed after each test case is executed. The number of execution times is the same as the number of test cases defined by <strongid="b10590142313399"><aname="b10590142313399"></a><aname="b10590142313399"></a>it</strong>. You can pass the clear function as the only parameter.</p>
<tdclass="cellrowborder"valign="top"width="68.88688868886888%"headers="mcps1.2.4.1.2 "><pid="p5982123595215"><aname="p5982123595215"></a><aname="p5982123595215"></a>Defines a test suite. You can pass two parameters: test suite name and test suite function. The <strongid="b7320205019400"><aname="b7320205019400"></a><aname="b7320205019400"></a>describe</strong> statement supports nesting. You can use <strongid="b138214222410"><aname="b138214222410"></a><aname="b138214222410"></a>beforeall</strong>, <strongid="b18677102314115"><aname="b18677102314115"></a><aname="b18677102314115"></a>beforeEach</strong>, <strongid="b1353142514113"><aname="b1353142514113"></a><aname="b1353142514113"></a>afterEach</strong>, and <strongid="b131041629204111"><aname="b131041629204111"></a><aname="b131041629204111"></a>afterAll</strong> in each <strongid="b590433484116"><aname="b590433484116"></a><aname="b590433484116"></a>describe</strong> statement.</p>
<tdclass="cellrowborder"valign="top"width="68.88688868886888%"headers="mcps1.2.4.1.2 "><pid="p598211352522"><aname="p598211352522"></a><aname="p598211352522"></a>Defines a test case. You can pass three parameters: test case name, filter parameter, and test case function.</p>
<pid="p5205769588"><aname="p5205769588"></a><aname="p5205769588"></a>Usage of the filter parameter:</p>
<pid="p1545919528618"><aname="p1545919528618"></a><aname="p1545919528618"></a>The value of the filter parameter is a 32-bit integer. Setting different bits to <strongid="b045919521765"><aname="b045919521765"></a><aname="b045919521765"></a>1</strong> means different configurations:</p>
<aname="ul6932113319395"></a><aname="ul6932113319395"></a><ulid="ul6932113319395"><li>bit 0: whether the filter parameter takes effect. <strongid="b1193293318395"><aname="b1193293318395"></a><aname="b1193293318395"></a>1</strong> means that the test case is used for the function test and other settings of the parameter do not take effect.</li><li>Bits 0-10: test case categories</li><li>Bits 16-18: test case scales</li><li>Bits 24-28: test levels</li></ul>
<pid="p7965165151011"><aname="p7965165151011"></a><aname="p7965165151011"></a><strongid="b15148755145114"><aname="b15148755145114"></a><aname="b15148755145114"></a>Test case categories</strong>: Bits 0-10 indicate FUNCTION (function test), PERFORMANCE (performance test), POWER (power consumption test), RELIABILITY (reliability test), SECURITY (security compliance test), GLOBAL (integrity test), COMPATIBILITY (compatibility test), USER (user test), STANDARD (standard test), SAFETY (security feature test), and RESILIENCE (resilience test), respectively.</p>
<pid="p199651555102"><aname="p199651555102"></a><aname="p199651555102"></a><strongid="b135908568519"><aname="b135908568519"></a><aname="b135908568519"></a>Test case scales</strong>: Bits 16-18 indicate SMALL (small-scale test), MEDIUM (medium-scale test), and LARGE (large-scale test), respectively.</p>
| beforeAll | Presets a test-suite-level action executed only once before all test cases are executed. You can pass the action function as the only parameter. | No |
| afterAll | Presets a test-suite-level clear action executed only once after all test cases are executed. You can pass the clear function as the only parameter. | No |
| beforeEach | Presets a test-case-level action executed before each test case is executed. The number of execution times is the same as the number of test cases defined by it. You can pass the action function as the only parameter. | No |
| afterEach | Presets a test-case-level clear action executed after each test case is executed. The number of execution times is the same as the number of test cases defined by it. You can pass the clear function as the only parameter. | No |
| describe | Defines a test suite. You can pass two parameters: test suite name and test suite function. The describe statement supports nesting. You can use beforeall, beforeEach, afterEach, and afterAll in each describe statement. | Yes |
| it | Defines a test case. You can pass three parameters: test case name, filter parameter, and test case function. <br>**Usage of the filter parameter:**<br>The value of the filter parameter is a 32-bit integer. Setting different bits to 1 means different configurations: <br><ul><li>Bit 0: whether the filter parameter takes effect. 1 means that the test case is used for the function test and other settings of the parameter do not take effect.</li><li>Bits 0-10: test case categories</li><li>Bits 16-18: test case scales</li><li>Bits 24-28: test levels</li></ul>**Test case categories**: Bits 0-10 indicate FUNCTION (function test), PERFORMANCE (performance test), POWER (power consumption test), RELIABILITY (reliability test), SECURITY (security compliance test), GLOBAL (integrity test), COMPATIBILITY (compatibility test), USER (user test), STANDARD (standard test), SAFETY (security feature test), and RESILIENCE (resilience test), respectively. <br>**Test case scales**: Bits 16-18 indicate SMALL (small-scale test), MEDIUM (medium-scale test), and LARGE (large-scale test), respectively. <br>**Test levels**: Bits 24-28 indicate LEVEL0 (level-0 test), LEVEL1 (level-1 test), LEVEL2 (level-2 test), LEVEL3 (level-3 test), and LEVEL4 (level-4 test), respectively. | Yes |
Use the standard syntax of Jasmine to write test cases. The ES6 specification is supported.
...
...
@@ -688,5 +494,3 @@ Install Python 3.7 or a later version on a Windows environment and ensure that t
3. View the test report.
Go to **acts\\reports\\**, obtain the current execution record, and open **summary\_report.html** to view the test report.