-
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
NUnit3TestAdapter errors when running xUnit tests #629
Comments
Can you please upload a repro project? |
Sure, here you go. Unzip it, change into that directory, and run the last three commands from the repro steps in my original post: |
Thanks! I see the nunit tests are running as they should when nunit-test.dll is used, but crashes as you describe when the xunit-test assembly is run. The VSTest is searching for all adapters in a folder, so I assume it tries to run both. Why it should fail on the nunit one when running the xunit-tests are very strange. |
What happens is that the NUnit adapter is running under .net core 1 and not 2.2. |
This part doesn't make sense to me unless you override VSTest's autodetection by passing a
Can we confirm for sure that VSTest is choosing .NET Core 1.0 solely because of our adapter in all circumstances, or is there another factor? |
A possible hacky workaround might be to add a reference to NUnit to the xUnit tests and add the NonTestAssemblyAttribute to the xUnit test suites so that NUnit ignores them. As for what is causing this, I can't think of anything. |
Note: If you run the nunit-test.dll, all works as it should. This happens when we run the xunit-test.dll. Since they are in the same folder, it sorts of picks up the nunit too. I've added up the repro code (thanks @damonbarry) with a sln file , it is named BlankSln.sln, but containts the 2 projects. Then it is easy to see the discovery phase too, and the error message. Repo is here: https://github.com/OsirisTerje/Issue629 Suspicious when we reference netcore 1.0, and then this pops up. |
@damonbarry This version includes the net core 2.0, and it works on my machine. |
Yep, that worked for me locally on my simple repro case. 👍 |
Noticed the release this morning...thanks! |
@damonbarry Just curious: Through what did you notice the release? I'm trying to publish as many places as possible, so is just curious how people pick it up. |
Not through any sort of automatic notification, unfortunately. You added this issue to your 3.14 milestone, which I would check periodically. Once a date was attached to the milestone, I checked back daily until this morning. |
Ahh... I see. I'm trying to get the dates correct, but I got a few days delayed here due to travels during the summer vacation. Normally a good time for releasing stuff, but not this year ;-) Hope it works for your production code :-) |
My .NET Core codebase has a mix of xUnit and NUnit tests which all get built into the same directory with something like:
When I try to run some xUnit tests with:
...the tests pass but I see an error in the console:
It seems that NUnit's test adapter is selected first and fails, so
dotnet test
moves on to the xUnit adapter, which runs the tests. Note that I don't see this error if:dotnet publish
instead ofdotnet build
(System.Xml.XPath.XmlDocument.dll is copied into the target directory)dotnet test
instead ofdotnet vstest
The error is similar to what's described in #589, but the repro seems very different so I didn't want to muddy that issue.
Environment
NUnit 3.11.0
NUnit3TestAdapter 3.11.0
.NET Core SDK 2.2.202
Windows 10.0.17763 (RS5)
Repro (from PowerShell)
The text was updated successfully, but these errors were encountered: