How to run a single test in SBT

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 watch programming live streams, check out my YouTube channel.
You can also follow me on Twitter: @mikulskibartosz

For business inquiries, send me a message on LinkedIn or Twitter.


Bartosz Mikulski
Bartosz Mikulski * data scientist / software engineer * conference speaker * organizer of School of A.I. meetups in Poznań * co-founder of Software Craftsmanship Poznan & Poznan Scala User Group