问题
I'm trying to use SpecFlow in our (Visual Studio 2008) project to define executable acceptance tests. It was a decision made by the dev team to use our native German as the language for the feature files - so we added this little snippet of config to our test project:
<configuration>
<configSections>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/>
</configSections>
<specFlow>
<language feature="de-DE" tool="" />
</specFlow>
</configuration>
Trouble is: neither the syntax highlighting with Cuke4VS in Visual Studio 2008 works, nor does the SpecFlow custom tool understand and properly parse these feature files :-(
So I have something like this:
Funktionalität: Abrechnung durchführen
Um die angefallenen Kosten zu verrechnen
Als Sachberabeiter
Will ich eine Abrechnung durchführen
Szenario: erste Abrechnung erstellen
Angenommen es existiert noch keine Abrechnung
Wenn ich eine neue Abrechnung erstelle
Dann sollte die Abrechnung das aktuelle Jahr abdecken
but (1) Cuke4VS doesn't highlight the Funktionalität
nor the Szenario
keywords (German for Feature
and Scenario
), and (2) the SpecFlow custom tool throws errors:
Syntax error, expected: Feature: tag
When I use the English terms Feature
and Scenario
- things are just fine.
I also tried to add a tag #language: de-DE
to the top of the .feature
file - but unfortunately, that doesn't seem to help in any way :-( Syntax highlighting still isn't there, and the custom tool still spits out the errors...
What am I missing? Can I even get this to work properly in VS2008 ? (can't upgrade to 2010 for this project just yet)
回答1:
This is rather strange.... after re-starting Visual Studio 2008 several times, uninstalling Cuke4VS in favor of the built-in VS 2008 integration in SpecFlow 1.8.1, and after rebooting my dev machine, now suddenly the syntax highlighting for the German features works just fine, and SpecFlow's custom tool can now properly convert these German features into the *.cs
code-behind files.
But now: those features that we have that are in English with a #language: en-EN
prefix at the top of the file aren't highlighted properly anymore.....
Rather fishy - the whole VS 2008 integration seems a bit wonky... looking forward to VS 2010 !
来源:https://stackoverflow.com/questions/10529222/make-specflow-cuke4vs-understand-non-english-feature-files