SITL test setup/teardown

Hi,

I’m want to write a SITL unit test (according to this doc), with several test cases (by test case, i mean a single function called with ‘ut_run_test’) to test a single custom module, so that each test case has a ‘fresh’ state, and test cases might last for a few seconds (because the module timing).

It seems that (correct me if i’m wrong) with each test case, the ‘state’ of the module persists. That is, there is no setup/teardown, and the uOrb queues stay the same (messages from a previous test case remain in the next one).

  1. Is there a way to clear the uORB queues before a test begins?
  2. Is using SITL the wrong choice for this? Should I use GTest instead?
    Or should I just send the right uORB messages to reset the module internally between each test case?
    (I chose SITL because of the fact that the test might last a few seconds, although I don’t need other modules in this test).

Thanks. And I apologize if this isn’t the right category, wasn’t sure which one to pick.
Eliran