Unittest support for imported projects

Sysprogs forums Forums VisualGDB Unittest support for imported projects

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35616
    Fabian
    Participant

    Hi,

    we’re using VisualGDB for imported projects using the “Import a CMake project with Advanced CMake Project Subsystem” method.

    Is it in principle possible to use the Test Explorer to detect GoogleTest unittests using this method?

    If yes, how would we achieve this? We’re currently not using the find_bsp/ find_test_framework functions.

     

    Thanks and Regards

    #35618
    support
    Keymaster

    Hi,

    Sure, you can do that. In principle, you would need to have 3 things:

    1. The project should reference the unit test framework via VisualGDB Project Properties -> Unit Tests. Even if you don’t end up using the actual framework, simply having it referenced there will make VisualGDB look for tests in the project.
    2. The binary produced by the project should actually contain the test symbols usually produced by GoogleTest. You can search for TestDiscoverersĀ  in %LOCALAPPDATA%\VisualGDB\TestFrameworks\com.sysprogs.unittest.googletest\TestFramework.xml to get a basic idea of what VisualGDB is looking for.
    3. The project’s main() function should actually pass control to the unit test framework, and the framework should contain our patches for selecting the tests via debugger, and for reporting test results via semihosting.

    The easiest way to do it without using find_bsp/find_test_framework is to create a simple test project using the wizard, see what exact files (with what parameters) are included in it, and then reconstruct it in your own project.

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