-
Notifications
You must be signed in to change notification settings - Fork 152
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
nunit console can't parse test case with special characters #1469
Comments
@WindingWinter Please include the exact command-line used to start the console runner. |
@CharliePoole , here's the command line
I'm running it with a solution file, but if I run it with a DLL file the problem is there all the same. |
Also, if I run it with |
The framework generates an XML fragment for each test event (like starting the test, finishing the test, etc.), which contains the name NUnit gives to your test. In the case of a parameterized test, the default test name contains the arguments provided. In your case, the name contains an invalid character. When you run under nunit3-console, these events are all handled. The first step is to process the XML fragment received by creating an XmlDocument. That's what it's failing here. I guess dotnet test works because it doesn't process those events. Ways to fix this:
@nunit Any thoughts on how to handle this? |
@CharliePoole , the interesting thing to note is that if I run the code under .net framework 4.8 ( and use 4.8 agent), then it works. I'm not too sure how to square your explanation with my observation |
The adapter based test will get 15 tests, one is not executed, and nothing crashes. Here is the dump file, showing the XML content coming from the NUnit.Engine Btw: The one character that crashes doesnt work in the adapter either, it comes out as not run: The adapter does process the events, and reads and parses the events, using XmlNode (XmlDocument based), so not sure why it would crash in the console and not in the adapter. The \uFFFF char is the End_Of_Everything character, or a non-character, and should not really be a part of something you would test. If you filter that off from your test, the rest should work |
@WindingWinter @OsirisTerje That's all very odd. It seems like it should either work or not in all environments. I'll run some more tests. |
Looks somewhat related to #1349 although it occurs in the context of a user-supplied name with special characters. Probably should fix both at the same time. |
I have replicated this in a package test and in the unit tests. The unit tests run under NUnitLite and pass. The package tests run in an agent and fail for both .NET 6.0 and .NET 8.0. I also added package tests to the NetCore console runner, which doesn't use agents, and they pass as well. So... problem is probably in the agent code. |
One thing for sure: the exception is caused by |
I filed issue nunit/nunit#4826 to deal with the framework part of this issue. I initially patched the engine and console separately to deal with two different places where an exception was being thrown but in the end I found one central location to fix it in the engine's |
Fix available on MyGet as version 3.18.2-dev00027 |
This issue has been resolved in version 3.18.2 The release is available on: |
I'm using nunit console 3.18.1, and here's a very interesting case concerning a .net 8.0 windows test project. Here's the project configuration
And inside the project it contains one single test class, with one single test case:
I can run it in NUnit3TestAdapter without problem. But if I run it from nunit console, then I will get this XML Exception
I don't think it appears if I compile the test project as .net framework 4.8
The text was updated successfully, but these errors were encountered: