none
Getting code coverage from functional tests targeting deployed .net core 2.2 web api RRS feed

  • Question

  • As a part of my task, I need to collect coverage coverage for functional tests that are hitting a web api (.net core 2.2) deployed in Azure. I also need to collect the code coverage for any manual testing that ends up calling the same web api.

    If there a way to do this?

    I was trying to go the route of 1. instrumenting the build using vsinstr, 2. Deploying the instrumented bits, 3. Starting VSPerfCmd or similar tool in Azure (if it's possible), 4. Running the tests, 5. Stopping VsPerfCmd.

    Thanks.


    MS


    • Edited by MS-19 Tuesday, July 16, 2019 2:08 PM
    Tuesday, July 16, 2019 2:07 PM

All replies

  • Hi MS-19,

    Welcome to MSDN forum.

    For you requirement, which framework did you use for function test?

    If it is under .NET framework, please open Test -> Analysis code coverage

    If it is under .net Core, please refer the article:Unit testing and code coverage for ASP.NET Web API

    Best Regards,

    Dylan


    Note: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you. 

    Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet


    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, July 17, 2019 9:40 AM
  • Hi Dylan, Thanks for your reply. I am using .net core 2.2 for my web api’s and Xunit for unit tests and functional tests. I ‘ll check the link you shared; my question is slightly different- I have functional tests that hit web api deployed in azure. Also I have testers doing manual testing against the deployed web api. I want to collect and merge the code coverage from both these testing activities. I am able to use visual studio to get the code coverage of the unit tests Using the ‘analyze code coverage’ option. That does not work for functional tests. Thx

    MS

    Wednesday, July 17, 2019 3:13 PM
  • Just to add- the functional tests hit the web api url and verify the response.

    MS

    Wednesday, July 17, 2019 3:15 PM
  • Hi MS-19,

    Sorry for delay in reply.

    As far as I know, I'm afraid that there is appropriate method to analysis code coverage for functional tests in VS IDE.

    But I find other tools could work for functional test NCover and DotCover by jetbrains.

    Please refer more about them: Coverage analysis for Functional Tests

    Hope it can help you.

    Best Regards,

    Dylan


    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, July 19, 2019 9:02 AM