Please describe your question
Is there a recommended approach for unit testing Holoscan operators? I've implemented a C++ operator specific to my project and I've been writing unit tests so that our CI can validate it. From what I can tell, there's not a straightforward way to instantiate a Holoscan operator and pass it specific input outside of standing up a pipeline.
What I ended up doing was based loosely on how the segmentation post-processor test works (https://github.com/nvidia-holoscan/holoscan-sdk/blob/main/tests/operators/segmentation_postprocessor/test_postprocessor.cpp). I split the operator into two classes, an implementation class and a Holoscan wrapper class. The implementation class doesn't use or reference any part of the Holoscan SDK, but it performs all the actual computations and tracks state, and it's what actually gets unit tested. The wrapper class inherits from the Holoscan operator class and serves as the interface between the implementation and the Holoscan pipeline. The wrapper is not included in any of the unit tests.
Is this more or less how unit testing is expected to be implemented, or is there a preferred approach that you'd recommend?
Holoscan SDK version
latest
Please describe your question
Is there a recommended approach for unit testing Holoscan operators? I've implemented a C++ operator specific to my project and I've been writing unit tests so that our CI can validate it. From what I can tell, there's not a straightforward way to instantiate a Holoscan operator and pass it specific input outside of standing up a pipeline.
What I ended up doing was based loosely on how the segmentation post-processor test works (https://github.com/nvidia-holoscan/holoscan-sdk/blob/main/tests/operators/segmentation_postprocessor/test_postprocessor.cpp). I split the operator into two classes, an implementation class and a Holoscan wrapper class. The implementation class doesn't use or reference any part of the Holoscan SDK, but it performs all the actual computations and tracks state, and it's what actually gets unit tested. The wrapper class inherits from the Holoscan operator class and serves as the interface between the implementation and the Holoscan pipeline. The wrapper is not included in any of the unit tests.
Is this more or less how unit testing is expected to be implemented, or is there a preferred approach that you'd recommend?
Holoscan SDK version
latest