当前位置: 首页 > 知识库问答 >
问题:

Cucumber:Cucumber5.x.x中没有执行多个场景大纲:可能有bug?

车子平
2023-03-14

在我的特性文件中,我有两个场景大纲,以及它们自己的示例部分。我以不同的方式标记了每个场景大纲(@test1@test2)。当我尝试用Cucumber 5.6.0运行这两个场景大纲时,我得到以下错误:-

0 Scenarios
0 Steps
0m0.001s

测试中的功能文件:-

@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测试运行程序类:-

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 {

}

共有1个答案

东门航
2023-03-14

听起来像是V5中引入了一个bug。

但请尝试使用单个标记表达式。例如@test1或@tes2

 类似资料: