locked
Reporting on unit test execution and coverage RRS feed

  • Question

  • Hello,

    I'm setting up a build on VS TFS* where I run unit tests after compilation. For this I use a Visual Studio Test task, where I checked the "code coverage enabled" option. After unit test execution is over I get a link to check the report on the results and they do not include test coverage.

    How do I check everything is ready for coverage to be computed?

    How do I compute coverage in my local VS (professional)?

    Thanks,

    iapazmino

    Microsoft Visual Studio Team Foundation Server Version 16.131.28226.3

    Tuesday, February 12, 2019 4:47 PM

Answers

  • Hi friend,

    Sorry for the delay.

    I've checked the codecoverage.exe folder, in VS2017 enterprise the tool locates in "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Dynamic Code Coverage Tools" folder. But for my VS2017 community, the "Dynamic Code Coverage Tools" folder doesn't exist.

    I have no professional edition in my side. But i'm afraid that has similar situation with my community edition. That's a limitation of product, and so far we have no valid ways to figure it out.

    You can take a look at this similar issue.

    Sorry for this inconvenience. Do hope you can understand.

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 15, 2019 8:22 AM

All replies

  • Hi friend,

    Welcome to MSDN forum.

    According to this document, the code coverage result is not included in test result report. Instead, it’s located in Build artifacts published milestone in the timeline view.

    We can find them depending on what way we collect coverage, and as you use visual studio test Task, you can download the .coverage file and open it with VS IDE to see code coverage results.

    >> How do I check everything is ready for coverage to be computed?

    Make sure we meet demands of Visual Studio test task. And check the "code coverage enabled" option.

    >> How do I compute coverage in my local VS (professional)?

    In vs IDE, Go Test=>Windows=>Test Explorer, and right-click the tests we need to run, and choose “Analyze Code Coverage for Selected Tests”. Then the code coverage results will show at the bottom of window.

    Hope all above can help solve your issue. And if it works or not, please share update here. We are looking forward to your reply😀.

    Have a nice day!

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 13, 2019 3:33 AM
  • Hi, thanks for your answer.

    I can't find the "build timeline view" the document mentions should be the place where coverage report is. Under "build and release" in my tfs all I have is a list of builds and dates they were run. Also, the build summary shows the following message under the coverage section

    No build code coverage data available.

    Anyway, going through the test log found the following message:

    Data collector 'Code Coverage' message: Cannot find CodeCoverage.exe..

    I've made a search and apparently this is due to the Visual Studio version running in the agent not being Enterprise Edition, as mentioned in this post[1], and it's consistent with the documentation for using code coverage[2].

    Is there any workaround for this?

    [1] https://developercommunity.visualstudio.com/content/problem/205336/data-collector-code-coverage-message-cannot-find-c.html

    [2] https://docs.microsoft.com/en-us/visualstudio/test/using-code-coverage-to-determine-how-much-code-is-being-tested?view=vs-2017#requirements 

    Wednesday, February 13, 2019 4:48 PM
  • Hi friend,

    Sorry for the delay.

    I've checked the codecoverage.exe folder, in VS2017 enterprise the tool locates in "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Dynamic Code Coverage Tools" folder. But for my VS2017 community, the "Dynamic Code Coverage Tools" folder doesn't exist.

    I have no professional edition in my side. But i'm afraid that has similar situation with my community edition. That's a limitation of product, and so far we have no valid ways to figure it out.

    You can take a look at this similar issue.

    Sorry for this inconvenience. Do hope you can understand.

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 15, 2019 8:22 AM
  • Thanks Lance.
    Monday, February 18, 2019 7:47 PM