| name | ohos-test-graphics3d-static-api-unit-test |
| display_name | Graphics 3D API Unit Test Generator |
| scope | domain |
| stage | testing |
| domain | graphics3d |
| capability | static-api-unit-test |
| version | 0.1.0 |
| status | trial |
| description | Use when generating unit tests for ETS/ArkTS static API classes in OpenHarmony graphic_3d module, when adding new test cases for MaterialETS, CameraETS, SceneETS or similar wrapper classes, or when setting up test environment for GTest-based ETS unit tests |
Graphics 3D API Unit Test Generator
Overview
Guide for generating ETS/ArkTS static API unit tests based on OpenHarmony GTest framework. Provides test generation workflow, naming conventions, and core patterns.
When to Use
- Adding unit tests for new ETS wrapper classes (e.g.,
CameraETS, MaterialETS)
- Extending existing test cases with new test scenarios
- Setting up new test modules or test environment
Do NOT use when:
- Testing Lume engine core layer (use other test frameworks)
- Writing integration tests or performance tests (require different fixtures)
Quick Reference
Naming Conventions
| Element | Convention | Example |
|---|
| Test class name | <Module>ETSUnitTest | MaterialETSUnitTest |
| Test case name | <Class>_<Method>_<Number> | MaterialETS_Create_001 |
| Test file name | <module>_ets_unit_test.cpp | material_ets_unit_test.cpp |
Test Macros
| Macro | Purpose |
|---|
HWTEST_F | Fixed test fixture (required for all ETS unit tests) |
Test Levels: Use appropriate TestSize.Level0-Level4 based on test complexity.
Selection Rule
- Default:
TestSize.Level1 for most API method tests
- Adjust: Use higher levels for complex scenarios (error handling, performance)
See UNITTEST_GUIDE.md "Test Case Macros" section for complete Level0-Level4 definitions.
Required Comment Template
Core Pattern: AAA Testing
Use Arrange-Act-Assert pattern:
(MaterialETSUnitTest, MaterialETS_Create_001, TestSize.Level1)
{
material = std::<MaterialETS>();
(material->());
}