reqnroll / Reqnroll

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

Reqnroll.Verify fails when invoked through dotnet test #96

Closed ajeckmans closed 5 months ago

ajeckmans commented 5 months ago

Reqnroll Version

1.0.1

Which test runner are you using?

xUnit

Test Runner Version Number

2.6.5

.NET Implementation

.NET 8.0

Test Execution Method

Command line – PLEASE SPECIFY THE FULL COMMAND LINE

Content of reqnroll.json configuration file

{ "bindingCulture": { "name": "nl-NL" }, "runtime": { "missingOrPendingStepsOutcome": "Error", "stopAtFirstError": true, "trace": { "coloredOutput": true } } }

Issue Description

Reqnroll.Verify works when invoked from the Rider test runner, but fails with the following output when invoked through the commandline using dotnet test either in the solution directory or in the project directory:

 <test project name>.Specs  dotnet test
Restore complete (2,1s)
  <test project name>.Specs failed with errors (0,1s)
    D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly. [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018: Reqnroll.ReqnrollException: Unable to load plugin assembly: D:\packages\nuget\reqnroll.verify\1.0.1\build\netcoreapp2.1\Reqnroll.Verify.ReqnrollPlugin.dll. Please check https://go.reqnroll.net/doc-plugins for details. [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:  ---> System.IO.FileNotFoundException: Could not load file or assembly 'D:\packages\nuget\reqnroll.verify\1.0.1\build\netcoreapp2.1\Reqnroll.Verify.ReqnrollPlugin.dll'. The system cannot find the path specified. [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018: File name: 'D:\packages\nuget\reqnroll.verify\1.0.1\build\netcoreapp2.1\Reqnroll.Verify.ReqnrollPlugin.dll' [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath) [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Reqnroll.Plugins.PluginAssemblyResolver..ctor(String path) [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Reqnroll.Plugins.PluginAssemblyResolver.Load(String path) [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Reqnroll.Generator.Plugins.GeneratorPluginLoader.LoadPlugin(PluginDescriptor pluginDescriptor) [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    --- End of inner exception stack trace --- [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Reqnroll.Generator.Plugins.GeneratorPluginLoader.LoadPlugin(PluginDescriptor pluginDescriptor) [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Reqnroll.Generator.GeneratorContainerBuilder.LoadPlugin(PluginDescriptor pluginDescriptor, IGeneratorPluginLoader pluginLoader, GeneratorPluginEvents generatorPluginEvents, UnitTestProviderConfiguration unitTestProviderConfiguration) [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Reqnroll.Generator.GeneratorContainerBuilder.LoadPlugins(ObjectContainer container, GeneratorPluginEvents generatorPluginEvents, UnitTestProviderConfiguration unitTestProviderConfiguration, IEnumerable`1 generatorPlugins) [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Reqnroll.Generator.GeneratorContainerBuilder.CreateContainer(ReqnrollConfigurationHolder configurationHolder, ProjectSettings projectSettings, IEnumerable`1 generatorPluginInfos, IObjectContainer parentObjectContainer) [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Reqnroll.Tools.MsBuild.Generation.WrappedGeneratorContainerBuilder.BuildGeneratorContainer(ReqnrollConfigurationHolder reqnrollConfigurationHolder, ProjectSettings projectSettings, IReadOnlyCollection`1 generatorPluginInfos, IObjectContainer rootObjectContainer) [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Reqnroll.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTaskExecutor.Execute() [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Reqnroll.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTask.Execute() [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]
D:\packages\nuget\reqnroll.tools.msbuild.generation\1.0.1\build\Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [D:\git\<test solution name>\<test project name>.Specs\<test project name>.Specs.csproj]

Package versions:

Package Version
Reqnroll.Verify 1.0.1
Reqnroll.xUnit 1.0.1
Verify.Xunit 17.7.0
xunit 2.6.5
xunit.runner.visualstudio 2.5.7
xunit.runner.console 2.7.0

Test framework .net 8.


As you can see from the log above it is trying to search for a netcoreapp2.1 plugin whereas the nuget package only contains netcoreapp3.1 and net462.

Steps to Reproduce

I'll work on a reproducible case, but I think the issue is with the nuget package itself.

The Reqnroll.Verify.targets file contains the following lines:

<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <_VerifyGeneratorPluginFramework Condition=" '$(MSBuildRuntimeType)' == 'Core'">netcoreapp2.1</_VerifyGeneratorPluginFramework>
    <_VerifyGeneratorPluginFramework Condition=" '$(MSBuildRuntimeType)' != 'Core'">net462</_VerifyGeneratorPluginFramework>

    <_VerifyGeneratorPluginPath>$(MSBuildThisFileDirectory)$(_VerifyGeneratorPluginFramework)\Reqnroll.Verify.ReqnrollPlugin.dll</_VerifyGeneratorPluginPath>

  </PropertyGroup>
</Project>

whereas the packages does not contain the references file:

image

Why on earth Rider still manages to load and execute this (with updated tests) I don't know.

Link to Repro Project

No response