-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An exception occurred while invoking executor 'executor://nunit3testexecutor/': Incorrect format for TestCaseFilter Error when using Real Time Discovery #935
Comments
@loop-evgeny I am not able to reproduce this. I am running your repro on VS2022 (17.0.2) and with no error message as you got. |
Hmm, that's weird - I also tried it on another machine (VS 2019) and it worked there. So it seems to be something specific to my machine. How can I debug this further? |
Can it be some culture-setting? It fails in the parsing check in vstest.console, and it is very sensitive to the different characters being used. I am thinking of the '{', '(', '='. If any of these are off then that might have something to do with it. [TestMethod]
public void ParsingShouldHandleExpressionWithParanthesis()
{
var filter = @"FullyQualifiedName=Issue919.Foo.Baz\(1\)";
var result = FilterExpression.Parse(filter,out FastFilter fastFilter);
} I debugged this one, and checked it for failure. It should fail here too for you, and you could then debug in and see what it complains about. Now, since I could clone your project and it worked "as is", the expression itself should be ok - no culture issues in it. Also since it works with dotnet test on your machine, it looks like VS is causing this. You can also debug into the adapter, there is information about that here, but I don't think you find anything more there, since the real error pops up from the vstest platform. Also check that your setting for VS doesn't follow your machine, See Options/Environment/Internation Settings. You can also turn on different tracings, but I don't think your get any closer with that. When you figure this out, please drop a comment on that here too. :-) |
It fails to build, both using VS 2022 and the command line. The problem is not obvious and that's another whole rabbit hole I don't really want to go down. But do you get the same FullyQualifiedName generated as the one in my error message?
|
This is a bit weird. The error string you show is not a valid filter expression. The TestCaseFilter should not have been invoked here at all. You're running from the Test Explorer, using the Run All there, and it should just give you list of test cases, in this case only one. No TestCaseFilter should be used at all. You could do the same on your machine, and see where it goes. Use the debug link for the adapter above. To make it simpler, I've enclosed a debug version of the adapter here, and you just need a .runsettings file added to your solution, containing: <RunSettings>
<NUnit>
<DebugExecution>true</DebugExecution>
</NUnit>
</RunSettings> and of course, clone the source code for the adapter, and load that into a VS. Also, the error message you get doesn't match up with what one would expect, there is no leading braces there, it seems like it is truncated - but - anyway - it shouldn't even get there. --> Also, in the same .runsettings file, set NUnit.Verbosity to 5, you should then see what expressions it looks for. ACtually, start with just setting the verbosity, and see what comes out. One thing you should see is the Runtype, which should show Ide. |
I'm sorry, I feel really dumb, but I just cannot get it to hit any breakpoint in NUnit3TestAdapter code. I managed to build the debug Nuget package with |
I do see the error message in the Debug window of the VS instance with NUnit3TestAdapter.sln, so I've attached to the right process:
|
You don't have to attach the adapter VS to your solution. Just let it stay there. Then just run the test (don't debug - just run it), and a dialog box should appear: And you end up in a method in the adapter code called CheckDebug. Step out of that, you're in the code. |
OK, it turns out the problem was I hadn't selected the .runsettings file. When I do that it launches the debugger when I try to run tests and I'm able to hit a breakpoint in VsTestFilter.IsEmpty. (For some reason it refuses to use the existing attached debugger and insists on opening a new VS instance every time, which is quite annoying. How do I get it to keep using the debugger that's attached?) I'm still not sure how to debug this though. Is the FullyQualifiedName name wrong (e.g. it should not have |
See post above :-) Just have the VS open with the adapter code, and choose that one Don't attach |
Yes, the FQN is wrong But, you shouldn't even have one there. (I'm updating now to 17.0.4 just to be sure there is nothing changed there. Should not since it is a patch version) Just checking: |
Looking at your stack trace, you're getting in at the |
Just a small tip: In case there is any older versions of Visual Studio testhost lingering about, you should clear the mefcaches, they are located for each version under e.g. %localappdata%\Microsoft\VisualStudio\14.0\ComponentModelCache Go through all version you find there, and delete all these caches. They will rebuild, but there has been cases where these have been used by newer versions. |
I have nothing in the Search box. I start the test by initially having Test Explorer closed and choosing Test, Run All Tests from the main menu: So it turns out that the test did run, despite the error, but VS Test Explorer was somehow set to show only "not run" tests by default, so this was what I saw: Combined with the error in the Tests output window this led me to believe the test did not run. But if I get it to show everything:
If I select "RunSomeTests({ AofDU2 = DU2MemberOfDU1 (DU1Member "aaa")
That runs fine. So, in summary, it seems that this particular error does not prevent the tests from running, it just adds an extra "Not run" test and a misleading error. In my real test project however, even if I comment out the test that causes this error I still get another error:
... and no tests run! How do I find out which test causes this? There is no stack trace displayed in this case, but attaching the debugger shows that it happens in the same place:
If I select a specific test in Test Explorer (in my real project) I can run that. However, the "Run all tests in view" button does not run anything. I tried deleting all the ComponentModelCache directories I found there, but that didn't help. |
I managed to track down the second error ("Missing '('.") by selecting subsets of tests to run. Here is a repro for it (I added this to the ZIP in the original issue description, too):
Unchecking "Discover tests in real time ..." allows all tests to run, including in my real test projects! Thank you so much for your help! So that fixes the problem for me, but of course it's quite a "gotcha"! |
Thanks a lot for your persistence! It can confirm this, it breaks on my site too when I turn on the "Discover tests in real time". I'll report this to the MSPG too, and you're right, it's quite a "gotcha" ! Thanks again and a Happy New Year ! |
When reporting a bug, please provide the following information to speed up triage:
Repro: NunitFSharpTestCaseSource.zip
I have a C# test project with a TestCaseSource that uses an F# type (discriminated union). When I try to run all tests using the VS test runner no tests get run and the Tests output window shows
I can run the test using
dotnet test
from the command line, however.This looks like bug #691 which was closed a while ago.
The text was updated successfully, but these errors were encountered: