Announcing CodeLens for C++ Unit Testing

Nick Uhlenhuth

If you are just getting started with unit testing in C++, visit our testing startup guide.

C++ developers in Visual Studio can now get their first taste of CodeLens! Specifically, Visual Studio 2017 15.7 Preview 3 Professional and Enterprise editions offer CodeLens for Unit Testing.

There are a few ways to initialize CodeLens:

  • Edit and Build your test project/solution
  • Rebuild your project/solution
  • Run test(s) from the Test Explorer Window

After performing any of the above actions, CodeLens will appear above each of your unit tests. CodeLens allows you to Run, Debug, and view the Test Status of your unit tests directly in the source file. The test status indicators are the same as the ones in the Test Explorer (Warning , Success , Failure ).

To update the test status, you can Run the test directly from CodeLens above the desired test method.

If your test fails, you can easily view the failure message and Debug straight from CodeLens.

Give us Feedback

As always, let us know if you run into any issues by reporting them via Help > Send Feedback > Report A Problem from inside the Visual Studio IDE. Additionally, you can view active issues, add comments, and upvote items on  Developer Community . You can also catch me on Twitter @nickuhlenhuth.

Happy unit testing!


Posted in C++


Discussion is closed.

Feedback usabilla icon