4

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

The majority of code coverage tools I have considered using so far all operate by being the entry point to your software; typically you pass a command line argument or executable path to the code coverage tool and it runs your program, gathering code coverage data while it is running.

Unfortunately, I am in a situation where my testing solution starts and stops my program for each test. This means that traditional code coverage isn't going to work.

Is there a way to passively monitor an executable and related DLLs for code coverage while it is being run by other processes?

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

Mystagogue
  • 343
  • 1
  • 3
  • 8

1 Answers1

1

You can use vsperfcmd and vsinstr.

You use vsinstr to instrument the binaries and then start and stop the vsperfcmd to indicate the start and stop of your 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

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

John Koerner
  • 37,428
  • 8
  • 84
  • 134
  • I'd looked at these before. I wasn't quite sure if they worked the way I thought they did. I'll do some testing with these. – Mystagogue Jul 17 '17 at 21:17
  • Actually, this doesn't look like it's going to work. Using vsinstr on the program prevents the program from running. I guess it's a signing issue. – Mystagogue Jul 18 '17 at 21:15
  • Try this if you are signing the assemblies: https://stackoverflow.com/questions/2711484/how-can-i-profile-signed-assemblies-with-vs-2010-or-vs-2013 – John Koerner Jul 18 '17 at 21:16