Unit Testing: Test Adapter for Google Test goes in-box!

If you’re just getting started and want to learn more about C++ Unit Testing, check out our tutorial. 

Here on the Visual C++ team, we want to make your unit testing experience as enjoyable as possible. Microsoft’s native unit test framework has shipped with Visual Studio for a while, but we know C++ developers may wish to use other popular testing frameworks. To give you more flexibility, we offered two VS extensions in the VS Marketplace which enabled Visual Studio’s testing tools to work with Google Test and Boost.Test unit tests (Test Adapter for Google Test, Test Adapter for Boost.Test).

We are excited to announce that we have streamlined this process even further. In addition to Native Test, Visual Studio now ships with Google Test support. This means you can author, discover, and run all of your Google Test unit tests using Visual Studio’s testing tools right out of the box. New installations of Visual Studio 2017 version 15.5 will already have the “Test Adapter for Google Test” checkbox marked and installed by default.

If you’re upgrading from an existing Visual Studio installation, or you unchecked the box during initial installation, no worries! Open “Visual Studio Installer”, click “Modify” on your Visual Studio 15.5 instance, and check the “Test Adapter for Google Test” checkbox under “Desktop development with C++” (shown below).

Note: If you previously installed our “Test Adapter for Google Test” extension from the VS Marketplace, you should uninstall it to avoid conflicts.

Now comes the magic. Build your Google Test project, and Visual Studio will automatically detect your unit tests and populate the Test Explorer Window. Don’t see the Test Explorer Window? Add it by going to Test > Windows > Test Explorer. For more details on using Google Test and Boost.Test in Visual Studio, check out our previous blog post.

 Glorious! 

What’s next? 

We are working to add Boost.Test in-box. In the meantime, feel free to keep using the Test Adapter for Boost.Test extension. 

Talk to us

We are always working to give you the best development experiences possible. Let us know what you would like to see next. If you come across any issues, please file them on the Test Adapter for Google Test GitHub. Because of your previous feedback, we improved our Google Test project template in the New Project wizard by adding support for all Windows SDKs. 

Cheers, 

-Nick