Scala / SBT / JUnit / Cucumber classpath problems?

I've recently downloaded Intellij 14.1.4 and installed the scala and cucumber for scala plugins.

I was following this tutorial (though using more recent dependency versions, as attached). i.e., create scala/sbt project, add dependencies (as attached) create test class (attached) to run cucumber, add HelloWorld.feature (attached), run test class... fails.

When attempting to run the JUnit test class from Intellij, it fails because for some reason the ".idea" folder is on the classpath at runtime, even though it's not marked as a source/resource directory.

Why might this be happening? Running the sbt test target (from the terminal) works fine, but obviously running a JUnit class works differently from within Intellij.

The stacktrace is as follows:
java.lang.IllegalArgumentException: Not a file or directory: ~/IdeaProjects/scala-cuke-test/.idea/modules/src/test/resources/features
 at cucumber.runtime.model.CucumberFeature.loadFromFeaturePath(
 at cucumber.runtime.model.CucumberFeature.load(
 at cucumber.runtime.model.CucumberFeature.load(
 at cucumber.runtime.RuntimeOptions.cucumberFeatures(
 at cucumber.api.junit.Cucumber.<init>(
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
 at java.lang.reflect.Constructor.newInstance(
 at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(
 at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(
 at org.junit.internal.requests.ClassRequest.getRunner(
 at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(
 at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(
 at com.intellij.rt.execution.junit.JUnitStarter.main(
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(
 at com.intellij.rt.execution.application.AppMain.main(

Comment actions Permalink

upload of HelloWorld.feature file seems to fail. Well it doesn't matter too much, something simple like:

Feature: Hello World

  As a tester,

  I would like to utilize cucumber,

  So that I can create BDD style selenium-webdriver tests.


  Scenario: Google search, using selenium

    Given I have navigated to google

    When I search for "selenium"

    Then the page title should be selenium - Google Search
Comment actions Permalink

You need to change working directory in your JUnit run configurations. It seems there is a bug and $MODULE_DIR$ is replaced with wrong directory. You can use $PROJECT_DIR$ or explicit path as a workaround.

Comment actions Permalink

Thanks Nikolay. That worked. Is the MODULE_DIR bug known/reported?

Comment actions Permalink

Yes, it is known. But it seems that it is not of a high priority:


Please sign in to leave a comment.