14

ReSharper Unit Test Runner: Support for Deployment Items

I have a follow up question for the question above. I'm using resharper version 4.5 with native mstest support to run mstest unit tests. When I configure resharper's unit test options to use my testrunconfig (in order to utilize my set of deployment items), my test runs end without displaying any results or errors. Has anyone using resharper's mstest runner had the same issue or anything similar?

Community
  • 1
  • 1
Dan Ling
  • 2,965
  • 2
  • 29
  • 43

4 Answers4

8

I ran into this problem as well. I didn't want to disable code coverage however, because I often use it. The build server also uses it as well. So I wanted a solution that let me use R#'s runner most of the time for convenience, but still allow me to run my tests with Visual Studio's MSTest runner to get code coverage whenever I wanted as well as allow the build server to continue to generate code coverage statistics.

Workaround

I created an additional test settings file called Resharper.testsettings. It is exactly the same my normal Local.testsettings file except that it has code coverage disabled. Then I told R# to use this specific test run configuration.

  1. Open your Visual Studio Project
  2. Select Test->Edit Test Settings->Local (local.testsettings) (or whatever test settings you usually use)
  3. Click "Save As..."
  4. Name the file ReSharper.testsettings
  5. In the Name field of the General tab of the Test Settings window, change the name to ReSharper
  6. Click Data and Diagnostics
  7. Uncheck the box next to Code Coverage
  8. Go to ReSharper->Tools->Unit Testing
  9. Select the MSTest Unit testing provider
  10. Select "Use this Test Run Configuration:"
  11. Select ReSharper
  12. Click OK

If using R# 5.0 for step 8 there is an extra menu depth:

  1. Go to Resharper->Options->Tools->Unit Testing
mojo
  • 988
  • 6
  • 17
Zach Burlingame
  • 13,476
  • 14
  • 56
  • 65
8

Turns out that resharper's mstest runner does not work on testrunconfig files that have code coverage enabled. I've worked around the problem by disabling code coverage in my test run config file.

Dan Ling
  • 2,965
  • 2
  • 29
  • 43
  • Nevermind, I found it in Test->Edit Test Run Configuration->All->Code Coverage. – Florin Sabau Oct 06 '09 at 17:46
  • 7
    Managed to make it work by also selecting that test configuration in Resharper -> Options -> Tools -> Unit Testing -> MSTest -> Use this Test Run Configuration. – Florin Sabau Oct 06 '09 at 17:50
  • @Florin, Thanks! Reconfiguring the Resharper options worked for me. Editing the Test Run Configuration through the Test menu option did not. – Adam Kahtava Apr 21 '10 at 17:30
  • As a follow up to the comment by Florin: If you don't want to specify a .testsettings file in the Resharper configuration, you can edit the solution's .vsmdi file that is used by Resharper to determine the .testsettings file by default. – Philip Atz Dec 03 '14 at 12:31
1

You do not need resharper to support standalone mstest installation. I explain how to make a standalone mstest installation without the VS in my post here - http://www.shunra.com/shunrablog/index.php/2009/04/running-mstest-without-visual-studio

mark
  • 59,016
  • 79
  • 296
  • 580
1

Having similar problem. My MSTest tests run with Visual Studio test runner but not R#'s runner. The exception thrown is directly attributable to R# test run not finding the files that have to be deployed (and are specified in the testrunconfig).

Tried letting it pick the configured file and specified the file. No dice.

Don't know how to "disable code coverage" in the testrunconfig file other than to not specify any (and I don't).

Have asked R#. Now asking the StackOverflow audience.

Ward
  • 17,793
  • 4
  • 37
  • 53
  • 1
    Discovered that setting "Copy Local" = "Copy if newer" (or "Copy always") for the critical missing file (app.config in my particular use case) worked for R# ... although that alone does NOT work for VS TestRunner which requires that that file be mentioned in the Deployment section of the testrunconfig. What a nightmare. – Ward Oct 31 '09 at 19:09
  • We use the MSTest runner as our "authoritative" system, and only use the R# test runner for convenience. We have similar problems with deployment items. I'm on R# 5.1 with all the extra fancy menus and whatnot...doesn't matter. Doesn't work the same as the MSTest runner. – Peter Seale Aug 02 '10 at 23:49