Bug Report T746846
Visible to All Users

Unit Testing - Code Coverage does not work for MSTest v1 under Visual Studio 2019

created 6 years ago

[DevExpress Support Team: CLONED FROM T732938: Code Coverage doesn't support MSTests in Visual Studio 2019]
Does CodeRush support code coverage for MSTest v1 under Visual Studio 2019, and if so what are requirements/dependencies to get it running (have tried installing Nuget packages for MsTest.TestFramework and MsTest.TestAdapter but still saw errors and cannot spend much more time investigating right now)?

Both CodeRush and built-in Visual Studio test runners are working fine just for running tests (without coverage).  But when I run w/ coverage get the error below (this is w/o additional Nuget packages installed).

Am using:
Visual Studio Professional 2019
CodeRush 19.1.4

Thanks!

-------------------
2019.06.03 18:47:13.9076 Information: executor.Start
2019.06.03 18:47:16.1616 Information: Running tests for Jha.Bsl.Wire.Treasury.Business.Test

2019.06.03 18:47:16.1676 Error: Message: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
2019.06.03 18:47:16.1686 Error: Type: System.IO.FileNotFoundException
2019.06.03 18:47:16.1826 Error: Source: DevExpress.CodeRush.TestRunner.VSUnitTesting16
2019.06.03 18:47:16.2126 Error: StackTrace:    at DevExpress.CodeRush.TestRunner.VSUnitTesting16.Executor.LoadTests(IEnumerable`1 sources, MSDiscoveryContext discoveryContext)
   at DevExpress.CodeRush.TestRunner.VSUnitTesting16.Executor.LoadTests(MSDiscoveryContext discoveryContext)
   at DevExpress.CodeRush.TestRunner.VSUnitTesting16.Executor.Execute(TestFilterBase filter, String solutionDirectory, String lastRunSettingsFilePath)
2019.06.03 18:47:16.2226 Information: executor exited

Comments (1)
DevExpress Support Team 6 years ago

    Hi Jonathan,

    CodeRush does not support code coverage for MSTest v1 when you run tests under Visual Studio 2019.
    We're investigating this issue in more detail to find the most appropriate solution and will inform you when get the results.

    Answers approved by DevExpress Support

    created 6 years ago

    We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

    Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

      Comments (3)
      JH JH
      Jonathan_Halper 6 years ago

        I have installed v19.1.5 and while I do now see code coverage run without errors and see some code coverage information (in summary stats and exported reports), the code coverage window does not display the hierarchical class tree, or the actual code under coverage.  There are no filters applied to the coverage view that could hide the class.  See attached screenshot.

        I have tried generating coverage using both MsTest v1 and v2 with same result.

        JH JH
        Jonathan_Halper 6 years ago

          I was able to fix my coverage tree/code visibility issue by entering text ('qqq') into the 'Search' box at the top, and then deleting the search text. The code tree immediately became visible again.  I saw this behavior in two separate solutions (Production code, and a test project I just created today) .  It's still working when I close and reopen the solution in Visual Studio  (w/o having to enter anything the search text).  Anyway, thought you should know what happened.

          DevExpress Support Team 6 years ago

            Hello Jonathan,
            Thank you for letting us know that the coverage for MSTest v1 now works on your side. Regarding the issue with the empty Code Coverage Window - I've created a separate ticket on your behalf (The Code Coverage Window does not display the hierarchical tree of classes). It has been placed in our processing queue and will be answered shortly.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.