开发者

Cuke4nuke: Is it missing the support for different languages?

开发者 https://www.devze.com 2023-01-17 17:29 出处:网络
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 C

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: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:in scan' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/gherkin-2.2.4-x86-mingw32/lib/gherkin/parser/parser.rb:31:in parse' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/feature_file.rb:35:in parse' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:28:in load' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:26:in each' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:26:in load' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime/features_loader.rb:14:in features' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime.rb:179:in features' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/runtime.rb:32:in run!' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/cli/main.rb:54:in execute!' C:/_work/tools/Ruby186/lib/ruby/gems/1.8/gems/cucumber-0.9.0/bin/../lib/cucumber/cli/main.rb:29:in execute' 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'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 nu开发者_Go百科mbers
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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消