为什么我收到以下错误:“required(..)+ loop在输入Scenario中的任何内容都不匹配:”在我的功能文件中的Background部分之后?

时间:2017-12-29 05:42:14

标签: cucumber gherkin karate

当我没有“背景:”部分时,功能文件中不会出现错误。但是当我在功能文件中添加我的场景上方的背景部分时,我在第一个场景之前在eclipse IDE中收到此错误。我的功能文件如下:

功能:问候终点 背景: * baseUrl'https://jsonplaceholder.typicode.com/posts' 场景:默认问候语

Given url baseUrl
When method get
Then status 200
And print response

我附上了一张截图,以防万一可以帮助您提供帮助enter image description here

1 个答案:

答案 0 :(得分:1)

请进行此更改。我测试了这个,它工作正常。如果您使用了错误版本的Cucumber Eclipse插件,请参阅此处:https://github.com/intuit/karate/issues/90

确保您使用的是最新版本的空手道(截至今天为0.6.2)。

如果所有这些都失败了,请使用JUnit runner

Background: 
* def baseUrl = 'https://jsonplaceholder.typicode.com/posts' 

Scenario: Default greeting
    Given url baseUrl
    When method get
    Then status 200
    And print response