locked
Procedure to get the code coverage for coded ui test in Visual Studio 2013 RRS feed

  • Question

  • Currently we are trying to get the code coverage for coded UI test application. We are following below steps to achieve the same.

    *Enabling code coverage under data and diagnostics and Importing Code under test(CUT) dll's to test settings.

    *Importing actual project in which CUT resides.

    We could able to get the code coverage by following these steps.

    Our question is, in case of large projects, is that possible to get the code coverage only by importing dll's to test setting file and without actually adding all projects in which CUT resides under test solution.

    If we remove the actual projects in which CUT resides, we are not able to get the code coverage of CUT projects. We are getting only code coverage for Test project.

    Please let us know the procedure to get the code coverage without having to add all projects in which CUT resides?

    Thank you!

    Regards,

    Prashanth

    Wednesday, August 5, 2015 11:25 AM

All replies

  • Hi Prashanth,

    >> in case of large projects, is that possible to get the code coverage only by importing dll's to test setting file and without actually adding all projects in which CUT resides under test solution

    I am not sure what your code coverage is used for. In my option, when you have a Coded UI test project, you could use the code coverage. Why do you add other projects? If your Coded UI project is large, and you just want to exclude or include specified assemblies from code coverage, you could use Exclude or include. If you want to include assemblies that are not part of your solution, you could obtain the .pdb files for these assemblies and copy them into the same folder as the assembly .dll files.

    You could refer the link below for more information.
    # Customizing Code Coverage Analysis
    https://msdn.microsoft.com/en-us/library/jj159530(v=vs.120).aspx

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, August 6, 2015 6:01 AM
  • Hi Edward,

     

    Thank you for your reply.

     

    Currently we have tried the same way which you specified in the below line.

     

    "you could obtain the .pdb files for these assemblies and copy them into the same folder as the assembly .dll files"

     

    But we were unable to get the code coverage for the source code of application under test. We could able to get the code coverage for test methods but not for the actual source code of application.

     

    Then we added Actual source project to our test solution and then we ran our test and we got code coverage of Actual source code of application under test.

     

    So my concern is, is it really required to have the Actual source code under test solution in order to get the code coverage.? if not what is procedure to get that.

     

    Thanks

     

    Regards,

    Prashanth


    Thursday, August 6, 2015 9:48 AM
  • Hi PrashanthSid,

    Do you mean that if your test method in the dll which is not in the same solution with the Coded UI solution, the code coverage will not include it, if test method in the dll which is in the same solution with the coded ui solution, the code coverage will include it?

    I will test at my side, and it might be a little delay.

    Thanks for your understanding.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, August 7, 2015 7:33 AM
  • Hi Edward,

    Situation is similar.

    In our case, Actual source code of project is not in the same solution with the coded UI solution. But we added Actual source code dlls under test settings as you mentioned .

     

    After the run, code coverage will result only for test dll . It will not show/include actual source code dll. If we add the actual source code project to the solution with coded ui project then Code coverage will include both test dll and actual source code dll.

     

    So it is required to have both projects(Actual source code project and Coded UI test project) to get code coverage for both ??

    Under test settings we are referring the dlls from "bin/debug" location in which actually application runs.

    Am Sorry, I tried attaching the snapshots but currently not able to due to account verification.

    Thank you.

    Prashanth

    Friday, August 7, 2015 8:57 AM
  • And we are actually  having WPF and XBAP applications to test.
    Friday, August 7, 2015 2:43 PM
  • Hi Edward,

     

    Did you find any clue on this?

     

    Currently we are piled up of tasks which is solely depend on output of this issue.

     

    We are doing some investigation which is dependent on this item.

     

    We understand your busy schedule but Can you please let us know the output earliest?

     

    Regards,

    Prashanth

    Friday, August 14, 2015 8:36 AM
  • Hi Prashanth,

    If you want to get code coverage result for dlls which are under test, you need to import them in the test setting file. Otherwise, you will only get code coverage for that test project just as you mentioned above. 

    Thanks. 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, August 17, 2015 8:14 AM
  • Hi Vicky,

    Our requirement is Suppose we have only DLL and PDB and we dont have actual source code of DLL,then how do we achieve code coverage for the  particular DLL.

    Currently we are adding DLL and PDB to the test setting file. But we could not able to get the code coverage for DLL.

    But if we add actual source code of DLL to the same solution of test project in which coded UI test resides, We could able to get the code coverage for the DLL of actual source project

    So our requirement is , Only by adding DLL and PDB to the test setting file, (Without adding Actual source code project to the test solution) can we able to get the code coverage for WPF/XBAP/Silverlight application.

    Please refer previous mail chain for more information

    Wednesday, August 19, 2015 8:30 AM
  • Hi Vicky,

    Did you find any clue on this?

    Currently we are piled up of tasks which is solely depend on output of this issue.

    Please let us know whether it can be possible or not.

    Thanks

    Regards,

    Prashanth

    Tuesday, August 25, 2015 6:29 AM