MAVSDK Integration Testing

PX4 can be tested end to end to using integration tests based on MAVSDKarrow-up-right.

The tests are primarily developed against SITL and run in continuous integration (CI). In future we plan to generalise them for any platform/hardware.

The instructions below explain how to setup and run the tests locally.

Prerequisites

Setup Developer Environment

If you haven't done so already:

  • Install the development toolchain for Linux or macOS (Windows not supported). Gazebo Classic is required, and should be installed by default.

  • Get the PX4 source code:

    git clone https://github.com/PX4/PX4-Autopilot.git --recursive
    cd PX4-Autopilot

Build PX4 for Testing

To build PX4 source code for simulator testing, use:

DONT_RUN=1 make px4_sitl gazebo-classic mavsdk_tests

Install the MAVSDK C++ Library

The tests need the MAVSDK C++ library installed system-wide (e.g. in /usr/lib or /usr/local/lib).

Install either from binaries or source:

Run All PX4 Tests

To run all SITL tests as defined in sitl.jsonarrow-up-right, do:

This will list all of the tests and then run them sequentially.

To see all possible command line arguments use the -h argument:

Run a Single Test

Run a single test by specifying the model and test case as command line options. For example, to test flying a tailsitter in a mission you might run:

The easiest way to find out the current set of models and their associated test cases is to run all PX4 tests as shown above (note, you can then cancel the build if you wish to test just one).

At time of writing the list generated by running all tests is:

Notes on implementation

Terms used:

Last updated