reqnroll / Reqnroll

Open-source Cucumber-style BDD test automation framework for .NET.
https://reqnroll.net
BSD 3-Clause "New" or "Revised" License
302 stars 33 forks source link

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

Closed AdaskoTheBeAsT closed 1 month ago

AdaskoTheBeAsT commented 1 month ago

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

Link to Repro Project

https://github.com/AdaskoTheBeAsT/WkHtmlToX

obligaron commented 1 month ago

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 https://github.com/xunit/xunit/discussions/2576. 😢