对于整数,您可以执行以下操作:@When("^When user is on the error \"(\\d+)\" page$")public void When_user_is_on_the_error_page(int errorNum) throws Throwable {...}或者特征:场景:一些 cukes鉴于我的肚子里有 48 个 cukes @Given("I have {int} cukes in my belly") public void i_have_n_cukes_in_my_belly(int cukes) { System.out.format("Cukes: %n\n", cukes); }}来源:https://cucumber.io/docs/cucumber/step-definitions/如何在黄瓜场景中写数字对于字符串特征:搜索“班加罗尔”和“孟买”之间的单程航班时@When("^search for one-way flights between \"([^\"]*)\" and \"([^\"]*)\"$")public void search_for_one_way_flights_between_source_and_destination(String source, String destination) throws Throwable { .......}