簡體   English   中英

在黃瓜步驟定義上傳遞多個參數

[英]Passing multiple arguments on Cucumber step definition

我有這樣的黃瓜步驟

Given I am on (Similar Article Alerts|Search Alerts|Journal Alerts) page

我對此有一個步驟定義

  @Given("^I am on \"([^\"]*)\" page$")
   public void iAmOnSimilar_X_Page(String pageName) throws Throwable {
  // Write code here that turns the phrase above into concrete actions
        throw new PendingException();
   }

但我得到未定義的步驟參考。 有人可以幫我嗎?

您必須轉義括號\\(\\)而不是雙引號,因為它們不在示例數據中。

在否定字符類匹配中,不包含右括號[^)]+

^I am on \\(([^)]*)\\) page$

在Java中:

String regex = "^I am on \\(([^)]*)\\) page$";

暫無
暫無

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

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