MAVSDK icon indicating copy to clipboard operation
MAVSDK copied to clipboard

Add support for MAVLink communication faking/mocking

Open hamishwillee opened this issue 8 years ago • 3 comments

In order to allow sensible unit tests to be written.

hamishwillee avatar Nov 02 '17 22:11 hamishwillee

@hamishwillee @julianoes Can you please describe more about this task ?

shakthi-prashanth-m avatar Nov 04 '17 12:11 shakthi-prashanth-m

Unit tests are supposed to test just the functionality of a particular component. As each plugin is a MAVLink processor - sending and/or receiving MAVLink messages to unit test our code we would need to create some mock system that can sensibly act as a source/sink of MAVLink and respond to messages from our plugins as "required".

This would allow us to unit test our code in isolation from other plugins and with completely repeatable behaviour, on any platform.

For our integration tests we use SITL as a sync/source but that is no good for unit tests, because SITL requires all sort of setup, and does not respond repeatably on different systems, or even the same system on a different load.

I have no idea what "exactly" this would look like, but I'd start by considering the QGroundControl mocklink.

hamishwillee avatar Nov 05 '17 07:11 hamishwillee

Yes it could be something like a FakeConnection that whenever you send it a command it that is correct it would respond with ack. Additionally you could also check the failure cases such as timeouts, or responding with denied if a param doesn't make sense.

julianoes avatar Nov 06 '17 14:11 julianoes