Dr.Knowitall
Dr.Knowitall

Reputation: 10498

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!

Upvotes: 4

Views: 3281

Answers (2)

fhuertas
fhuertas

Reputation: 5483

Depends on your project configuration testOnly couldn't work

You can try this command too:

sbt "project myProject" "testOnly com.this.is.my.Test"

Upvotes: 1

Nader Ghanbari
Nader Ghanbari

Reputation: 4300

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.

Upvotes: 7

Related Questions