CMake Support in Visual Studio – Test Explorer Integration, CMake 3.10
We are excited to announce new CMake features in Visual Studio 2017 version 15.6 Preview 2. In the latest preview, we have improved CTest’s integration with the IDE, including rich support for the Google and Boost unit testing frameworks.
If you are new to CMake in Visual Studio, check out how to get started.
CTest in the Test Explorer with Google Test and Boost.Test Support
One of the more frequent pieces of feedback we have received since adding basic support for CTest has been Test Explorer integration. I am excited to announce that CTest is fully integrated into the IDE in the latest Visual Studio preview:
Normally, each individual CTest in your CMake project will have an entry in the Test Explorer. If you take a close look at the screenshot above, however, you may notice that tests are broken out even further. If your project leverages the Google Test or Boost.Test frameworks in conjunction with CTest, individual tests will be listed in the Test Explorer.
Rich support for Google Test and Boost.Test requires the corresponding test adapters to be installed. The Google and Boost Test Adapters are now included by Visual Studio and will be installed by default with the C++ workload. However, you may need to install them manually if you are upgrading an existing installation of Visual Studio. For more information, check out how to install the Test Adapters for Google Test and Boost.Test. Test Explorer integration for CTest is still available without these adapters but it is limited in granularity to individual CTests.
All of Visual Studio’s testing features now work with CTest. In addition to viewing and running CTests from the Test Explorer, you can debug them and calculate their code coverage. If you use the Google Test or Boost.Test unit testing frameworks, you will also get detailed information about failed tests including stack traces:
If your tests seem to be missing from the Test Explorer, make sure you have built the targets that contain them. Your tests should be automatically detected once the build is complete.
CMake Tools Upgraded to 3.10
In our effort to make sure you have access to the latest features of CMake, we have upgraded the version of CMake that ships with Visual Studio from 3.9 to 3.10. You can find the full lists of enhancements in the CMake 3.10 release notes.
Send Us Feedback
Your feedback is a critical part of ensuring that we can deliver the best CMake experience. We would love to know how Visual Studio 2017 Preview is working for you. If you have any feedback specific to CMake Tools, please reach out to firstname.lastname@example.org. For general issues please Report a Problem.