Specflow: feature.cs files are not generated

Created on 24 Dec 2019  Â·  24Comments  Â·  Source: SpecFlowOSS/SpecFlow

SpecFlow Version:

  • [ ] 3.1
  • [ ] 3.0
  • [ ] 2.4
  • [ ] 2.3
  • [ ] 2.2
  • [ ] 2.1
  • [ ] 2.0
  • [x] 1.9

Used Test Runner

  • [ ] SpecFlow+Runner
  • [ ] MSTest
  • [x] NUnit
  • [ ] Xunit


Version number: 2.6.2.12296

Project Format of the SpecFlow project

  • [ ] Classic project format using packages.config
  • [ ] Classic project format using <PackageReference> tags
  • [ ] Sdk-style project format

.feature.cs files are generated using

Visual Studio Version

  • [ ] VS 2019
  • [ ] VS 2017
  • [x] VS 2015

Enable SpecFlowSingleFileGenerator Custom Tool option in Visual Studio extension settings

  • [ ] Enabled
  • [ ] Disabled
    **used to be enabled, but now this is disabled, and even with setting everything up to enable it again, .feature.cs file won't be generated (tried with: 'Tools/Options/SpecFlow: Enable SpecFlowSingleFileGneerator CustomTool changed from false->true; Generation mode is set to OutOfProcess and cannot be changed', set 'custom tool' in file property to 'SpecFlowSingleFileGenerator')

Are the latest Visual Studio updates installed?

  • [ ] Yes
  • [x] No, I use Visual Studio version 14.0.25465

.NET Framework:

  • [x] >= .NET 4.5
  • [ ] before .NET 4.5
  • [ ] .NET Core 2.0
  • [ ] .NET Core 2.1
  • [ ] .NET Core 2.2
  • [ ] .NET Core 3.0

Test Execution Method:

  • [ ] Visual Studio Test Explorer
  • [ ] TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
  • [ ] Command line – PLEASE SPECIFY THE FULL COMMAND LINE

<SpecFlow> Section in app.config or content of specflow.json

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
  </configSections>

  <specFlow>
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
    <unitTestProvider name="NUnit" />
    <trace traceSuccessfulSteps="true"
        traceTimings="false"
        minTracedDuration="0:0:0.1"
        listener="AnalysisAndOptimizationTests.Helpers.Tracer, AnalysisAndOptimizationTests"/>
  </specFlow>

  <appSettings>
   <add key="CustomKnownTypeProvider" value="TelventDMS.Common.Platform.dll;TelventDMS.Common.Platform.Security.Config.WCF.ConfigKnownTypeProvider" />
  </appSettings>
</configuration>

Repro Project

/

Issue Description


Last week, before update, everything went as expected.
I guess previous information are sufficient since this is basic environment and no advanced steps are done to encounter this issue.

Steps to Reproduce


Add new feature file with newest update.
.feature.cs file is not generated, even with enabling and setting options for CustomTool = SpecFlowSingleFileGenerator

Most helpful comment

We came up with a workaround:

  1. make sure spec flow is installed: Tools->Extensions and updates -> SpecFlow for Visual Studio 2015
  2. set Tools->Options->SpecFlow->Legacy->Enable SpecFlowSingleFileGenerator CustomTool = TRUE
  3. Uninstall Tools->Extensions and updates -> SpecFlow for Visual Studio 2015
  4. Restart Visual Studio
  5. Install Tools->Extensions and updates -> SpecFlow for Visual Studio 2015
  6. Restart Visual Studio
  7. Add feature file
  8. code behind generates

Looking forward to hearing from you soon.

All 24 comments

We came up with a workaround:

  1. make sure spec flow is installed: Tools->Extensions and updates -> SpecFlow for Visual Studio 2015
  2. set Tools->Options->SpecFlow->Legacy->Enable SpecFlowSingleFileGenerator CustomTool = TRUE
  3. Uninstall Tools->Extensions and updates -> SpecFlow for Visual Studio 2015
  4. Restart Visual Studio
  5. Install Tools->Extensions and updates -> SpecFlow for Visual Studio 2015
  6. Restart Visual Studio
  7. Add feature file
  8. code behind generates

Looking forward to hearing from you soon.

Hi,
I am facing the same issue with SpecFlow 2.4 and MSTest as Runner. I have tried the above mentioned workaround. But it is not working. It is not really while adding, but while editing the feature file, the changes are not getting reflected in cs file. Could you please suggest a fix?

Thanks

Hi,
I am facing the same issue with SpecFlow 2.4 and MSTest as Runner. I have tried the above mentioned workaround. But it is not working. It is not really while adding, but while editing the feature file, the changes are not getting reflected in cs file. Could you please suggest a fix?

Thanks

Hi,
That is the same issue, editing existing .feature file or adding new one - noting happens in code behind. And new scenarios are not visible in execution environment.
My workaround could not be applied in you case if your files are generated via microsoft tools. I cannot help you because, but you can read next:
https://specflow.org/2019/generating-code-behind-files-using-msbuild/
https://specflow.org/documentation/generate-tests-from-msbuild/

If you find something out, share it here.

Hi,
I just tried the same as mentioned in the URL. But the nuget package installation for "SpecFlow.Tools.MsBuild.Generation" itself is failing. The error I am getting is that
"Microsoft.Build.Exceptions.InvalidProjectFileException: The attribute "Original" in element is unrecognized". Any idea how to get help for this?

Thanks in Advance

Hi,
The same kind of issue, am also facing. Is there anything else that we can do workaround

Hi,
The same kind of issue, am also facing. Is there anything else that we can do workaround

I guess resolution depends on which generation tool you are using (MSBuild, SpecFlowSingleFileGenerator, or something else if exists).

I offered solution-workaround for case when generating code behind with SpecFlowSingleFileGenerator because that is my environment, and i can't help you in other cases.
You will have to wait for specFlow developers to appear, and that will be after 7th of January since they are on holidays. https://specflow.org/2019/specflow-support-over-the-holiday-period-2019-2020/

Hi,
The same kind of issue, am also facing. Is there anything else that we can do workaround

I guess resolution depends on which generation tool you are using (MSBuild, SpecFlowSingleFileGenerator, or something else if exists).

I offered solution-workaround for case when generating code behind with SpecFlowSingleFileGenerator because that is my environment, and i can't help you in other cases.
You will have to wait for specFlow developers to appear, and that will be after 7th of January since they are on holidays. https://specflow.org/2019/specflow-support-over-the-holiday-period-2019-2020/

Yup I already raised a concern in specflow. and am also having SpecFlowSingleFileGenerator. but the work around you gave is not working

Hi,

I tried upgrading to SpecFlow 3.0.199 and then tried to install "SpecFlow.Tools.MsBuild.Generation". But it is not allowing me to install with the following message :

The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. ...\build\SpecFlow.Tools.MsBuild.Generation.props.

My Visual Studio is 2015 and the ToolsVersion is 14.0. I believe this is affecting some compatibility. Not sure t is affecting exactly. Could you please help?

Thanks,
Rajeswari MC

@StefanZivkovic: I see you are using SpecFlow 1.9, which is very old. The Visual Studio extension was updated a while back for .NET Core, and these changes mean the extension is not compatible with versions of SpecFlow prior to 2.3.2. There is a news article on this subject here.

You can find older versions of the Visual Studio extension here if you need to continue using 1.9 and cannot upgrade.

If you do install an old version, make sure to disable the automatic updates, as these are enabled by default, meaning the older version will be overwritten again with the latest version otherwise. This is also covered in the article I linked to above.

@Stephen-Mc yes i read that article of yours more than a year ago, when specflow 3 was about to be released. I remember that statement to disable automatic updates, but i expected problems to occur at that time. Since we didn't encounter problems at that time i let it with settings as they were.

So, if we want to avoid possible future issues, we definitely should disable automatic updates or upgrade SpecFlow to newer version?

MSBuild Generation only works for VS2017 and later, because of MSBuild features we need that it is working.

I recommend everyone in this issue to upgrade to latest SpecFlow and use VS2017 or later.
If you have problems with the upgrade, please open new issues for it. We are very interested in these problems so that we can solve them for all.

The version of SpecFlow Extension for Visual Studio 2015 that works with SpecFlow 1.9.0 for us is here (https://github.com/SpecFlowOSS/SpecFlow.VisualStudio/releases/tag/v2017.2.7)

I'd the same problem with VS2017 with Specflow 2.3.2 version and fixed it by set up the SpecFlowSingleFile Generator to true in VS.
Tools > Options > SpecFlow > General > Legacy > Enable SpecFlowSingleFile Generator - True

We came up with a workaround:

  1. make sure spec flow is installed: Tools->Extensions and updates -> SpecFlow for Visual Studio 2015
  2. set Tools->Options->SpecFlow->Legacy->Enable SpecFlowSingleFileGenerator CustomTool = TRUE
  3. Uninstall Tools->Extensions and updates -> SpecFlow for Visual Studio 2015
  4. Restart Visual Studio
  5. Install Tools->Extensions and updates -> SpecFlow for Visual Studio 2015
  6. Restart Visual Studio
  7. Add feature file
  8. code behind generates

Looking forward to hearing from you soon.

@StefanZivkovic... tried this workaround.but No luck. Is there anyother trick to make it work ? Please help me.

It worked and works for us in 100% of cases. Which specflow version do you
use? Our is 1.9 and nunit for execution. Vs2015.

On Wed, Feb 19, 2020 at 1:33 PM KarthickNadarajanS notifications@github.com
wrote:

We came up with a workaround:

  1. make sure spec flow is installed: Tools->Extensions and updates ->
    SpecFlow for Visual Studio 2015
  2. set Tools->Options->SpecFlow->Legacy->Enable
    SpecFlowSingleFileGenerator CustomTool = TRUE
  3. Uninstall Tools->Extensions and updates -> SpecFlow for Visual
    Studio 2015
  4. Restart Visual Studio
  5. Install Tools->Extensions and updates -> SpecFlow for Visual Studio
    2015
  6. Restart Visual Studio
  7. Add feature file
  8. code behind generates

Looking forward to hearing from you soon.

@StefanZivkovic https://github.com/StefanZivkovic... tried this
workaround.but No luck. Is there anyother trick to make it work ? Please
help me.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/SpecFlowOSS/SpecFlow/issues/1834?email_source=notifications&email_token=AKRF3W6W3JLHZBL3BFBBRELRDURI5A5CNFSM4J66ZOE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMHUFXI#issuecomment-588202717,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKRF3W7PFP4337MMPOLXD4DRDURI5ANCNFSM4J66ZOEQ
.

@Narnian12 & @StefanZivkovic
Why are you still using SpecFlow 1.9?

It worked and works for us in 100% of cases. Which specflow version do you use? Our is 1.9 and nunit for execution. Vs2015.

@StefanZivkovic ..Visual Studio 2015 Enterprise Update 3, Nunit.Framework.dll 2.6.3 , TechTalk.SpecFlow.dll 1.9.0.77.

Tools->Extensions and updates -> SpecFlow for Visual Studio 2015 -> INSTALLED
Tools->Options->SpecFlow->Legacy->Enable SpecFlowSingleFileGenerator CustomTool = TRUE
File Properties ->CustomTool ->SpecFlowSingleFileGenerator

@AndreasWillich
Because it is inside corporation. I guess we cannot afford to switch to
version which might be unstable. But i guess all versions prior to v3 are
pretty stable.

On Thu, Feb 20, 2020 at 10:35 AM Andreas Willich notifications@github.com
wrote:

@Narnian12 https://github.com/Narnian12 & @StefanZivkovic
https://github.com/StefanZivkovic
Why are you still using SpecFlow 1.9?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/SpecFlowOSS/SpecFlow/issues/1834?email_source=notifications&email_token=AKRF3W7NGR4YJJRRGEDGPYLRDZFGFA5CNFSM4J66ZOE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMMSCXQ#issuecomment-588849502,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKRF3W2KIMHTZWE5EIRDVQDRDZFGFANCNFSM4J66ZOEQ
.

@StefanZivkovic Interesting answer. Why do you think SpecFlow 3.* is not stable enough to use?

@Andreas Willich
i don't think it is unstable. But i am not sure how much it is stable. And
i am not the one who is in charge of what version should be used. I am just
a developer who likes to do automation in regular software development.
Current version we use (1.9) works fine enough for our needs, i guess. Any
unnecessary upgrades would lead us to bigger effort while we update all
scripts for CI and whatever else is needed, but again there are special
teams for that kind of setup and configuration. For us to upgrade to new
version, i guess we would need very very strong reason to do it. It would
be something that we don't have with 1.9v, and that something exists on
newer versions. Or in case that with newer VS or .net versions we are not
compatible to use old 1.9v of SpecFlow. It must be strong argument why we
would upgrade to new version. That is how it works in big (bigger)
companies.

But i look forward to use it in my future private business.

On Thu, Feb 20, 2020 at 11:08 AM Andreas Willich notifications@github.com
wrote:

@StefanZivkovic https://github.com/StefanZivkovic Interesting answer.
Why do you think SpecFlow 3.* is not stable enough to use?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/SpecFlowOSS/SpecFlow/issues/1834?email_source=notifications&email_token=AKRF3W7DFS4OKHF6FH52E4DRDZJBRA5CNFSM4J66ZOE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMM4RJI#issuecomment-588892325,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKRF3W577IZ5NMHSWKA5UB3RDZJBRANCNFSM4J66ZOEQ
.

@Narnian12 can you send me your write me your email so we can continue with discussion?

It worked and works for us in 100% of cases. Which specflow version do you use? Our is 1.9 and nunit for execution. Vs2015.

@StefanZivkovic Worked Fine... Thanks alot. ( tried on Visual Studio 2015 Community Update 3)

Closed because of inactivity

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.

Was this page helpful?
0 / 5 - 0 ratings