locked
Code Coverage and web services

    Question

  • I am attempting to run code coverage on web services, but am not getting any coverage.

    I have added the DLL files used by the web service to the testrun.config code coverage area, and am hosting the web service on my local box.

    Wednesday, August 15, 2007 10:06 PM

Answers

  •  

    The following is the updated process for doing code coverage on web services.

    1.       Read our team blog on code coverage here, especially scenario 3. Please note the path to vsinstr and vsperfcmd is %vsinstalldir%\Team Tools\Performance tools

    2.       Build your product and test binaries.

    3.       Instrument your product binaries using vsinstr as detailed in the blog

    4.       Reset iis.

    5.       Start the code coverage collection using vsperfcmd /start… as detailed in the blog

    6.       Open a VS commandline and go to your binary drop location, eg. dd\tcm_1\binaries\x86dbg\bin\i386, run tests using mstest

    mstest /testcontainer:ActivitiesTests.dll and mstest /testcontainer:ActivityRuntimeTests.dll

    7.       Reset iis.

    8.       Stop the code coverage collection using vsperfcmd /shutdown

    9.       Open the .coverage file that you get in IDE, check the numbers.

    Friday, August 31, 2007 11:47 PM

All replies

  •  

    Although not a direct solution to the issue you write about, you might try keeping most of your business logic in a separate dll and run code coverage numbers on that dll independent from the web service.  This would make you web service implementation very thin wrappers that call your public library methods.  I found this approach actually easier to unit test and debug since it did not require debugging on the server. 

     

    In the meantime, I am researching your question more fully with the experts on the code coverage feature. 

    Friday, August 31, 2007 11:35 PM
  •  

    The following is the updated process for doing code coverage on web services.

    1.       Read our team blog on code coverage here, especially scenario 3. Please note the path to vsinstr and vsperfcmd is %vsinstalldir%\Team Tools\Performance tools

    2.       Build your product and test binaries.

    3.       Instrument your product binaries using vsinstr as detailed in the blog

    4.       Reset iis.

    5.       Start the code coverage collection using vsperfcmd /start… as detailed in the blog

    6.       Open a VS commandline and go to your binary drop location, eg. dd\tcm_1\binaries\x86dbg\bin\i386, run tests using mstest

    mstest /testcontainer:ActivitiesTests.dll and mstest /testcontainer:ActivityRuntimeTests.dll

    7.       Reset iis.

    8.       Stop the code coverage collection using vsperfcmd /shutdown

    9.       Open the .coverage file that you get in IDE, check the numbers.

    Friday, August 31, 2007 11:47 PM
  • I would think that there would be an easier way - especially with the web service running on my local box.

    I am building the web service on my local box, and I am doing debug builds.

     

    What of the above steps can I skip?

     

    With this in mind can I bypass the command line steps?

     

    Thanks,

    T.K.

    Monday, September 24, 2007 6:45 PM
  • I followed the instructions posted above as well as the instructions on the blog (http://blogs.msdn.com/vstsqualitytools/archive/2005/06/08/426979.aspx).  In no case was I able to successfully capture code coverage numbers against any of my testable web services. 

    I would sure appreciate some help in this matter (that isn't a stock answer). I haven't even found any proof that anyone has successfully captured code coverage numbers against web services.  Prove me wrong, I love learning.
    Monday, October 22, 2007 7:57 PM