-
Notifications
You must be signed in to change notification settings - Fork 153
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
exception occurred while invoking executor Unexpected token '(' at position 100 in selection expression. #1510
Comments
Hi @livebe01
|
Thanks @stevenaw, I tried your suggestion, but it results in the same error/behavior. It's strange to see |
The same error happens on Windows. It should work according to the docs https://docs.nunit.org/articles/nunit/running-tests/Test-Selection-Language.html#simple-expressions The error happens in the NUnit.Engine, so I'll transfer the issue there. |
I took a quick look at this when it was reported and as far as I quickly could determine then
I'm actually unsure if this have ever worked (perhaps the documentation and code is out of sync?). Ps. NUnitLite seems to have the same problem |
If this is an error in the engine, we should be able to repro it with a failing unit test for the tokenizer and/or the parser. I'll try to do that when I get back to work in a few weeks but if somebody wants to start on it now, please go ahead. We haven't often checked in failing tests deliberately, but that's actually a good way to prove a bug and does no harm since we won't merge a failing branch. It's harder for us if the failure only occurs on a Mac, but @livebe01 could give it a try as well. We run into this problem (lack of devs with Macs on the team) periodically. |
Per nunit/docs#316, it looks like the feature may have worked at some earlier point. |
For sure. Let me know if there's something you'd like me to try. |
If you are able to build a test case that excercises the engine at a lower level, that would help. See our Tokenizer tests and TestSelectionParser tests for examples. This might be simpler for you than building the entire engine and runner, although that's an option as well. Have you looked at the console output yet? It may actually show how the runner is interpreting your where filter. |
I tested it on windows, same results. |
I wanted to add, I get the same error whether running |
OK, I missed that. I labeled it a bug and if nobody gets to it before the 25th, I'll work it. |
I've been able to try a few things tonight here.
However there still seems to be an issue with the test selection. I can correctly select a test method which expects an int or an enum but not a string. It does appear there is an existing test for exactly that scenario, though, which passes on the engine side. I have to stop the investigation for now, but if the engine test proves correct XML generation then I am wondering if perhaps this is a framework issue.
|
Free time is a little unpredictable at the moment for me so I've put up a PR with some of the tests I'd written as part of my investigation tonight: #1513 |
I've experimented with @stevenaw 's branch and it's tests. They all seem to pass whether I use single quotes or not. So, the tests are verifying that the engine accepts an argument as input and creates a filter containing valid XML that exactly matches our format for filters. Two important things are not demonstrated by the tests:
@mikkelbu Indicated the problem also exists in NUnitLite, so I think I'll experiment with that first. |
Let's get NUnitLite out of the way first... It has the same problem purely because it contains copies of |
Working with the repro that @OsirisTerje provided, I can make it work using the following command-line...
That's pretty obscure and clearly unsatisfactory. As far as I can tell, dotnet test removes the outer quotes and the adapter passes Using the console command-line, we want the engine to receive the same where clause. Under windows, all of the following do that and run the single test correctly...
Note that there is a small change in all of these examples, as compared to what was given originally. I have eliminated the blank space after the comma, so as to provide the exact test name, which is So where does that leave us? WRT the console runner and engine, I think it would be reasonable to ignore white space within the parentheses that surround the arguments, but not within any individual string argument. I'll look at that for this issue. In addition, I think we need to verify that the docs emphasize sufficiently that escape requirements for the command-line vary according to the operating system. The engine itself also requires escaping certain things and that too should be documented. WRT using the adapter via WRT the framework, I'm not seeing any problem so long as the name of the test is specified correctly. |
Curiouser and curiouser. :-) It is possible to make the command line work with double quotes on Windows. You "merely" have to enter...
This seems to be due to the byzantine nature of Windows command-line processing wrt double quotes. This partial output from
and, further along, ...
For the sort of processing we're doing here, we would probably be better advised to parse the command-line text directly, rather than relying on the shell to split out arguments for us. Unfortunately, that's not how the command-line processing is designed. At the time the console was originally written (around 2000) the shell did much less processing. Anyway, it's very clear that the command-line handling in windows itself is causing most of the problem. The immediate workaround until this issue is closed is to...
|
I have the following test
[Test]
[TestCase(ThisEnum.Option1, "ABC")]
[TestCase(ThisEnum.Option2, "DEF")]
[TestCase(ThisEnum.Option3, "GHI")]
public void TestSomething(ThisEnum thisEnum, string expected)
{
// do something
}
I can run the tests individually, and as a group in Rider w/o issue. But, for some use cases, it'd be really useful to be able to run parameterized tests individually, from the CLI.
I'm developing on a Mac using Rider. My project is using "NUnit" Version="3.13.3" and "NUnit3TestAdapter" Version="4.3.1".
I run the following from the Mac terminal:
dotnet test -- NUnit.Where="test==Some.Name.Space.SomeClass.TestSomething(EnumValue,\"ABC\")"
and get this error:
When I run
dotnet test -- NUnit.Where="test==Some.Name.Space.SomeClass.TestSomething"
, all three tests run w/o error. I wonder if you can point me at what I might be doing wrong or what I might try to get passed this.Thanks!
The text was updated successfully, but these errors were encountered: