Unit Test Without Hardware (MSBuild)

Sysprogs forums Forums VisualGDB Unit Test Without Hardware (MSBuild)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #32610
    Seidleroni
    Participant

    I’ve been using VisualGDB for a handful of years now and mostly really like it. Is there a way to run unit tests against my embedded project (STM32) without having the unit tests run on the actual hardware? My solution uses MSBuild and not CMake.

    #32615
    support
    Keymaster

    Hi,

    The only fully tested & supported way to do this would be to use the Embedded CMake project subsystem (see this tutorial). You might be able to get it working with MSBuild as shown below:

    1. Follow the CMake tutorial to get a reference test project that builds and runs without hardware.
    2. Create a regular Win32 MSBuild executable. Manually add the unit test framework to it via VisualGDB Project Properties. Adjust the project until it builds and runs as well, using #1 for reference.
    3. Follow the MSBuild Platform tutorial to merge the settings from #2 into your main project. For MSBuild projects, VisualGDB only cares about the currently selected platform/configuration, so if you manually copy all settings (including the references to .vgdbsettings files) between projects, it will copy the related behavior regardless of what is defined in other configurations/platforms.

    That said, this setup was never tested, and may trigger weird bugs. Proceed at your own risk only if you are comfortable patching MSBuild files and troubleshooting possible errors caused by it.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.