C++ Unit Testing Updates: Announcing Boost.Test Adapter and Improved Google Test Support
Back in May, the C++ team announced the Test Adapter for Google Test – a Visual Studio extension that allows you to run and manage your Google Test-based unit tests directly in Visual Studio. You can do this using the Test Explorer window, and, if you’re a Visual Studio Enterprise user, you can run a code coverage analysis to check for code that isn’t being tested. Since that time, our team has been working on improving our unit testing support even further.
If you’re new to C++ unit testing with Visual Studio, you may want to check out the blog post, C++ Unit Testing in Visual Studio, for an overview. The testing tools described there are also applicable to these latest unit testing updates.
Today, we have several updates to share:
- We are extending our support to Boost.Test, with the new Test Adapter for Boost.Test extension for Visual Studio 2017.
- In addition, the Test Adapter for Google Test has been updated to version 0.10.1, which fixes a number of outstanding bugs. We now also provide NuGet packages on nuget.org of the Google Test framework:
- We have published the code for both test adapters on GitHub under an open source license, so you can feel free to check them out for yourself and make your own modifications as needed. If you have a different test framework that you want to use with Visual Studio, we hope these projects serve as an inspiration for future test adapters.
The Test Adapter for Boost.Test (Preview)
The Test Adapter for Boost.Test is a fork of the existing Boost Unit Test Adapter (GitHub URL) by Gunter Wirth’s team from ETAS GmbH. The updated extension includes a number of bug fixes that enable support for Visual Studio 2017. In addition, the Test Adapter for Boost.Test adds support for Boost version 1.64 (along with maintaining support for versions 1.60 – 1.63). For more details on Boost.Test, check out the official documentation.
This extension is currently in preview, so there are still a few outstanding issues to address. We appreciate all feedback on the release. If you run into any problems with the extension, please file a bug on Developer Community. For convenience, we compiled a list of known issues below. These issues should be addressed in future updates to the extension.
Download the Test Adapter for Boost.Test (Preview)
You can download the new adapter from the Visual Studio Marketplace.
Test Adapter for Google Test Update v0.10.1
The C++ team has also been working with Christian Soltenborn and Jonas Gefele, the authors of the original Google Test Adapter that the Microsoft fork is based on, to improve the story for Google Test support. The Test Adapter for Google Test merges in changes for versions 0.10.0 and 0.10.1 of the original adapter. Full release notes can be found on GitHub. In addition, runtime for test discovery was substantially improved.
- Google Test built as LIB, dynamic runtime (recommended if you’re not sure which to pick)
- Google Test built as DLL, dynamic runtime
- Google Test build as LIB, static runtime
Test Adapters On GitHub
We aim to be transparent with our work on these test adapters and maintain the spirit of the original projects by keeping them open source. In addition, this gives you the chance to contribute changes and help improve these adapters going forward, or even get inspired to write your own adapters for other test frameworks. The Visual Studio Test Platform is extensible, so it is certainly possible to enable the testing tools in the product to work with a wide variety of frameworks.
Check out these projects on GitHub via the links below:
Call To Action
We received a lot of feedback over the years on the C++ unit testing experience, and we want to make sure we get it right. Please feel free to leave us feedback on the adapters on their respective GitHub issue trackers or on Developer Community. Since these projects are also open sourced, you can feel free to submit your own pull requests as well.
If you haven’t tried out the new unit testing tools, try out the Test Adapter for Google Test (and check out the blog post: Unit Testing and the Future: Announcing the Test Adapter for Google Test), or try out the Test Adapter for Boost.Test today!