Skip to content

Recommended approach for unit testing Holoscan C++ operators? #52

Description

@DanaKimball-Voyager

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions