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

The "GenerateFeatureCodeBehindTask" failed unexpectedly (SpecFlow v4 beta) #199

Open
cwcot opened this issue Sep 25, 2023 · 7 comments
Open
Labels
enhancement New feature or request

Comments

@cwcot
Copy link

cwcot commented Sep 25, 2023

Has anybody experienced this error - I have added the NuGet packages for xRetry. I am running a newer version of SpecFlow. Have tried to downgrade but this introduces other issues in my project. If this is due to SpecFlow version is support for SpecFlow 4 coming?

    <PackageReference Include="specflow" Version="4.0.31-beta" />
    <PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="4.0.31-beta" />
    <PackageReference Include="specflow.xunit" Version="4.0.31-beta" />
    <PackageReference Include="xRetry" Version="1.9.0" />
    <PackageReference Include="xRetry.SpecFlow" Version="1.9.0" />
@JoshKeegan
Copy link
Owner

Hi,
This will be due to the beta SpecFlow v4 you're using which isn't supported by xRetry.

Hopefully you're already aware, but SpecFlow development has stopped and the community are waiting to find out the future of the project. I'm sure it will continue in some form, either officially or as a fork, but until the future is clear I don't know if v4 will be released. You can follow the discussion on future development of SpecFlow here

@JoshKeegan JoshKeegan added the enhancement New feature or request label Sep 25, 2023
@JoshKeegan JoshKeegan changed the title The "GenerateFeatureCodeBehindTask" failed unexpectedly (SpecFlow) The "GenerateFeatureCodeBehindTask" failed unexpectedly (SpecFlow v4 beta) Sep 25, 2023
@cwcot
Copy link
Author

cwcot commented Sep 25, 2023

Thanks Josh, I was unaware. Appreciate the update :)

@gauravkhuraana
Copy link

I am also getting this problem with ReqnRoll

The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly.
System.Exception->Microsoft.Build.Framework.BuildException.GenericBuildTransferredException: Unit test Provider already set.

    <GenerateFeatureFileCodeBehindTask
      ProjectPath="$(MSBuildProjectFullPath)"
      OutputPath="$(ReqnrollCodeBehindOutputPath)"
      FeatureFiles="@(ReqnrollFeatureFiles)"
      RootNamespace="$(RootNamespace)"
      GeneratorPlugins="@(ReqnrollGeneratorPlugins)" 
      
      MSBuildVersion="$(MSBuildVersion)"
      AssemblyName="$(AssemblyName)"
      TargetFrameworks="$(Reqnroll_TargetFrameworks)"
      TargetFramework="$(Reqnroll_TargetFramework)"
      ProjectGuid="$(ProjectGuid)"
      >

      <Output TaskParameter="GeneratedFiles" ItemName="ReqnrollGeneratedFiles" />
    </GenerateFeatureFileCodeBehindTask>

@JoshKeegan
Copy link
Owner

@gauravkhuraana the error "The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly." is quite generic & yours looks like a separate issue.

"Unit test Provider already set." is probably the bit to focus on. It's likely that there are multiple nuget packages in that project that are trying to use different test frameworks/providers. e.g. xRetry requires xUnit, so if NUnit was also in the project I'd expect to see that error.

@gauravkhuraana
Copy link

@JoshKeegan yes my framework has both NUnit and Reqnroll(recently migrated from specflow)

Now i was searching for a solution so i can put retry on Reqnroll cases,, can this plugin help

any workaround to proceed ?

@JoshKeegan
Copy link
Owner

Sorry, xRetry only works with xUnit.

Two different projects in the same solution can use different test providers if I remember correctly. So if your unit tests and Reqnroll tests were in different projects, you could use xUnit for Reqnroll, and still use NUnit for your unit tests.

There was also a fork of xRetry that somebody made for NUnit, but I don't think it supports Reqnroll. You could also see if that's something that is being worked on, but I don't know if the package is being maintained.

@gasparnagy
Copy link

@gauravkhuraana There is a similar package for NUnit: https://github.com/chrisbillson/NUnitRetry.ReqnrollPlugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants