none
Unit test code coverage tool for UWP Application RRS feed

  • Question

  • Currently we are using Visual Studio Enterprise 2015 to build an UWP application for Windows 10 Mobile.

    MSTest is used for unit testing.

    We are looking for unit test code coverage tool for UWP Application.

    Please let me know unit test code coverage tool for UWP which gives us total executed lines of code after unit test execution

    • Moved by Barry Wang Wednesday, March 8, 2017 2:02 AM Unit Test related
    Tuesday, March 7, 2017 2:27 PM

All replies

  • Hello KoustubhS,

    I've moved your case to Unit Testing forum since it is more related to this forum.

    Best regards,

    Barry


    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, March 8, 2017 2:04 AM
  • Hi KoustubhS,

    Unfortunately, Code coverage is still not supported for UWP unit tests in Visual Studio.

    You may refer to same case here:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/ff866c7b-f560-4e04-ab2e-597cd5c52cf7/how-to-check-code-coverage-for-universal-windows-packageuwp-apps?forum=vsunittest

    Two workarounds for you to try, though they are a bit complex:

    A tool called OpenCover, and with ReportGenerator, can give you code coverage reports.

    You could refer to this Blog to get more specific info.

    Another method is to combine three projects to get the code coverage of UWP unit test, this blog demonstrates the solution.

    I hope my reply could be helpful to you.

    Best regards,

    Fletch


    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.

    • Proposed as answer by Fletch Zhou Monday, March 13, 2017 1:29 PM
    Thursday, March 9, 2017 2:35 AM
  •  We tried to calculate code coverage for sample UWP app using OpenCover and ReportGenerator tools, but these tools are not able to calculate Code coverage for UWP app.

    Its execution says 0% Line Coverage for UWP app.

    <v:shapetype coordsize="21600,21600" filled="f" id="_x0000_t75" o:preferrelative="t" o:spt="75" path="m@4@5l@4@11@9@11@9@5xe" stroked="f">Console output for UWP app batch file run for coverage calculation says no tests to execute for UWP app.</v:shapetype>

    These tools (OpenCover and ReportGenerator) works well in case of non UWP app ( we have tried with Web application and Console application).

    Also, for console application we tried with unit tests in separate project ( with output type .dll ) and unit tests within console app project ( with output.exe) just to match same output type as  UWP app (.exe),but it worked for
    console application with both output types but not for UWP app

    Thursday, April 13, 2017 3:05 PM