SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.24k stars 754 forks source link

Missing [assembly:GeneratorPlugin] attribute with SpecFlow 2.1 and Contrib.SpecFlow.Selenium.NUnit.SpecFlowPlugin #1247

Closed SabotageAndi closed 5 years ago

SabotageAndi commented 6 years ago

From https://github.com/techtalk/SpecFlow/issues/1234#issuecomment-414808500

SpecFlow Version:

Used Test Runner

Version number:

Visual Studio Version

Are the latest Visual Studio updates installed?

.NET Framework:

Issue Description

I am having same issue on changing feature file. NUnit: 3.8.1 SpecFlow: 2.1.0 Temp files are there in temp folder. ..Contrib.SpecFlow.Selenium.NUnit.SpecFlowPlugin.dll is there in the project. Username doesn't have a special character.

We could not find a data exchange file at the path TechTalk.SpecFlow.SpecFlowException: Missing [assembly:GeneratorPlugin] attribute in C:\Users\*\Desktop\Workspace\application-**.Testing\**.Testing.**\**.**.Contrib.SpecFlow.Selenium.NUnit.SpecFlowPlugin.dll

Please open an issue at https://github.com/techtalk/SpecFlow/issues/
Complete output: 
TechTalk.SpecFlow.SpecFlowException: Missing [assembly:GeneratorPlugin] attribute in C:\Users\*\Desktop\Workspace\application-**.Testing\**.Testing.**\**.**.Contrib.SpecFlow.Selenium.NUnit.SpecFlowPlugin.dll
   at TechTalk.SpecFlow.Generator.Plugins.GeneratorPluginLoader.LoadPlugin(PluginDescriptor pluginDescriptor)
   at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.<>c__DisplayClass3.<LoadPlugins>b__1(PluginDescriptor pd)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.<ConcatIterator>d__59`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.LoadPlugins(ObjectContainer container, IGeneratorConfigurationProvider configurationProvider, SpecFlowConfigurationHolder configurationHolder)
   at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.CreateContainer(SpecFlowConfigurationHolder configurationHolder, ProjectSettings projectSettings)
   at TechTalk.SpecFlow.Generator.TestGeneratorFactory.CreateGenerator(ProjectSettings projectSettings)
   at TechTalk.SpecFlow.VisualStudio.CodeBehindGenerator.Actions.GenerateTestFileAction.GenerateTestFile(GenerateTestFileParameters opts)

Command: C:\Users\*\AppData\Local\Microsoft\VisualStudio\15.0_218b45e8\Extensions\mksssiwo.mb5\TechTalk.SpecFlow.VisualStudio.CodeBehindGenerator.exe
Parameters: GenerateTestFile --featurefile C:\Users\*\AppData\Local\Temp\tmpFD3E.tmp --outputdirectory C:\Users\*\AppData\Local\Temp --projectsettingsfile C:\Users\*\AppData\Local\Temp\tmpFD3D.tmp
Working Directory: C:\Users\*\Desktop\Workspace\application-Renlearn.Testing\packages\SpecFlow.2.1.0\tools
SabotageAndi commented 6 years ago

As mentioned in https://github.com/techtalk/SpecFlow/issues/1234#issuecomment-415065219 There are problems with SpecFlow 2.1 and plugins with the VS Extension.

The best way is to use the MSBuild integration. You are using MSBuild for building .NET projects. We have an integration, that hooks into MSBuild to generate the code-behind files when you compile the project.

The actual docu is here: https://specflow.org/documentation/Generate-Tests-from-MsBuild/

The documentation for SpecFlow 2.1 is here: https://github.com/techtalk/SpecFlow/wiki/Generate-Tests-from-MsBuild/5c2868bb359118359b0f954d20522fb18546732c

I would highly recommend to update to a newer version of SpecFlow. 2.1 is more than 2 years old. We simply have the manpower to support so an old version.

aditki commented 6 years ago

@SabotageAndi , Thank you. I will look into the docs and meanwhile, i have already started upgrading.

Edit: I just observed the SpecFlow.Tools.MsBuild.Generation package version available requires Specflow version of minimum 2.3.2. So, i have no other option than upgrading my specflow

PuzzledRays commented 6 years ago

Hi, I was getting the initial error of a missing plugin, for which I followed the instructions given by @SabotageAndi and the code-behind files were regenerated successfully. But now I have a different problem, which started after installing SpecFlow.Tools.MsBuild.Generation and making changes to the .csproj file as described in the documentation. I had to upgrade from SpecFlow 2.1 to 2.4 as well.

The error reads as follows : ".csproj : error : The attribute "Update" in element <Compile> is unrecognized". There is also a 'load failed - Project requires user input. Reload the project for more information' error on the solution explorer, next to my projects. I am unable to reload the project, as there's a pop up warning - Operation cannot be completed. PS: I am using VS Professional 2015

Please advise. Thank you.

Stephen-Mc commented 6 years ago

Are you using SpecFlow+ Runner @PuzzledRays? From the SpecFlow+ Runner 1.8.1 changelog: 1.8.1 2018-08-24

Bug fixes:

The current stable version of SpecFlow+ Runner is 1.8.2.

PuzzledRays commented 6 years ago

These are the packages I have installed currently for my project. `

`

Stephen-Mc commented 6 years ago

So you do have SpecFlow+ Runner installed, but it's a version later than 1.8.0...

SabotageAndi commented 6 years ago

@PuzzledRays The SpecFlow.Tools.MsBuild.Generation package does only work in VS2017, because we are using MSBuild features that are only available with the MSBuild version of VS2017.

PuzzledRays commented 6 years ago

So what is the highest recomended version of SpecFlow+ for VS2015 ? Was the initial error, I was seeing ('Unable to find plugin in the plugin search path: SpecRun.') because I was using SpecFlow2.1 and SpecRun1.5.2, which are presumably older versions ?

SabotageAndi commented 6 years ago

SpecFlow+ works with VS2015. Only the NuGet package SpecFlow.Tools.MsBuild.Generation doesn't work with VS2017. This is part of the Open Source project. You have to do the MSBuild stuff manually. Here is the old documentation: https://github.com/techtalk/SpecFlow/wiki/Generate-Tests-from-MsBuild/61e26a504a10a238155e7015f3041459cf255a76

SabotageAndi commented 5 years ago

closed because of inactivity and I think it is resolved.

lock[bot] commented 5 years ago

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.