如何使用java从我的功能中定义“我想要”步骤?
我的黄瓜项目设置如下:
登录功能
Feature: User Login
I want to test on "www.google.com"
Scenario: Successfully log in
Given I am logged out
When I send a GET request to "/login"
Then the response status should be "200"
然后我的步骤定义如下:
步骤.java
import cucumber.api.java.en.Given;
import cucumber.api.java.en.When;
import cucumber.api.java.en.Then;
public class Steps {
@Given("^I am logged out$")
public void i_am_logged_out() {
//do stuff
}
@When("^I send a GET request to \"([^\"]*)\"$")
public void i_send_a_GET_request_to(String arg1) {
//do stuff
}
@Then("^the response status should be \"([^\"]*)\"$")
public void the_response_status_should_be(String arg1) {
//do stuff
}
}
如何使用 cucumber-jvm 在 Java 中定义“我想要”步骤?
这是我的尝试,但@When
不是有效的注释。
@Want("to test on \"([^\"]*)\"$")
public void to_test_on(String arg1) {
//do stuff
}