How to use MS code coverage tool in command line?

前端 未结 1 1894
面向向阳花
面向向阳花 2020-12-06 07:14

I have the following C++ code.

#include 
using namespace std;

int testfunction(int input)
{
    if (input > 0) {
        return 1;
    }
         


        
相关标签:
1条回答
  • 2020-12-06 08:14

    You need to run your program after the monitor starts:

    1. > vsinstr /coverage hello.exe
    2. > start vsperfmon /coverage /output:mytestrun.coverage
    3. > hello.exe
    4. > vsperfcmd /shutdown

    When you run step 3, you should see some notification in vsperfmon.exe that hello.exe has started.

    If you plan on doing multiple test runs, you only need to run steps 2-4. In other words, you only need to instrument your binary (step 1) once after it's built.

    0 讨论(0)
提交回复
热议问题