Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT run single test class in submodule

I have a multi module project with moduleA, moduleB, and moduleC. I want to run my class com.helpme.run.MyTest from moduleB.

My guess is the sbt command should look like:

sbt "project moduleA" --mainClass com.helpme.run.MyTest test

But no luck. Please help!! Thanks!

like image 278
Dr.Knowitall Avatar asked Oct 18 '25 11:10

Dr.Knowitall


1 Answers

First of all you can run a test by using testOnly

$ sbt testOnly MyTest

But if your project is a multi-project sbt project and you have the same test class with the same name in more than one project you can navigate between projects by project command and then run the test

$ sbt
> project moduleA
> testOnly MyTest

Note that you have to first run sbt and then run the rest of commands from the sbt shell.

like image 185
Nader Ghanbari Avatar answered Oct 21 '25 02:10

Nader Ghanbari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!