Skip to content
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

BeforeTestRun not run in .NET462 up to .NET481 in multitarget test project #146

Closed
AdaskoTheBeAsT opened this issue May 28, 2024 · 1 comment · Fixed by #148
Closed

BeforeTestRun not run in .NET462 up to .NET481 in multitarget test project #146

AdaskoTheBeAsT opened this issue May 28, 2024 · 1 comment · Fixed by #148
Assignees
Labels
bug Something isn't working

Comments

@AdaskoTheBeAsT
Copy link
Contributor

Reqnroll Version

2.0.0

Which test runner are you using?

xUnit

Test Runner Version Number

2.8.1

.NET Implementation

.NET Framework 4.6.2 or later

Test Execution Method

ReSharper Test Runner

Content of reqnroll.json configuration file

{
"$schema": "https://schemas.reqnroll.net/reqnroll-config-latest.json",
"bindingCulture": {
"language": "en-us"
},
"language": {
"feature": "en-us"
}
}

Issue Description

After upgrade Reqnroll from version 1.0.1 to 2.0.0 method marked with BeforeTestRun attribute is run only on .net6.0 .net7.0 .net8.0 in multitarget integration test project - in .net 4.6.2 till 4.8.1 it is not executed at all which cause all tests dependant on that initialization to fail

Steps to Reproduce

<PackageReference Include="Reqnroll" Version="2.0.0" />
<PackageReference Include="Reqnroll.Tools.MsBuild.Generation" Version="2.0.0" />
<PackageReference Include="Reqnroll.xUnit" Version="2.0.0" />
  • rebuild
  • run all integ tests
  • only tests for .net 6.0 till .net 8.0 will run successfully

Link to Repro Project

https://github.com/AdaskoTheBeAsT/WkHtmlToX

@AdaskoTheBeAsT AdaskoTheBeAsT added the bug Something isn't working label May 28, 2024
@obligaron
Copy link
Contributor

Reqnroll registers itself as an xUnit test framework:

[assembly: global::Xunit.TestFramework("Reqnroll.xUnit.ReqnrollPlugin.XunitTestFrameworkWithAssemblyFixture", "Reqnroll.xUnit.ReqnrollPlugin")]

But when xUnit tries to load the type (Assembly.GetType) it fails (returns null) and the registered Reqnroll test framework is not used (and so the BeforeTestRun is not called).

Note: Trying to load the type with Assembly.GetTypes() throws a ReflectionTypeLoadException with a LoaderException stating that xunit.execution.dotnet can't be loaded.

This is probably related to the change to netstandard2.0 and an xUnit restriction described in the following discussion xunit/xunit#2576. 😢

@gasparnagy gasparnagy self-assigned this May 29, 2024
gasparnagy added a commit that referenced this issue May 29, 2024
…st project (#146) (#148)

* enable test runners for portability tests

* improve tests

* Fix: BeforeTestRun not run in .NET462 up to .NET481 in multitarget test project (#146)
gasparnagy added a commit that referenced this issue May 31, 2024
gasparnagy added a commit that referenced this issue May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants