SDK Host Unit Testing
This guide describes the reusable host-side unit test harness for SDK code and app example libraries.
Layout
SDK/Tests/Host/
├── CMakeLists.txt
├── cmake/
│ └── FetchGoogleTest.cmake
├── support/
│ ├── KernelTestDoubles.hpp
│ └── KernelTestDoubles.cpp
└── apps/
└── Running/
├── Settings_test.cpp
└── SettingsSerializer_test.cpp
cmake/: third-party bootstrap (GoogleTest).support/: reusable fakes and fixtures (kernel facade dependencies, in-memory filesystem).apps/<AppName>/: app-specific test cases.
Build and Run
From SDK root:
cmake -S Tests/Host -B build-host -DCMAKE_BUILD_TYPE=Debug
cmake --build build-host
ctest --test-dir build-host --output-on-failure
On Windows multi-config generators:
ctest --test-dir build-host -C Debug --output-on-failure
Expected: una-sdk-host-tests passes.
Add Tests For Another App
Create a folder under
Tests/Host/apps/<YourApp>/.Add one or more
*_test.cppfiles.Add test files and required app sources to
Tests/Host/CMakeLists.txtexecutable source list.Reuse support doubles from
support/KernelTestDoubles.*when the code requiresSDK::Kernelor filesystem interactions.
Serializer/Settings Test Pattern
Use SDK::TestSupport::KernelFixture:
fixture.kernelprovides a readySDK::Kernelwith stubbed dependencies.fixture.fileSystem.seedFile(path, json)seeds in-memory input files.Instantiate serializer with
SettingsSerializer(fixture.kernel, "settings.json").Verify load/save behavior without device firmware or simulator runtime.
Troubleshooting
If
core_json.his missing, confirm include path:SDK/ThirdParty/coreJSON/source/include.If linker errors mention logger symbols, ensure
SDK/Libs/Source/UnaLogger/Logger.cppis linked.If app headers are not found, add app lib header paths to
target_include_directories(...)for the test target.