Using a simple build tool for tests

I am trying to get sbt to compile and create some tests. I told him to add tests to the test path so that they are recompiled along with the tests, but I cannot figure out how to write an action so that I can run them. Can I call classes from the project definition class or even from the command line?

+3
source share
2 answers

Yes it is.

If you want to run them in the same virtual machine, SBT will start, and then write in the project definition file similar to the following:

  lazy val benchmark = task {
    // code to run benchmarks
    None // Some("will return an error message")
  }

benchmark SBT . , , , , SBT, runTask, , - . :

 def runTask(mainClass: => Option[String], classpath: PathFinder, options: String*): Task

:

  lazy val benchmark = task { args =>
    runTask(Some("whatever.your.mainclass.is"), testClasspath, args)
  }

jvm, . SBT , ! . , java -jar path-to-artifact.jar, . :

"java -jar path-to-artifact.jar" !

SBT. , .

reload .

+4

, , "" SBT?

"test-only" main "run" "exec" (. http://code.google.com/p/simple-build-tool/wiki/RunningSbt ).

+2

Source: https://habr.com/ru/post/1770303/


All Articles