0

I have interesting behavior on my machine during unit testing using VS Unit testing framework. Machine is win-7, VS2012 Update 1, Resharper 7.1.1

When I run Unit Tests it creates 2 folders under TestResults:

  1. Deploy_UserName YYYY-MM-DD hh_mm_ss
  2. UserName_MachineName YYYY-MM-DD hh_mm_ss

Under UserName_MachineName..., there is folder Out and this is where my test is executing from:

SolutionDir\TesResults\UserName_MachineName YYYY-MM-DD hh_mm_ss\Out

2 other people open same project (win-7, VS2012, Resharper 7.1.2/8.2.3) (they use different solution though) and run it. The code on their machines executes from:

ProjectDir\bin\Debug

And I like it. I want same behavior on my machine. I went over all possible settings but I don't see anything that I can change to modify this behavior. Any ideas?

T.S.
  • 18,195
  • 11
  • 58
  • 78
  • It seems to me that you are using the VS unit testing panel, instead of ReSharper. So you need to collect more info such as Process Monitor log or directly contact JetBrains support. – Lex Li May 04 '15 at 23:00
  • @LexLi I use Resharper window. Moreover, I press on the "resharper circles" right in editor. This way, or another, result is the same – T.S. May 05 '15 at 00:56

2 Answers2

1

Resharper shadow copies assemblies for testing by default.

You can turn off shadow-copy, it will run in the bin folder. This Instructions might point you to the correct menu to turn it off:

https://www.jetbrains.com/resharper/webhelp80/Reference__Options__Tools__Unit_Testing.html

I hope it solves your issue

DeJaVo
  • 3,091
  • 2
  • 17
  • 32
  • First, I missed completely that under "Unit testing" there are some options. I went after the child nodes... Now, I unchecked "Shadow-copy" and I also have/had already, "Run test from - Project output folder". And yet, it still runs from `SolutionDir\TesResults\UserName_MachineName YYYY-MM-DD hh_mm_ss\Out`. I will inspect this tab on other machines, which run "normally" – T.S. May 04 '15 at 22:02
  • And more. I just tried on another machine, it has same settings as mine, including "Shadow-copy" being checked and it is running from "bin\debug". So, unfortunately your answer is not helping at this time – T.S. May 04 '15 at 22:12
  • on the other machine, which version of resharper are you using? – DeJaVo May 04 '15 at 22:13
  • You should check run test from Specified folder and browse your folder and not from Project output folder. – DeJaVo May 04 '15 at 22:19
  • That is not a good option as I have 100 unit tests. And now I would point all of them into same location? – T.S. May 04 '15 at 22:24
  • So basically, I infer that your project output folder is incorrect as resharper goes to look in the location you've pointed when run from project output folder is checked, my educated guess is to change the project output location and it will be solved. info how to change the project output folder: https://msdn.microsoft.com/en-us/library/ms165410.aspx – DeJaVo May 04 '15 at 22:27
  • I found similar question but not exactly same. Read this http://stackoverflow.com/questions/16231084/resharper-runs-unittest-from-different-location – T.S. May 04 '15 at 22:42
  • Hey, thanks for your time. I got it to work- see my answer. Looks like it was combination of things that has to do with bugs in VS and Resharper. – T.S. May 05 '15 at 18:53
0

Got it to work:

  • Updated VS2012 to Update 4

Now I have code executing from Bin\Debug but I can't start Unit Tests using Resharper - only VS Test Utilities

  • Upgraded Resharper to v7.1.3

At this point Resharper started to work but I started to get An unhandled exception of type 'System.ExecutionEngineException' occurred in mscorlib.dll during execution of Unit Test

  • Unchecked "Use legacy Runner" in Resharper Options-Unit Testing-MSTest. BTW, this option was missing in Resharper v7.1.1

Finally works!

T.S.
  • 18,195
  • 11
  • 58
  • 78