簡體   English   中英

未使用黃瓜方案大綱示例的參數

[英]Cucumber scenario outline examples' parameters not being used

我有一個方案大綱

Scenario Outline:
  When I type "<text>" in the search bar

有例子

Examples:
  |text|
  |laptop|
  |camera|

及其步驟定義

@When("^I type \"([^\"]*)\" in the search bar$")
public void iTypeInTheSearchBar(String text){
    try {
        homepage.searchForItem(text);
    }
    catch (NullPointerException e){
        logger.debug("Exception",e);
    }
}

但是,當我運行測試時,在每次迭代中,都無需輸入示例中定義的參數(筆記本電腦,相機...),而是從字面上一直在搜索欄中輸入“文本”。 我還嘗試過如下重寫方案大綱和示例

Scenario Outline:
  When I type <text> in the search bar

Examples:
  |text|
  |"laptop"|
  |"camera"|

但是仍然沒有運氣。 我以前從未遇到過這個問題,有人知道我在做什么錯嗎? 以下是我正在使用的庫(JDK是1.8)

dependencies {
compile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5'
// https://mvnrepository.com/artifact/info.cukes/cucumber-java
compile group: 'info.cukes', name: 'cucumber-java8', version: '1.2.5'
}

我正在通過Junit課程進行測驗

@RunWith(Cucumber.class)
@CucumberOptions(features="src/test/resources",glue=  "StepDefinitions",plugin = "pretty")

嘗試在下面使用,參數不帶引號。 方案大綱:當我在搜索欄中鍵入

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM