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
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.
For sbt 1.5.2, this worked:
sbt "project dbm; testOnly my.package.TestClass"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With