【发布时间】:2010-09-28 11:15:36
【问题描述】:
我使用的是 0.3.1 版的 Cuke4Nuke,但在使用英语以外的其他语言定义我的功能文件时遇到问题。谷歌搜索没有带来任何解决方案,所以我的问题很简单: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 了解更多信息。 (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:in
scan' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/gherkin-2.2.4-x86-mingw32/lib/gherkin/lexer/i18n_lexer.rb:22:inscan' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/gherkin-2.2.4-x86-mingw32/lib/gherkin/parser/parser.rb:31:inparse' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/feature_file.rb:35:inparse' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:28:inload' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:26:ineach' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:26:inload' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:14:infeatures' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime.rb:179:infeatures' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime.rb:32:inrun! C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/cli/main.rb:54:inexecute!' 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 '
似乎 cuke4nuke(或 Cucumber?)完全跳过了 # 语言声明。例如,以下功能在不应该的情况下起作用。
# 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 版。
【问题讨论】:
-
您了解 SpecFlow (www.specflow.org)。它使用与 Cucumber 相同的 Gherkin Parser,但在 .NET 上本机运行。 (免责声明:我是 SpecFlow 的提交者。)
-
感谢您的评论。我最终搬到了 SpecFlow,从那以后我一直在愉快地使用它。