title: Cucumber Undefined Step, Though Defined Using IntelliJ
body: <p>I'm trying to run a .feature file to test a simple RESTEasy web application: <a href="https://github.com/dashorst/jaxrs-quickstart-resteasy" rel="noreferrer">https://github.com/dashorst/jaxrs-quickstart-resteasy</a>. </p>
  
  <p>However, the IntelliJ keeps saying that:</p>
  
  <pre><code>Undefined step: Given  I am an invalid username
  
  Undefined step: When  I perform a hello request with null username
  
  Undefined step: Then  I receive a http response code of 400
  
  Undefined step: When  I perform a hello request with empty username
  
  Undefined step: Then  I receive a http response code of 400
  
  You can implement missing steps with the snippets below:
  
  @Given("^I am an invalid username$")
  public void I_am_an_invalid_username() throws Throwable {
      // Express the Regexp above with the code you wish you had
      throw new PendingException();
  }
  // similar results...
  </code></pre>
  
  <p>Below is my <code>hello.feature</code> file:</p>
  
  <pre><code>Feature: hello
  
  #-------------------------------------
  #next block is got the GET entry point
  #-------------------------------------
  
  #verify that with malformed input hello fails 
  Scenario: invalid username should fail
  Given I am an invalid username
  When I perform a hello request with null username
  Then I receive a http response code of 400
  When I perform a hello request with empty username
  Then I receive a http response code of 400
  
  #verify that you can get correct hello response with valid username. This is the 'everything works fine' path.
  Scenario: User can get correct hello response with valid username
  Given I am a valid username
  When I perform a hello request with valid username
  Then I receive a http response code of 200
  
  import cucumber.annotation.en.Given;
  import cucumber.annotation.en.Then;
  import cucumber.annotation.en.When;
  import cucumber.runtime.PendingException;
  </code></pre>
  
  <p>I used IntelliJ option "generate steps" and got the <code>MyStepdefs</code> file.</p>
  
  <pre><code>/**
   * Created by z on 5/21/17.
   */
  public class MyStepdefs {
      @Given("^I am a valid username$")
      public void iAmAValidUsername() throws Throwable {
          // Write code here that turns the phrase above into concrete actions
          throw new PendingException();
      }
  
      @Given("^I am an invalid username$")
      public void iAmAnInvalidUsername() throws Throwable {
          // Write code here that turns the phrase above into concrete actions
          throw new PendingException();
      }
  
      @When("^I perform a hello request with null username$")
      public void iPerformAHelloRequestWithNullUsername() throws Throwable {
          // Write code here that turns the phrase above into concrete actions
          throw new PendingException();
      }
  
      @Then("^I receive a http response code of (\\d+)$")
      public void iReceiveAHttpResponseCodeOf(int arg0) throws Throwable {
          // Write code here that turns the phrase above into concrete actions
          throw new PendingException();
      }
  
      @When("^I perform a hello request with empty username$")
      public void iPerformAHelloRequestWithEmptyUsername() throws Throwable {
          // Write code here that turns the phrase above into concrete actions
          throw new PendingException();
      }
  
      @When("^I perform a hello request with valid username$")
      public void iPerformAHelloRequestWithValidUsername() throws Throwable {
          // Write code here that turns the phrase above into concrete actions
          throw new PendingException();
      }
  }
  </code></pre>
  
  <p>I had tried to specify glue path for each scenario, but it doesn't work. I'm not sure what went run. Thanks for any advice!</p>
  
  <p>I have looked into several existing questions but none of them helps: </p>
  
  <p><a href="https://stackoverflow.com/questions/4022990/cucumber-undefined-step-although-step-should-be-defined">Cucumber: undefined step, although step should be defined</a></p>
  
  <p><a href="https://stackoverflow.com/questions/21753267/cucumber-jvm-undefined-step">Cucumber JVM undefined step</a></p>
  
  <p>This is my project structure: 
  <a href="https://i.stack.imgur.com/dPDnU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dPDnU.png" alt="enter image description here"></a></p>