-
Notifications
You must be signed in to change notification settings - Fork 264
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
Testing platform produces an error with dotnet test #3390
Comments
Add the |
@nbalu please have a look at https://learn.microsoft.com/dotnet/core/testing/unit-testing-platform-integration-dotnet-test for more informations. We are aware this is a little cumbersome to have these different flags and maybe we should have them linked for NUnit (cc @OsirisTerje) but we had to have as many safeguards as possible when we have released this new platform. The number of edge cases or undocumented scenarios of VSTest is so high that we were sure to end up in some places where something would not work and we wanted to ensure there was always an easy way out for users. |
Thanks Guys, that was helpful. And I can just imagine how much complexity all that legacy causes. Though right now I feel like I'm turning on flags that should be just simply be controlled by Microsoft.Testing.TestPlaform. So people might be using:
But not both thus flags could controlled by Platform as a shipped default props. As .net is great because of their sane defaults / no config hell. IMHO selecting the package could imply the flavour of the "runner". Or am I wrong here? Running still not working as expected, got a wierd bug in the servicecollection dispose. I'll try to figure out what might be wrong with my setup reading through the docs pages. I do see that the log file is not created underneath the TestResults so I'll try to figure out what did go wrong here. Though this should not be happening.
And still |
Having multiple packages is indeed a solution although it could not work as in your example. One of the problem of VSTest, and current approach is that the test frameworks depends on some object model package shipped by VSTest but they don't declare this dependency and the user references Instead, with the new platform, the user references only NUnit packages and there is no conflicting version of the new "object model". It would be possible for NUnit to continue shipping NUnit3TestAdapter as the old adapter (working only with VSTest) and to ship some new package working with the new platform. One downside of this, and the reason we didn't do that on MSTest, is that it makes it harder for people to try it out. For example, right now it's relatively easy to keep all your infra has before and to occasionally (let's say only on your machine) run passing the flag enabling the runner. Again, we now have about 8 months of feedback on MSTest side and things are going really well so this is something that could totally be done now. About the errors, I actually see 2 problems, one with |
Yes it's from a single run. My bad haven't checked that if a new version exists. I just had the time to play around with it after weeks/months maybe. |
I found the issue for the object disposed exception but I will wait for @MarcoRossignoli on Monday to discuss best fix. |
I think it's fixed by #3306, I'll cherry-pick and do a bug fix release of the platform. |
1.3.2 solved the execution problem and the output is working as expected thanks for the help👍 |
Describe the bug
Created a new test project with the new Microsoft.Testing.Platform which seems to be working with
dotnet run
command but not withdotnet test
Steps To Reproduce
Created a new NUnit test app:
If I run
dotnet run
I get the following output:C:\prog\NUnit.TempTests> dotnet test
Test run for C:\prog\NUnit.TempTests\bin\Debug\net8.0\NUnit.TempTests.dll (.NETCoreApp,Version=v8.0)
Microsoft (R) Test Execution Command Line Tool Version 17.10.0 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Testhost process for source(s) 'C:\NUnit.TempTests\bin\Debug\net8.0\NUnit.TempTests.dll' exited with error: Error:
An assembly specified in the application dependencies manifest (testhost.deps.json) was not found:
package: 'Newtonsoft.Json', version: '13.0.1'
path: 'lib/netstandard2.0/Newtonsoft.Json.dll'
. Please check the diagnostic logs for more information.
Test Run Aborted.
If I run
dotnet run
I get the following output:C:\prog\NUnit.TempTests> dotnet run
.NET Testing Platform v1.3.1+359466b83c (UTC 2024. 07. 16.) [win-x64 - .NET 8.0.7]
Passed! - Failed: 0, Passed: 5, Skipped: 0, Total: 5, Duration: 317ms - NUnit.TempTests.dll (win-x64 - .NET 8.0.7)
For some reason it seems like the Json reference flows through the test command which I'm not sure how it's supposed to be possible. The test itself is not using Newtonsoft.Json at all.
Expected behavior
Should produce the same run result and output.
Actual behavior
Throws the error above.
Additional context
I did made my tweaks to be able to make the NUnit-Vnext branch to be able to work. But that's not supposed to cause this error at all.
If you need any context / info please feel free to reach out to me.
Best,
Bálint
The text was updated successfully, but these errors were encountered: