Coverage Report Using Visual Studio 2013 Professional for Native C ++

Using the C ++ unit testing platform using Visual Studio 2013 Professional, you can write unit tests and run them from the IDE, but to create coverage reports, you probably need to have a Premium or Ultimate version of Visual Studio.

Is it possible to get code coverage reports using a Professional publication, preferably without installing any third-party tools? If not, what alternatives exist for people who don’t use the more expensive IDE editions?

Note that you can generate coverage data using the command line tools, but I cannot find a way to look at the results. For reference, here are the steps for generating coverage statistics on the command line:

  • Create code for testing with /PROFILE linker switch
  • Run vsinstr /coverage <binaryName> to process the code; make sure you are on the command line VS 2013
  • Run start vsperfmon -coverage -output:results to start the profiler
  • Run device tests
  • Stop the profiler by running vsperfcmd -shutdown

The above file will give you the results file. without being able to view it without Premium or Ultimate releases, as far as I know.

+5
source share
3 answers

With VS2013 Professional, you are out of luck if you want to do this without third-party tools Requirements: Visual Studio Ultimate, Visual Studio Premium ( http://msdn.microsoft.com/en-us/library/dd537628.aspx ). As far as I understand, you have already managed to create a * .coverage file, and you have problems opening it. Visual Coverage ( https://github.com/jsargiot/visual-coverage ) tool can help you with this, it is very simple to use, and it is open source. If you want to find more alternatives, see Another SO thread: Viewing code coverage results outside of Visual Studio . The tools are for C # files to cover, but from what I understand there should be no difference.

+7
source

If you are ready to use third-party libraries, you can use OpenCPPCoverage . It works for me as a command line application. But I could not run it as a visual studio plugin in Professional Visual Studio 2013.

+3
source

One possible way to get coverage data is to run toolkit tools in your Unit Test program. The toolkit tool will tell you how much was covered at run time, and you can easily relate this data to how many points your block test gives you. I did this with the Xcode project and OpenPAT , but you can do the same with any Visual Studio toolkit.

+1
source

Source: https://habr.com/ru/post/1204551/


All Articles