Can we get native C++ code coverage in VS2012 or VS2010 without MSTest?

后端 未结 2 863
日久生厌
日久生厌 2021-01-31 05:46

We would like to measure code coverage for our own automated regression test system run over a fairly large native app. This is a sophisticated, scripted test system using the i

2条回答
  •  醉酒成梦
    2021-01-31 06:18

    I realize this is an old post, but I believe the answer still is relevant.

    With all the things that I used to have at my disposal in C#, I didn't really like what I saw when I moved to Visual C++. Also, like you the MSTests only partially worked for me; I'm used to have my own test applications as well.

    Basically what I wanted was the following:

    • Run MS tests or an EXE file
    • Get code coverage right in Visual Studio.

    After doing some research, I noticed that VS Enterprise supports this feature today with test adapters.

    If you're not on VSE, I noticed there are some other tools, each providing users with an independent UI. Personally I don't like that; I want my coverage right in Visual Studio, preferably in Visual Studio Community edition.

    So I decided to build this addin myself and - while it's not as sophisticated as VSE - it does the trick for me.

    • I wrote a VSIX code coverage tool on https://github.com/atlaste/CPPCoverage . Basically it manages the highlighting in Visual Studio, generates a clickable report, and integrates in solution explorer.
    • For the coverage measurements themselves, I used to use https://opencppcoverage.codeplex.com/ . Basically that allows you to perform code coverage tests on any debuggable (native) executable. Nowadays, I'm using my own code coverage measuring tools (which are open sourced above as well).

提交回复
热议问题