title: How to setup multiples step definitions for Cucumber Java features on Intellij
body: <p>I am trying to create several step definitions classes for several features. It is my project structure:</p>
  
  <pre><code>.
  ├── CucumberPOC.iml
  └── src
      └── test
          ├── CucumberRunner.java
          └── features
              ├── CheeseStepDefinition.java
              ├── StepDefinition.java
              ├── cheese.feature
              └── myfeature.feature
  </code></pre>
  
  <p>It is the CucumberRunner.java class:</p>
  
  <pre><code>package test;
  
  import cucumber.api.CucumberOptions;
  import cucumber.api.junit.Cucumber;
  import org.junit.runner.RunWith;
  
  @RunWith(Cucumber.class)
  @CucumberOptions(
          format = {" pretty", "json:target/cucumber.js"},
          features = { "src/test/" }
  )
  public class CucumberRunner {
  }
  </code></pre>
  
  <p>There are two to step definitions classes. When I run cheese.feature I got the error:</p>
  
  <pre><code>/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java ...
  Testing started at 9:26 AM ...
  
  Undefined step: Given  I go to google
  
  Undefined step: When  I ask for cheese
  
  Undefined step: Then  I should see many offers
  
  
  1 scenario (0 passed)
  
  
  3 steps (0 passed)
  
  
  1 Scenarios (1 undefined)
  3 Steps (3 undefined)
  0m0.000s
  
  
  You can implement missing steps with the snippets below:
  
  @Given("^I go to google$")
  public void I_go_to_google() throws Throwable {
      // Express the Regexp above with the code you wish you had
      throw new PendingException();
  }
  
  @When("^I ask for cheese$")
  public void I_ask_for_cheese() throws Throwable {
      // Express the Regexp above with the code you wish you had
      throw new PendingException();
  }
  
  @Then("^I should see many offers$")
  public void I_should_see_many_offers() throws Throwable {
      // Express the Regexp above with the code you wish you had
      throw new PendingException();
  }
  
  
  Process finished with exit code 0
  </code></pre>
  
  <p>But the steps are defined in CheeseStepDefinition:</p>
  
  <pre><code>package test.features;
  
  import cucumber.api.java.en.Given;
  import cucumber.api.java.en.Then;
  import cucumber.api.java.en.When;
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.htmlunit.HtmlUnitDriver;
  
  public class CheeseStepDefinition {
  
      WebDriver driver = null;
  
      @Given("^I go to google$")
      public void I_go_to_google() throws Throwable {
          driver = new HtmlUnitDriver();
          driver.get("http://www.google.com");
      }
  
      @When("^I ask for cheese$")
      public void I_ask_for_cheese() throws Throwable {
          WebElement search = driver.findElement(By.name("q"));
          search.sendKeys("cheese");
          search.submit();
      }
  
      @Then("^I should see many offers$")
      public void I_should_see_many_offers() throws Throwable {
          System.out.println(driver.getTitle());
          driver.close();
      }
  }
  </code></pre>
  
  <p>So I don't know why the cucumber java doesn't see it step definition. Do I need to do any other configuration? I run the myfeature.feature and everything is ok.</p>
  
  <h3>Tools Info.</h3>
  
  <p>I am using this jars:</p>
  
  <pre><code>.
  ├── cucumber-core-1.1.5.jar
  ├── cucumber-html-0.2.3.jar
  ├── cucumber-java-1.1.5.jar
  ├── cucumber-junit-1.1.5.jar
  ├── cucumber-jvm-deps-1.0.5.jar
  ├── gherkin-2.12.1.jar
  ├── hamcrest-all-1.3.jar
  ├── jsoup-1.8.3.jar
  ├── junit-4.12.jar
  └── selenium-server-standalone-2.47.1.jar
  </code></pre>
  
  <p>The IDE is Intellij 14.1 Community, on Mac. </p>
  
  <p>If you need any other information, let me know. </p>