Cuke4nuke:是否缺少对不同语言的支持?

发布于 2024-09-25 05:17:15 字数 3268 浏览 2 评论 0原文

我正在使用 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: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 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水波映月 2024-10-02 05:17:15

在任何内容进入 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文