使 SpecFlow/Cuke4VS 理解非英语的 .feature 文件 [英] Make SpecFlow / Cuke4VS understand non-English .feature files

查看:20
本文介绍了使 SpecFlow/Cuke4VS 理解非英语的 .feature 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我们的 (Visual Studio 2008) 项目中使用 SpecFlow 来定义可执行的验收测试.开发团队决定使用我们的母语德语作为功能文件的语言 - 因此我们将这个配置的小片段添加到我们的测试项目中:

<预><代码><配置><configSections><section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/></configSections><specFlow><language feature="de-DE" tool=""/></specFlow></配置>

问题是:Visual Studio 2008 中使用 Cuke4VS 的语法高亮显示不起作用,SpecFlow 自定义工具也无法理解和正确解析这些功能文件:-(

所以我有这样的事情:

功能:Abrechnung durchführenUm die angefallenen Kosten zu verrechnen阿尔斯·萨赫伯拉贝特Will ich eine Abrechnung durchführenSzenario: erste Abrechnung erstellenAngenomen esexistiert noch keine AbrechnungWenn ich eine neue Abrechnung erstelleDann sollte die Abrechnung das aktuelle Jahr abdecken

但是 (1) Cuke4VS 没有突出显示 FunktionalitätSzenario 关键字(德语用于 FeatureScenariocode>),以及 (2) SpecFlow 自定义工具抛出错误:

<块引用>

语法错误,预期:功能:标签

当我使用英文术语 FeatureScenario 时 - 一切都很好.

我还尝试在 .feature 文件的顶部添加一个标签 #language: de-DE - 但不幸的是,这似乎没有帮助无论如何:-(语法高亮仍然不存在,自定义工具仍然会吐出错误......

我错过了什么?我什至可以让它在 VS2008 中正常工作吗?(目前还不能为这个项目升级到 2010)

解决方案

这很奇怪.... 多次重新启动 Visual Studio 2008 后,卸载 Cuke4VS 以支持 SpecFlow 1.8 中的内置 VS 2008 集成.1,在重新启动我的开发机器后,现在突然间德语功能的语法突出显示效果很好,SpecFlow 的自定义工具现在可以正确地将这些德语功能转换为 *.cs 代码隐藏文件.

但现在:我们拥有的那些在文件顶部带有 #language: en-EN 前缀的英文功能不再正确突出显示......

相当可疑 - 整个 VS 2008 集成似乎有点不稳定......期待 VS 2010!

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)

解决方案

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 !

这篇关于使 SpecFlow/Cuke4VS 理解非英语的 .feature 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆