Defining custom test configurations in sbt

I need to define a custom test configuration in sbt that runs the test, but with some additional settings. I look around trying to figure out how to do this, but I can't figure out what is right.

What I would like to do is something like this: > testthat will run a regular test task and > pipelinetestthat will be exactly the same as test, only with (javaOptions += "-Dpipeline.run=run".

I figured out how to set javaOptions for a test, for example: javaOptions in test += "-Dpipeline.run=run"so I would like to do this:javaOptions in pipelinetest += "-Dpipeline.run=run"

How can I determine pipelinetestto achieve this? Does this need to be a new challenge? Or it will be installation in test. I am very new to sbt and quite confused about this at the moment, and reading the documentation did not help, so any help would be greatly appreciated.

+5
source share
1 answer

I have only a partial answer, but I thought this might be useful information. I was just trying to do something similar to build sbt in Spark - I wanted to have a way to run tests using a debugger. Mark Harra's comment pointed me in the right direction. the change I made was :

lazy val TestDebug = config("testDebug") extend(Test) ... baseProject .configs(TestDebug) .settings(inConfig(TestDebug)(Defaults.testTasks): _*) .settings(Seq( javaOptions in TestDebug ++= "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" .split(" ").toSeq))

test, testOnly .. , testDebug:testOnly ..., , . (, testDebug:test .. , , .)

, , , , inConfig(TestDebug)(Defaults.testTasks) inConfig(TestDebug)(Defaults.testSettings).

, () () b/c, POM, , .

, sbt , , , , - . , , , .

0

All Articles