Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sbt testOnly not working

I'm trying to run a single test class in a Java Play project but fails misserably.

If I try to run

testOnly my.app.TheClassTest

from within sbt (as described in JavaTest and sbt test) I get this result:

[info] Passed: Total 0, Failed 0, Errors 0, Passed 0

[info] No tests to run for test:testOnly

My only suspicion is that the message "No tests to run for test:testOnly" does not include the name of the class I try to test.

If I try to run it from command line

sbt testOnly "my.app.TheClassTest"

It runs all the tests and then I get the following error:

[error] Expected ID character

[error] Not a valid command: net (similar: set, new, inspect)

[error] Expected project ID

[error] Expected configuration

[error] Expected ':' (if selecting a configuration)

[error] Expected key

[error] Not a valid key: my (similar: test, name, assets)

[error] my.app.TheClassTest

I've tried all kinds of variations such as testOnly TheClassTest, test-only my.app.TheClassTest, test:testOnly etc. with only minor variations in result. Using testOnly within sbt I can write whatever I feel like and still always get the same response.

Running all tests work fine.

Is there at least a way to get a more

like image 619
oht Avatar asked Jun 05 '18 13:06

oht


People also ask

What does SBT clean do?

clean – delete all generated sources, compiled artifacts, intermediate products, and generally all build-produced files. reload – reload the build, to take into account changes to the sbt plugin and its transitive dependencies.


1 Answers

For sbt 1.5.2, this worked:

sbt "project dbm; testOnly my.package.TestClass"

like image 65
Edward G Avatar answered Dec 29 '22 00:12

Edward G