How to run a single test in SBT

Note to self. Maybe one day I will finally remember how to run a single test class in sbt. Currently, I must google that every time I need it.

When you want to run tests from a single test class using the command line (not from the sbt interactive mode), you probably write this:

1
sbt testOnly name.mikulskibartosz.TestClass

This is wrong! It runs all of the tests.

The correct way of running a single test class looks like this:

1
sbt "testOnly name.mikulskibartosz.TestClass"

Please remember about the quotation.


Remember to share on social media!
If you like this text, please share it on Facebook/Twitter/LinkedIn/Reddit or other social media.

If you want to contact me, send me a message on LinkedIn or Twitter.

Would you like to have a call and talk? Please schedule a meeting using this link.


Bartosz Mikulski
Bartosz Mikulski * data/machine learning engineer * conference speaker * co-founder of Software Craft Poznan & Poznan Scala User Group


This website DOES NOT use cookies
but you may still see the cookies set earlier if you have already visited it.