VSTS Tip: C++ and Team System

From an internal email thread that looked interesting today:

Q: What type of support does Team System provide for C++ in terms of Unit testing, Code coverage, Static Analysis, and Code Profiling?

A: Here's a quick table, then some more detailed followup:


Native C/C++ C++/CLI
Unit Testing Yes [1] Yes [1]
Code Coverage Yes Yes
Static Analysis Yes [2] Yes
Code Profiling Yes [3] Yes

1 - Dominic responds: "Unit Testing is supported for C++ -- both Native and C++/CLI. However, the native experience is somewhat painful. We support:  Code gen from /clr:safe to C++/C#/VB (and visa versa), P/Invoke from managed to native, COM (though com interop), and also from a /CLR C++ project. 

For purely native C++ Code Under Test, you can take /clr:safe from the C++ Test Project (for it to be /CLR), and make sure that you have your manged test class. You can then either DllImport etc as you would for any normal C++ project.  You can also test the actual library its self by linking statically to the Native C++  (you will need to make sure your C++ proj outputs as a static lib).  Native C++ testing is somewhat painful. It can cover some needs, but not all."

2 - In fact, native C++ static analysis is more even advanced than .NET but is not extensible (yet).

3 - Profiling has level of detail as .NET, including mixed-mode.  Obviously, it won't collect .NET memory allocation and object lifetime information in the native C/C++ case.

Comments (0)

Skip to main content