4
다음 C++ 코드가 있습니다.명령 줄에서 MS 코드 적용 도구를 사용하는 방법?
#include <iostream>
using namespace std;
int testfunction(int input)
{
if (input > 0) {
return 1;
}
else {
return 0;
}
}
int main()
{
testfunction(-1);
testfunction(1);
}
나는 악기 실행을, 그 다음 실행
cl /Zi hello.cpp -link /Profile
를 얻기 위해 컴파일하고 .coverage 바이너리를 생성합니다.
vsinstr -coverage hello.exe
start vsperfmon -coverage -output:mytestrun.coverage
vsperfcmd -shutdown
VS2010에서 커버리지 파일을 열면 그 결과에는 아무 것도 없습니다.
무엇이 잘못 될 수 있는가? this post의 안내를 따랐습니다. 3 단계를 실행하면
> vsinstr /coverage hello.exe
> start vsperfmon /coverage /output:mytestrun.coverage
> hello.exe
> vsperfcmd /shutdown
, 당신은 몇 가지를 볼 수 : 모니터가 시작된 후
잼. 왜 MS는 이것을 쉽게 문서화 할 수 없었는가? https://msdn.microsoft.com/en-us/library/dd299398(v=vs.90).aspx – granadaCoder
향후 독자를 위해 ........ 여기에 여러 개의 .coverage 파일을 만드는 대체 솔루션이 있습니다. http://stackoverflow.com/questions/415562/mstest-code-coverage/37005493#37005493 – granadaCoder