Closed Nagendracv closed 5 years ago
I removed xunit from the list above. And now I get a different error.:
SpecFlow designer codebehind generation is not compatible with MSBuild codebehind generation. The custom tool must be removed from the file. See http://www.specflow.org/documentation/Generate-Tests-from-MsBuild SpecflowHeadless C:***\Tests\Specflow\SpecFlowFeature1.feature
Followed the steps to remove singlefilegenerator and I'm back to square one...
Error [SpecFlow] System.Configuration.ConfigurationErrorsException: Unrecognized element 'unitTestProvider'. at System.Configuration.ConfigurationElement.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey) at System.Configuration.ConfigurationSection.DeserializeSection(XmlReader reader) at TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler.CreateFromXml(String xmlContent) at TechTalk.SpecFlow.Configuration.ConfigurationLoader.Load(SpecFlowConfiguration specFlowConfiguration, ISpecFlowConfigurationHolder specFlowConfigurationHolder) at TechTalk.SpecFlow.Generator.Configuration.GeneratorConfigurationProvider.LoadConfiguration(SpecFlowConfiguration specFlowConfiguration, SpecFlowConfigurationHolder specFlowConfigurationHolder) at TechTalk.SpecFlow.Generator.Configuration.GeneratorConfigurationProviderExtensions.LoadConfiguration(IGeneratorConfigurationProvider configurationProvider, SpecFlowConfigurationHolder configurationHolder) at TechTalk.SpecFlow.Generator.Project.ProjectReader.ReadSpecFlowProject(String projectFilePath, String rootNamespace) SpecflowHeadless
With SpecFlow 3 you don't configure the unitTestProvider in the config anymore. This is done by the individual NuGet packages (see https://specflow.org/2019/updating-to-specflow-3/). You need to add https://www.nuget.org/packages/SpecRun.SpecFlow.3-0-0/ to your project and don't have SpecFlow.xUnit, SpecFlow.NUnit or SpecFlow.MsTest in your project, as you can only have one unit test provider.
Normally the update of the packages removes the entries in the app.config. In your case, this didn't happen. Simple remove the unit test provider and plugin setting from the app.config.
The following documentations are then misleading. Please have it updated. https://specflow.org/plus/documentation/Migrating-to-SpecFlow-Runner/
also in https://specflow.org/2019/updating-to-specflow-3/ It needs to be updated that if the elements in app.config are not removed, it needs to be removed manually.
Now I get the following erroe on running the runtests.cmd... 'SpecRun.exe' is not recognized as an internal or external command Which means specrun path has not got installed properly as well. Im using VS command prompt
Also tests are not showing up in test explorer. Clicking on run all tests (even though there are no tests) gives following error SpecFlow designer codebehind generation is not compatible with MSBuild codebehind generation. The custom tool must be removed from the file. See http://www.specflow.org/documentation/Generate-Tests-from-MsBuild Petpoint.SpecflowHeadless
You need to remove the Custom Tool entry from your feature files, as described in the link in the error when using the MSBuild integration.
You are right, the migrating chapter in the documentation is out of date and no longer applies to SpecFlow 3. You need to install just one of the unit test provider packages (in this case SpecRun.Runner
) to determine which unit test provider to use, rather than configuring the unit test provider in the config file.
Thanks All! Finally managed to compile and restart the work on my project with specflow+ using Specflow 3.0. Though I still get the error... which is still fine as i know the path of specrun.exe 'SpecRun.exe' is not recognized as an internal or external command
@Nagendracv If you use <PackageReference>
runtests.cmd can not work, as there is no local package folder.
vstest.console.exe
and dotnet test
are working for command line execution.
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:
Used Test Runner
Version number: 3.0.255
Visual Studio Version
Are the latest Visual Studio updates installed?
.NET Framework:
Test Execution Method:
<SpecFlow> Section in app.config or content of specflow.json
Repro Project
Dont have one yet
Issue Description
On build, I get this below error Severity Code Description Project File Line Suppression State Error [SpecFlow] System.Configuration.ConfigurationErrorsException: Unrecognized element 'unitTestProvider'. at System.Configuration.ConfigurationElement.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey) at System.Configuration.ConfigurationSection.DeserializeSection(XmlReader reader) at TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler.CreateFromXml(String xmlContent) at TechTalk.SpecFlow.Configuration.ConfigurationLoader.Load(SpecFlowConfiguration specFlowConfiguration, ISpecFlowConfigurationHolder specFlowConfigurationHolder) at TechTalk.SpecFlow.Generator.Configuration.GeneratorConfigurationProvider.LoadConfiguration(SpecFlowConfiguration specFlowConfiguration, SpecFlowConfigurationHolder specFlowConfigurationHolder) at TechTalk.SpecFlow.Generator.Configuration.GeneratorConfigurationProviderExtensions.LoadConfiguration(IGeneratorConfigurationProvider configurationProvider, SpecFlowConfigurationHolder configurationHolder) at TechTalk.SpecFlow.Generator.Project.ProjectReader.ReadSpecFlowProject(String projectFilePath, String rootNamespace) SpecflowHeadless
Steps to Reproduce
Just build the project
Also Rt Click Regenerate Feature files does not generate any files.
Reinstalled specflow extension and packages. Same problem.
.Net Framework 4.6.2 adding a new feature file results in the following error in the generated feature file We could not find a data exchange file at the path TechTalk.SpecFlow.SpecFlowException: Unable to find plugin in the plugin search path: SpecRun. Please check http://go.specflow.org/doc-plugins for details.
Please open an issue at https://github.com/techtalk/SpecFlow/issues/ Complete output: TechTalk.SpecFlow.SpecFlowException: Unable to find plugin in the plugin search path: SpecRun. Please check http://go.specflow.org/doc-plugins for details. at TechTalk.SpecFlow.Generator.Plugins.GeneratorPluginLoader.LoadPlugin(PluginDescriptor pluginDescriptor) at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.<>cDisplayClass3.b 1(PluginDescriptor pd)
at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext() at System.Linq.Enumerable.<ConcatIterator>d__59
1.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable
1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) 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_1ec7ddd8\extensions\mweoz4iw.hhl\TechTalk.SpecFlow.VisualStudio.CodeBehindGenerator.exe Parameters: GenerateTestFile --featurefile C:\Users*\AppData\Local\Temp\tmpA015.tmp --outputdirectory C:\Users*\AppData\Local\Temp --projectsettingsfile C:\Users*\AppData\Local\Temp\tmpA014.tmp Working Directory:
Csproj Project details:
Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"