Closed Vfleitao closed 3 years ago
I had a look at it and I found the issue.
Generatorplugins have to target .NET Core 2.1 and not .NET Standard 2.0
You need to change it in the csproj to this: <TargetFrameworks>net471;netcoreapp2.1</TargetFrameworks>
After that, it worked for me.
I had a look at the rest of the code, and I think you don't need to develop a complete new unit test provider. You can create your own decorators that translate tags into properties. We have some documentation about it here: https://docs.specflow.org/projects/specflow/en/latest/Extend/Decorators.html
ahhhhhh, that might explain it
I will try this later on, and if it resolves my problem
@SabotageAndi just tried it like you said and the docs and it worked like a charm. So much time lost in this
Thanks for the help
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
SpecFlow Version
3.9.22
Which test runner are you using?
NUnit
Test Runner Version Number
3.13.1
.NET Implementation
.NET 5.0
Project Format of the SpecFlow project
Sdk-style project format
.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation NuGet package
Test Execution Method
Command line – PLEASE SPECIFY THE FULL COMMAND LINE
SpecFlow Section in app.config or content of specflow.json
No response
Issue Description
When trying to create a plugin to add the PropertyAttribute to the generation of the feature.cs (so its used later for reporting) I noticed that when running via the command line with
The custom plugin is not executed, but the feature.cs files were still generated.
After a lot of debugging I was able to notice that while the plugin instance is of the right type (my custom plugin) when the method SetTestMethodCategories is executed, it ends up only calling the NUnit3TestGeneratorProvider method instead of the overwritten method
When running via Visual Studio, all works like a charm without any issues however
Steps to Reproduce
1- Open the reproduction production project 2- Build the SpecflowReproduction.CustomPlugin.SpecflowPlugin project 3- Copy the generated nupkg to the plugin folder 4- Install or restore SpecflowReproduction.CustomPluginReproduction to ensure the package is being used
5- Build the SpecflowReproduction.CustomPluginReproduction project 6- Calculator.feature.cs file will now contain [NUnit.Framework.PropertyAttribute("Hello", "World")]
7- Using the command line execute "dotnet build .\SpecflowReproduction.Reproduction\SpecflowReproduction.CustomPluginReproduction.csproj" 8- Calculator.feature.cs file will not contain [NUnit.Framework.PropertyAttribute("Hello", "World")]
Link to Repro Project
https://github.com/Vfleitao/SpecflowPluginIssue