This project is read-only.
5

Closed

Re# runner fails to run tests.

description

Running Unit tests with the following Command: "Resharper.ReSharper_ReSharper_UnitTest_RunContext" does behave like this:
  • Context: Method => executes the test
  • Context: Namespace => executes all tests
  • Context: Class => gives the following error in the ReSharper runner:
System.ArgumentException: Could not find method ??? in type KS.OR1.DomainLayer.Export.Tests.JobManagement.Helper.ExportTreatmentToFileSystemTests
Parameter name: _methods

at Xunit.Sdk.Executor.RunTests..ctor(Executor executor, String _type, List1 _methods, Object _handler)
at Xunit.ExecutorWrapper.RethrowWithNoStackTraceLoss(Exception ex) in d:\Builds\xUnit\Main\xunit.runner.utility\ExecutorWrapper.cs: line 268
at Xunit.ExecutorWrapper.CreateObject(String typeName, Object[] args) in d:\Builds\xUnit\Main\xunit.runner.utility\ExecutorWrapper.cs: line 161
at Xunit.ExecutorWrapper.RunTests(String type, List
1 methods, Predicate`1 callback) in d:\Builds\xUnit\Main\xunit.runner.utility\ExecutorWrapper.cs: line 257
at Xunit.TestRunner.<>c__DisplayClasse.<RunTests>b__c() in d:\Builds\xUnit\Main\xunit.runner.utility\TestRunner\TestRunner.cs: line 83
at Xunit.TestRunner.CatchExceptions(TestRunnerDelegate func) in d:\Builds\xUnit\Main\xunit.runner.utility\TestRunner\TestRunner.cs: line 92

Visual Studio 2010 Premium
Re# 6.1 or 6.1.1 EAP
xunit.net Contrib: 0.5.2.41894
xunit.net: 1.8.0.1545

file attachments

Closed Aug 2, 2012 at 3:00 PM by mattellis
Fixed in xunitcontrib-resharper.0.6.1

comments

mattellis wrote Jan 26, 2012 at 5:20 PM

Ohhh, that's an interesting one. Are you using unicode names for your methods, by any chance? Could you post the contents of the ExportTreatmentToFileSystemTests, please?

And does it using the xunit command line runner?

Thanks
Matt

marcoravicini wrote Jan 27, 2012 at 8:42 AM

Hi Matt

I'm using the console runner and it works seamlessly.
The File should be ansi encoded and I'm not using any unicode characters. (See attached file)

And the error gets even worse (or better). I was not able to reproduce this error.
Even with mixed Re# runners
I will observe the overall behaviour further.

Cheers
Marco

KarlSeg wrote Jan 27, 2012 at 1:19 PM

FWIW, I get the same thing. Both in 6.0 and 6.1. It's inconsistent..won't do it, and then suddenly starts to fail. And it's more than just "???" Sometimes it'll fail on like 15 weirdly named methods ("?", "??", "???"....). Although ??? is the most common. I'm not even running that many tests. Nothing weird about file encoding or method names...very normal tests.

xunit's test runner doesn't seem to cause it..though it's inconsistent enough that I'm not 100% on that.

KarlSeg wrote Jan 27, 2012 at 1:38 PM

I can also confirm that this seems to only happen when run via the Resharper.ReSharper_ReSharper_UnitTest_RunContext command when the scope is a class.

Running it on an individual method works.

Running it on the class from the solution explorer (right click...) works.

Also, since 6.1, I might have only ever seen the ??? case...I think the crazier cases were all in 6.0.

mattellis wrote Jan 27, 2012 at 2:07 PM

This is really odd. Can't say I've seen anything like this behaviour before.

When you say you're running that command, how are you doing it? Right click, keyboard shortcut, click on the icon in the gutter? And does this happen when you're editing the cs file - adding/removing/renaming tests or methods?

KarlSeg wrote Jan 27, 2012 at 3:15 PM

Again, there's really nothing weird about any of the setup...but by far the easiest way to make it happen is to run the tests within a class via the ReSharper.ReSharper_ReSharper_UnitTest_RunContext.

Tools -> Options -> Environment -> Keyboard Find that command (in the world's most horribly designed UI..just search for "resharper.resharper_resharper"), assign it keys (I do ctrl-shift-f10)....don't forget to hit "assign"

I've tried to reproduce it..to simplify tests and figure out what it is..but I can't...not yet anyways.

marcoravicini wrote Jan 27, 2012 at 11:01 PM

Exactly as KarlSeg wrote. I assign a hotkey and press Alt+R (or what ever shortcut you wish to assign).

mattellis wrote Jan 30, 2012 at 2:53 PM

Right. The closest I can get is if I change the name of a test and then really, really, REALLY quickly invoke RunContext, it can fail with a similar message. So, I had Test02, and I amended that to Test022323223233232323 and immediately moved up two lines (outside of the body of any method), hit the keyboard shortcut (CTRL-T + CTRL-R on intelliJ shortcuts) and I got an error of:

System.ArgumentException: Could not find method Test0223232 in type tests.xunit.DemonstrateRandomRunningOrder
Parameter name: _methods

with the same call stack.

I think what's happening in this case is that resharper is getting the plugin to parse the file while I'm typing, I've started changing the unit test name, it creates a new unit test with that partial name, and then, before it has a chance to parse again, I run, and it tries to run that method. But because I've actually finished typing, the class is compiled with the finished name, so it can't find it and can't run it.

Can you try and recreate based on this? Does it only happen when you run IMMEDIATELY after renaming a test? Is there more of a lag when resharper has been open and in use for a while (i.e. you can rename a test and it takes seconds before it's reflected in the unit test sessions window, or you can invoke the run command not quite so immediately, and it still fails)?

And a big question, if it fails, does it start working again the second time you run it? If this is the problem, resharper should have caught up and parsed the file again, and all names should be in sync.

Matt

KarlSeg wrote Jan 31, 2012 at 1:02 AM

don't think it's the same issue. It doesn't only happen after a sudden change, and re-running that specific test doesn't resolve the issue. If I re-run all the tests in the projects (by right-clicking the project in the solution explorer and picking run tests) , that'll fix it.

mattellis wrote Aug 2, 2012 at 2:33 PM

Fixed in changeset 2f174cf7a81b