How to execute tests outside the ".idea" directory

I am doing a bit of BDD with cucumber, scala and IntelliJ.  All seems to work OK (other than issues with Apache Spark, detailed in a different thread) BUT...

There's a problem when cucumber looks for the feature files.  Here it uses a path, relative to the working directory when "sbt test" is run.  Problem is that this doesn't work when you run the tests under IntelliJ, as the working directory is set to something weird under the .idea folder.

 
// THIS ONE WORKS IN INTELLIJ BUT NOT WITH "SBT TEST"
@RunWith(classOf[Cucumber])
@Options(
  features = Array("../../src/test/resources/features"), // <--- This Path
  
glue = Array(""), // You could specify a package name here
  
format = Array("pretty", "html:target/cucumber-report")
)
class RunCucumberIntelliJ {
}

// THIS ONE WORKS WITH "SBT TEST" BUT NOT IN INTELLIJ
@RunWith
(classOf[Cucumber])
@Options(
  features = Array("src/test/resources/features"), // <--- This Path
  
glue = Array(""), // You could specify a package name here
  
format = Array("pretty", "html:target/cucumber-report")
)
class RunCucumberCommandLineSbt {
}



Is there a way I can...

A) Stop idea building/running tests under ".idea" - making it build and execute tests in the project folder

B) Use some technique to specify the location of my feature files that'll work with IntelliJ and sbt without me having to change the constant!

Thanks,

Dan

0

Please sign in to leave a comment.