2014-03-12 47 views
1

我有以下情形的輪廓黃瓜不讀場景輪廓數據

Background: 
    Given customer is in hot or not page 

Scenario Outline: Hot article 
    And customer enters <name> 
    And submits 
    And customer clicks thumbs up 
    Then ensure the TBD 

Examples: 
    | name | 
    | Elliot | 
    | Florian | 

並按照分步實施 -

@And("customer enters <name>") 
public void customer_enters_name(String name) throws Throwable { 
    // Express the Regexp above with the code you wish you had 
    Thread.sleep(10000); 
} 

但是,當我執行測試,然後我得到下面的錯誤 -

您可以使用以下代碼段實施缺失步驟:

@Given("^customer enters Elliot$") 
public void customer_enters_Elliot() throws Throwable { 
    // Express the Regexp above with the code you wish you had 
    throw new PendingException(); 
} 

@Given("^customer enters Florian$") 
public void customer_enters_Florian() throws Throwable { 
    // Express the Regexp above with the code you wish you had 
    throw new PendingException(); 
} 

我執行測試步驟是否錯誤?

+0

嘗試使用「」(用引號括起)而不是 Bala

+0

這個工作,你能標記你的評論作爲答案,我會接受它:) – Tarun

回答

1

而不是

Scenario Outline: ... 
    And customer enters <name> 
    ... 

做到這一點(注意雙引號)

Scenario Outline: ... 
    And customer enters "<name>" 
    ... 
0

我想補充,當亞軍類,我們把一步錯包出現同樣的錯誤類

@CucumberOptions(glue = {"com.wrongpackage.step"}) 
public class TestRunner{ 

} 

步驟類應存在,包應該是正確的。