-
Notifications
You must be signed in to change notification settings - Fork 105
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
Cannot run an individual test whose TestCase parameter contains characters from the range [U+0001..U+001F] #484
Comments
Thanks for the repro. It sounds like a problem with the filters. We'll need to determine if it is the VS filters, the translation in the adapter or lower in NUnit. |
@vchebotok @rprouse I faced the same issue today. Its also difficult to debug the particular test from test explorer because of this issue. |
When running test2, the filter appears to be generated correctly by filter = filterBuilder.ConvertTfsFilterToNUnitFilter(TfsFilter, loadedTestCases); It is as below in master as of today:
So I'm guessing this issue is with NUnit's filtering with unicode characters instead of the adapter. |
After further investigation... it's actually a difference between what NUnit expects when filtering on tests and what VS is returning. In NUnitTestFilterBuilder.MakeTestFilter, it returns the filter from VS, which is the FQN as returned above with the unescaped XML character. When this filter makes it into NUnit, it fails to load the XML in TestFilter.FromXML, as the unescaped UTF8 character breaks XML deserialization. If we escape it, it will pass serialization, but then fail to match in FullNameFilter as the escaped UTF8 character will then not match the unescaped one that NUnit detected from the method argument list itself. So I think in NUnit, we would need to either: I think 2 is more feasible, as unescaping is a more difficult task and we know that the test filters will be coming in as XML (which will be escaped if they load properly), so the escaping in the filter will make it so that they will match between the two in (I believe) all cases. |
If the adapter is sending the framework invalid XML for any reason, the adapter should be fixed to stop deviating from the XML protocol and escape all values. Likewise if the framework is sending the adapter invalid XML, the framework should be fixed to stop deviating from the XML protocol and escape all values. |
I'm slowly catching up to where you all are. This issue might depend on nunit/nunit#3063 (comment). |
Yes, I think that is correct. Now, can we escape these for the xml and make the engine accept these ? |
Not sure, I think so? Two things: I don't think we should send anything except valid XML, even if the current engine/framework combinations require invalid XML in order to filter these tests. Also, I don't want us to think of escaping the test names (implies round-trip) but rather as reformatting them for display purposes (implies one-way with collisions). Sort of in line with what I'm saying the framework should do: nunit/nunit#3063 (comment) If the framework is behaving (by reformatting test names with control characters) and the engine is behaving (by rejecting invalid XML), the adapter only needs to worry about VSTest's source-based discovery if it misbehaves (by not reformatting test names that have control characters the way the framework would). |
I am still getting this issue. Microsoft Visual Studio Enterprise 2019 JetBrains ReSharper Ultimate 2019.2.2 Build 192.0.20190828.114715
Any ideas why? |
Did you use the options for enabling this? There are these two that has to be set in the runsettings: If you use version 3.16.0 they are default on. |
I'm not using a runsettings file at all - is that the problem? |
Grab the test project at https://github.com/nunit/nunit3-vs-adapter.issues/tree/master/Issue484 You can then compare this with your own code. The runsettings is a bit bigger than yours, but the only important thing is the two properties. |
You're sure the runsettings are enabled? The settings for the test explorer.... select the file simple.runsettings (auto doesnt always work). Which version of VS 2019 is this ? |
It's slightly different with the runsettings file selected (the icon changes in test explorer) but it still isn't running the tests. I am using Microsoft Visual Studio Enterprise 2019 - Version 16.5.4 The output displays this... ---------- Starting test run ---------- |
Ignore the previous comments - with a clean and rebuild and a restart of Visual Studio - they are all now running. Thank you for your help @OsirisTerje |
@OsirisTerje - FYI - I raised an issue with Microsoft to find out why Visual studio isn't picking up the runsettings file automatically... the “Auto detect runsettings file” option picks up a file named “.runsettings” (not "simple.runsettings"). Details below... |
@craigbroadman Thanks! |
Here is a sample code:
My project targets .NET Framework v. 4.6.1 and I use:
If I press "Run all" in Test Explorer, all the tests from the sample above are executed without any errors. However, if I press "Run Selected Tests" in Test Explorer or "Run Tests" from the context menu in the code editor, Test2 and the first two test cases in Test1 are never executed.
The text was updated successfully, but these errors were encountered: