Specflow: Generated feature.cs missing accent and other special chars on pt-BR language feature using the OutOfProcess option

Created on 16 Jul 2018  ·  9Comments  ·  Source: SpecFlowOSS/SpecFlow

SpecFlow Version:

  • [ ] 2.3
  • [ ] 2.2
  • [ ] 2.1
  • [ ] 2.0
  • [ ] 1.9

Used Test Runner

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


Version number: 1.2.1

Visual Studio Version

  • [x] VS 2017
  • [ ] VS 2015
  • [ ] VS 2013

Are the latest Visual Studio updates installed?

  • [x] Yes
  • [ ] No

.NET Framework:

  • [x] >= .NET 4
  • [ ] before .NET 4

Test Execution Method:

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

<SpecFlow> Section in app.config

  <specFlow>
    <unitTestProvider name="MSTest" />
    <language feature="pt-BR" />
  </specFlow>

Repro Project

Issue Description


When using the pt-BR language on feature file. The generated feature.cs does not contain special characters.

For example, the step below on the feature file:

E que o campo Tipo Documento deverá possuir o valor TESTE AUTOMÁTICO

the automatically generated file contains the following line:

testRunner.And("que o campo Tipo Documento dever  possuir o valor TESTE AUTOMATICO", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "E ");

where it should be:

testRunner.And("que o campo Tipo Documento deverá possuir o valor TESTE AUTOMÁTICO", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "E ");

notice the missing á on the word deverá and the missing Á on the word AUTOMÁTICO.

This issue only occurs when the Code Behind File Generation Mode is set to OutOfProcess, when using AppDomain it works properly.

This option can be set at Visual Studio Specflow Options. Tools > Options > SpecFlow > General > Code Behind File Generation > OutOfProcess (or AppDomain). The default configuration is OutOfProcess.

It may be an issue related to the external process culture.

Steps to Reproduce


To reproduce, it is only necessary to create a feature file with steps with special characters or accents.

Bug Generator SpecFlow Team Backlog

All 9 comments

Interessting issue. I don't remember to do anything with the culture of the processes.
Could you generate a small repro project for me that I can have a look at it?

Additional I would suggest that you use the MSBuild integration (https://specflow.org/documentation/Generate-Tests-from-MsBuild/) to generate the code- behind files.
This will also be the default for SpecFlow 3.

I will check the MSBuild integration. The following repo contains an example of the issue.

https://github.com/leandroltavares/DemoSpecFlowIssue

My current assumption is, that the special chars are stripped when we read von stdout from the started external process.
It's somewhere here: https://github.com/techtalk/SpecFlow.VisualStudio/blob/master/IdeIntegration/Generator/OutOfProcess/OutOfProcessExecutor.cs#L25

I've seen a similar problem on 2 pcs in my team with german feature files with ö, ä, ....
Currently I think it's somehow related to feature files which are generated using german item templates and processed by SingleFileGenerator, not sure if this is the same problem, maybe it helps to further analyze this issue

I have the same problem with spanish feature, doesn't generate the step definitions and parameters with special characters, I'm using the auto generated steps by visual studio but in the run test doesn't works with the OutOfProcess, reviewing the enconding files some are generated by ansi other by utt-8 bom, I change all encoding files to utf-8 and working when I'm using the default option
This option can be set at Visual Studio Specflow Options. Tools > Options > SpecFlow > General > Code Behind File Generation > OutOfProcess
If I change to appDomain working fine

The problems with the encoding is fixed (https://github.com/techtalk/SpecFlow.VisualStudio/pull/31).
It was a problem with the encoding & stdout of the external process.

Here are vsix with the fixes: https://github.com/techtalk/SpecFlow.VisualStudio/releases/tag/v2017.2.2

@leandroltavares & @apis3445 if you could try them out and give feedback, I will upload a new version to the marketplace next week. Thanks!

Dear @SabotageAndi these fixes seem to be effective. I have tested here and the files were generated properly. Thanks!

I uploaded the extension to the marketplace 30 min ago. It should be in the next hours available to update.

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