how define "i want" steps feature using java?
i have cucumber project setup this:
login.feature
feature: user login want test on "www.google.com" scenario: log in given logged out when send request "/login" response status should "200"
then have steps defined this:
steps.java
import cucumber.api.java.en.given; import cucumber.api.java.en.when; import cucumber.api.java.en.then; public class steps { @given("^i logged out$") public void i_am_logged_out() { //do stuff } @when("^i send request \"([^\"]*)\"$") public void i_send_a_get_request_to(string arg1) { //do stuff } @then("^the response status should \"([^\"]*)\"$") public void the_response_status_should_be(string arg1) { //do stuff } }
how define "i want" step in java using cucumber-jvm?
here's attempt, @when
not valid annotation.
@want("to test on \"([^\"]*)\"$") public void to_test_on(string arg1) { //do stuff }
the "i want test......." not in correct location considered valid step. cucumber considers description of feature , nothing it.. if want initial common steps across scenarios should add 'background'.
just add "@given" annotation instead in front of step.
background: @given want test on "www.google.com"
else run 1 scenario stick along other steps.
Comments
Post a Comment