-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
dotnet test
is not running tests for .NETFramework targets
#94183
Comments
Tagging subscribers to this area: @dotnet/area-system-collections Issue DetailsDescriptionWhen running Reproduction Stepsbuild clr+libs -rc Release Expected behaviorTests run.
Actual behaviorNo tests run:
Regression?I think this is a recent regression. I believe this used to work as I remember seeing test failures on framework when running with dotnet test. Known WorkaroundsDirectly invoke the
ConfigurationNo response Other informationNo response
|
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsDescriptionWhen running Reproduction Stepsbuild clr+libs -rc Release Expected behaviorTests run.
Actual behaviorNo tests run:
Regression?I think this is a recent regression. I believe this used to work as I remember seeing test failures on framework when running with dotnet test. Known WorkaroundsDirectly invoke the
ConfigurationNo response Other informationNo response
|
Someone needs to debug this. This likely also impacts VS Text Explorer which uses the VSTest runner underneath. There are settings to get more verbose logs returned by VSTest. |
One more thought, that could be related to the recent xunit 2.5.x upgrade. |
|
Are you're linking against xunit.runner.utility for some reason? If so, then you're frozen to using whatever version of xunit.runner.utility the VS adapter uses (because VSTest demands all dependencies be copied into the output folder). 99%+ of users don't do this so this isn't a general problem. |
The only reason to link against xunit.runner.utility is because you're creating your own runner. Tests should never link against this unless they're forced to because they're testing the runner you're writing. |
For a bit of architectural background... xUnit.net splits what it does into two separate sections which do not directly interact except via very strict contracts. There are "runner" and "execution" halves of the system. In v1/v2 when using .NET Framework, these two halves can be optionally separated by an app domain boundary (and in v2 .NET Core, they live in the same process). In v3 against all target platforms, they're separated by a process boundary.
By keeping this strong separation and frozen contracts, we have both backward compatibility (newer runners can run older tests) and major forward compatibility (older v2 runners can run newer v2 tests). In point of fact, I just was able to successfully run tests linked against core framework 2.5.3 with the VSTest adapter 2.0.0, which is 8.5 years old and targeted If your tests link against In addition, there is no guarantee that any particular version of When I shipped core framework 2.5.3, it had no runner utility changes that would've necessitated bringing in a new version for the VSTest adapter, so I didn't bother to ship a new one. It appears that when I ship the next core framework drop (which I'm planning to number 2.6.0), this will still be true, so again I'm not likely to ship another VSTest adapter version. |
Wow, that's quite a detailed comment. Thank you for spending your time on writing this up. I just reproduced this locally and I don't see our test assemblies or test helper assemblies linking against any of the What I see is that because of us wanting to support both xunit.console and VSTest, we bring in
Exactly that. This begs the question why we ever chose a design that made us copy the xunit.console runner into the test app's output directory. While VSTest requires that, xunit.console shouldn't. |
Yeah, that operation makes no sense to me. You were basically just waiting to explode. 😁 Each runner has to bring along their own copy of |
To be even more explicit: xunit.console would never use |
Just to share some context. We invoke our tests in CI on different machines than the build agents. We use Unfortunately our infrastructure here has become quite complex with so many different app models and ways of testing that this change will probably require some time. But for what is worth, this is indeed our own fault. Thanks for help diagnosing the issue :) |
Good luck! 😄 |
@ViktorHofer did you have a suggestion for what needs to happen to fix this? I gather that by copying xunit runner binaries over to the output directory this is somehow causing the test-discoverer to fail before it gets a chance to examine our test assembly, is that correct? |
The gist (IIRC) is to not copy xunit.console's assemblies into the output directory and just invoke it from the package cache (as intended). Only copy it into the output directory when archiving the test assemblies for helix submissions (property: xunit.runner.visualstudio is designed to be copied into the app output directory but xunit.console isn't. So avoiding the latter makes sense on a local machine. |
That makes it sound like we do something special here. We don't. The copy is an unfortunate requirement from the VSTest team; if we don't copy the DLLs into the output directory, then whoever runs |
If it helps, we could add an MSBuild property that we look for to prevent the file copies. They would need to stay on by default but if you know what you're doing, skipping the copies could make sense. |
I think this really is an issue on our side and needs a fix in our test infrastructure. The xunit.console copying is just wrong and also in-efficient. I should have done this differently in the past. |
Yeah, other repos don't copy and bundle the runner package as a correlation payload. It's not so hard to make that work, but it does require changes in a few places. One thing that was odd to me is that we're saying that our binaries are self-consistent and would work if we merely delete files that aren't needed. That tells me we might also have a bug / design-change ask for the |
I was suggesting something simpler for a quick fix. Keep the xunit.console in the app output directory but only when |
@akoeplinger found other places that still rely on xunit.console in the output directory.
It seems we have some more places to root out where we expect the runner in the output directory - those need to either be updated to pick up the runner from the package, or opt-in to copying. |
|
Moving this back into 9.0.0 as this makes debugging .NET Framework tests with |
Description
When running
dotnet test
on a test project in dotnet/runtime that targets .NETFramework I expect tests to run, but they do not. Seems like we have lots of other issues mentioning this, but I couldn't find an active one.Reproduction Steps
build clr+libs -rc Release
cd src\libraries\System.Collections.Immutable\tests
dotnet test -f:net462
Expected behavior
Tests run.
Actual behavior
No tests run:
Regression?
I think this is a recent regression. I believe this used to work as I remember seeing test failures on framework when running with dotnet test.
Known Workarounds
Directly invoke the
test
target.Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: