Cuke4nuke:是否缺少对不同语言的支持?
我正在使用 Cuke4Nuke 0.3.1 版本,并且在使用英语以外的其他语言定义功能文件时遇到问题。谷歌搜索没有带来任何解决方案,所以我的问题很简单:Cuke4Nuke是否支持用英语以外的其他语言定义功能?
我尝试使用 GitHub 的 Cucumber 存储库中的示例。这是一个不起作用的功能示例:
# language: no
Egenskap: Summering
For å unngå at firmaet går konkurs
Må regnskapsførerere bruke en regnemaskin for å legge sammen tall
Scenario: to tall
Gitt at jeg har tastet inn 5
Og at jeg har tastet inn 7
Når jeg summerer
Så skal resultatet være 12
当通过 Cuke4Nuke 编译并运行时,错误消息如下所示:
Cuke4Nuke C:_work\myProject\Tests\Integration.Tests\bin\Debug\Integration.Tests.dll C:_work\myProject\Tests\Integration.Tests\features -q C:/_work/myProject/Tests/Integration.Tests/features/summering.feature: 第 2 行出现词法错误:'Egenskap: 夏天'。看 http://wiki.github.com/aslakhellesoy/gherkin/lexingerror 了解更多信息。 (小黄瓜::词法分析器::LexingError) C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/gherkin-2.2.4-x86-mingw32/lib/gherkin/lexer/i18n_lexer.rb:22:in <代码>扫描' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/gherkin-2.2.4-x86-mingw32/lib/gherkin/lexer/i18n_lexer.rb:22:in 扫描' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/gherkin-2.2.4-x86-mingw32/lib/gherkin/parser/parser.rb:31:in
解析' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/feature_file.rb:35:in
解析' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:28:in <代码>加载' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:26:in 每个' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:26:in <代码>加载' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:14:in 特征' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime.rb:179:in <代码>功能' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime.rb:32:in 运行! C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/cli/main.rb:54:in执行!' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/cli/main.rb:29:in 执行' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/cucumber:8 C:/_work/tools/Ruby186/bin/cucumber:19:in
load '
加载'
看来cuke4nuke(或Cucumber?)完全跳过了# language 声明。例如,以下功能在不应该起作用时起作用。
# language: fi
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario Outline: Add two numbers
Given I have entered <input_1> into the calculator
And I have entered <input_2> into the calculator
When I press <button>
hen the result should be <output> on the screen
Examples:
| input_1 | input_2 | button | output |
| 20 | 30 | add | 50 |
| 2 | 5 | add | 7 |
| 0 | 40 | add | 40 |
有什么想法可以让 Cucumber 和 Cuke4Nuke 注意到语言声明吗?我的 Ruby 版本是 1.86,Cucumber 版本是 0.9。
I'm using the version 0.3.1 of Cuke4Nuke and I'm having problems defining my feature-files with an other language than English. Googling didn't bring any solutions, so my question is simple: Does Cuke4Nuke support defining the features in other languages than English?
I've tried to use the examples from the GitHub's Cucumber repository. Here's an example of feature which doesn't work:
# language: no
Egenskap: Summering
For å unngå at firmaet går konkurs
Må regnskapsførerere bruke en regnemaskin for å legge sammen tall
Scenario: to tall
Gitt at jeg har tastet inn 5
Og at jeg har tastet inn 7
Når jeg summerer
Så skal resultatet være 12
When compiled and run through Cuke4Nuke the error message is like following:
Cuke4Nuke
C:_work\myProject\Tests\Integration.Tests\bin\Debug\Integration.Tests.dll
C:_work\myProject\Tests\Integration.Tests\features
-q C:/_work/myProject/Tests/Integration.Tests/features/summering.feature:
Lexing error on line 2: 'Egenskap:
Summering'. See
http://wiki.github.com/aslakhellesoy/gherkin/lexingerror
for more information.
(Gherkin::Lexer::LexingError)
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/gherkin-2.2.4-x86-mingw32/lib/gherkin/lexer/i18n_lexer.rb:22:inscan'
scan'
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/gherkin-2.2.4-x86-mingw32/lib/gherkin/lexer/i18n_lexer.rb:22:in
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/gherkin-2.2.4-x86-mingw32/lib/gherkin/parser/parser.rb:31:inparse'
parse'
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/feature_file.rb:35:in
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:28:inload'
each'
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:26:in
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:26:inload'
features'
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:14:in
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime.rb:179:infeatures'
run!'
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime.rb:32:in
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/cli/main.rb:54:inexecute!'
execute'
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/cli/main.rb:29:in
C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/cucumber:8 C:/_work/tools/Ruby186/bin/cucumber:19:inload'
load'
It seems that cuke4nuke (or Cucumber?) is skipping the # language -declaration completely. For example the following feature-works when it shouldn't.
# language: fi
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario Outline: Add two numbers
Given I have entered <input_1> into the calculator
And I have entered <input_2> into the calculator
When I press <button>
hen the result should be <output> on the screen
Examples:
| input_1 | input_2 | button | output |
| 20 | 30 | add | 50 |
| 2 | 5 | add | 7 |
| 0 | 40 | add | 40 |
Any ideas how could I make the Cucumber and Cuke4Nuke to notice the language -declaration? My Ruby is of version 1.86 and Cucumber is v. 0.9.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在任何内容进入 Cuke4Nuke 之前,这看起来像是 Cucumber/Gherkin 方面的错误。语言声明仅在 Cucumber 端处理。当步骤详细信息到达 Cuke4Nuke 时,关键字就消失了。您可能会在 cukes 群组 (groups.google.com/group/cukes/) 上获得更多帮助;我认为 Cucumber 开发人员在那里更活跃。
也就是说,Cuke4Nuke 尚不处理语言。您仍然必须在步骤定义上使用 Give/When/Then 属性,而不是 Gitt/Når/Så,并且步骤定义参数的字符串转换不会使用正确的区域性,这可能会给您带来问题。下一个 Cuke4Nuke 版本将包括语言支持。 i18n 属性已经在最新的源代码中,我正在研究文化方面的内容。
This looks like an error on the Cucumber/Gherkin side, before anything goes to Cuke4Nuke. The language declaration is only handled on the Cucumber side. By the time the step details get to Cuke4Nuke, the keywords are gone. You're likely to get more help on the cukes group (groups.google.com/group/cukes/); I think the Cucumber developers are more active there.
That said, Cuke4Nuke doesn't handle languages yet. You'd still have to use Given/When/Then attributes on your step definitions rather than Gitt/Når/Så, and string conversions for step definition arguments won't use the correct culture, which may cause you problems. The next Cuke4Nuke release will include language support. The i18n attributes are already in the latest source, and I'm working on the culture stuff.