在我的功能文件中,我有两个方案大纲,以及各自的示例部分。我给这些方案大纲中的每个标记了不同的名称(@test1
,@test2
)。当我尝试使用Cucumber 5.6.0运行两个方案大纲时,出现以下错误:-
0 Scenarios
0 Steps
0m0.001s
Cucumber 5.6.0一次仅成功执行一个方案大纲。我用黄瓜5.0.0得到了相同的结果
但是,当我降级到Cucumber 4.8.1时,两个方案大纲都已成功执行。但是,当我使用Cucumber 4.8.1和JUnit Test Runner v 4.13运行它们时,方案大纲不起作用。
请在下面查看我正在使用的Feature文件和JUnit Test Runner类
正在测试的功能文件:-
@GoogleMapPageObjectFactory
Feature: GoogleMapPageObjectFactory
Background: setUpGoogleMapPageObjectFactoryTest
Given ChromeDriver is available for GoogleMap Page
And GoogleMap Page is opened
And all GoogleMap page elements are initialised
@test1
Scenario Outline: captureScreenShotatStartGoogleMap
When I capture screenshot on GoogleMap page to be stored at "<screenshotFilePathStart>"
Then an image should be stored in local drive path "<screenshotFilePathStart>"
Examples:
| screenshotFilePathStart |
| F:\\Users\\User\\eclipse-workspace\\maven-demo\\screenshots\\GoogleMapPageObjectFactoryTest-start.jpg |
@test2
Scenario Outline: typeAndVerifyAddressGoogleMap
When I type the "<searchAddress>" on GoogleMap Page
Then I verify the section header contains "<searchAddress>" on GoogleMap Page
Examples:
| searchAddress |
| Harvard Business School, Boston, MA 02163, United States |
@test3
Scenario: phnuminlinePopUpGoogleMap
When I type the "+91 998877223" on GoogleMap Page
Then I verify the inline popup window contains "+91 998877223" on GoogleMap Page
JUnit Test Runner类:-
package com.selenium.cucumber.junit.testrunner;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(tags={"@test1","@test2"},
features= {"src/main/resources/com/selenium/cucumber/features/GoogleMapPageObjectFactory.feature"},
glue= {"com.selenium.cucumber.stepdef"}
)
public class GoogleMapPageObjectFactoryTestRunner {
}
v5中引入了类似bug的声音。
但是请尝试使用单个标记表达式。例如@test1 or @tes2
。