当我用Cucumber运行我的第一个测试文件时,我得到了这个例外如何解决这个问题?
Exception in thread "main" cucumber.runtime.CucumberException: Error parsing feature file D:/intalled/CucumberConcepts/src/cucumber/features/myfeature.feature
at cucumber.runtime.FeatureBuilder.parse(FeatureBuilder.java:123)
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:52)
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:33)
at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:143)
at cucumber.runtime.Runtime.run(Runtime.java:107)
at cucumber.api.cli.Main.run(Main.java:26)
at cucumber.api.cli.Main.main(Main.java:16)
引起:gherkin.lexer.LexingError:第1行的Lexing错误:'功能:我的框架工作的概念证明
Feature : Proof of concept that my framework works
Scenario Outline : My first Test
Given this is my first test
When This is my second step
Then This is the final step
你需要做几件事:A)删除Feature :
和Scenario Outline :
关键字中的空格;和B)将场景大纲更改为场景(或添加缺少的大纲示例)。
如果您运行此功能:
Feature: Proof of concept that my framework works
Scenario: My first Test
Given this is my first test
When This is my second step
Then This is the final step
然后,黄瓜将输出待完成的步骤定义:
You can implement step definitions for undefined steps with these snippets:
Given(/^this is my first test$/) do
pending # Write code here that turns the phrase above into concrete actions
end
When(/^This is my second step$/) do
pending # Write code here that turns the phrase above into concrete actions
end
Then(/^This is the final step$/) do
pending # Write code here that turns the phrase above into concrete actions
end
这是一个小黄瓜语法错误:关键字和冒号之间不能有空格。
实际=功能: 预期=特征:
实际=场景大纲: 预期=场景大纲:
场景大纲:将始终与示例一起使用,
现在何时使用场景大纲:何时使用场景:?
场景大纲:
当您必须使用多组数据测试同一屏幕时,可以使用此选项
场景:
当您必须使用一组数据或无数据测试一个方案时,将使用此方法
在你的情况下:
您正在测试没有数据集的功能。因此,您应该使用Scenario而不是Scenario Outline。
预期功能:
Feature: Proof of concept that my framework works
Scenario: My first Test
Given this is my first test
When This is my second step
Then This is the final step
只是因为错误的原因而不仅仅是orde提到的事情。
Feature: Proof of concept that my framework works
Scenario: My first Test
Given this is my first test
When This is my second step
THEN This is the final step
检查“Then”关键字是否应该是正确的语法方式的全部大写。这该死的确定会导致词汇错误。