Is it possible to collect code coverage data if the code coverage tool is not an entry point?

I am trying to collect code coverage information from my test bed.

Most of the code coverage tools I've reviewed so far have all worked as an entry point to your software; usually you pass a command line argument or an executable path to a code coverage tool, and it launches your program, collecting code coverage data at runtime.

Unfortunately, I am in a situation where my test solution starts and stops my program for each test. This means that traditional code coverage will not work.

Is there a way to passively control executable and related DLLs to cover code while it is being executed by other processes?

Please note that I am not asking for specific software recommendations. I just want to know if the type of coverage coverage of the code that I need is possible, and if so, what it is called, so I can do further research myself.

+4
source share
1 answer

You can use vsperfcmd and vsinstr .

You use vsinstrto write binary files, and then start and stop vsperfcmdto indicate the beginning and end of the coverage period.

So you can do:

vsinstr -coverage $(pathToDLL1)
vsinstr -coverage $(pathToDLL2)
vsinstr -coverage $(pathToDLL3)
vsperfcmd -start:coverage -output:SomePath\ManualCoverage.coverage
// DO YOUR TESTING HERE
vsperfcmd -shutdown

In VS 2015, you can look C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools\x64for both binaries.

+1
source

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


All Articles