2014-01-28 49 views
0

問題可能聽起來很新手。但在這裏,我每次嘗試在我的黃瓜功能文件中編寫iphone5時,它會對參數5進行參數化。我不希望發生這種情況,並希望它將iphone5視爲字符串。在黃瓜功能文件中指定一個數字

在我的特徵文件中的行導致這就是: 然後上傳iPhone5的圖像「xxxx.png」

然後得到以下步驟定義:

@And("^then upload iPhone(\\d+) image \"([^\"]*)\"$") 
public void then_upload_iPhone_image(int arg1, String arg2) throws Throwable { 
    // Express the Regexp above with the code you wish you had 
    throw new PendingException(); 
} 

回答

1

只需卸下正則表達式的數字和刪除該方法的參數。

@Given("^I upload to iphone5$") 
public void I_upload_to_iphone() throws Throwable { 
    // Express the Regexp above with the code you wish you had 
    throw new PendingException(); 
} 
你的情況

@And("^then upload iPhone5 image \"([^\"]*)\"$") 
public void then_upload_iPhone_image(String arg2) throws Throwable { 
    // Express the Regexp above with the code you wish you had 
    throw new PendingException(); 
} 
相關問題