Live unit testing with sbt

When I look at Visual Studio, there is one feature I would like to have in IntelliJ — live unit testing. In fact, I have to be more specific. If it were added to IntelliJ, it would probably work only with Java. I need such a feature in sbt. I need it to test Scala code.

Fortunately, there is something similar available. It does not have an excellent UX. You cannot record a 10 minutes long video tutorial about it, because it is too simple. Definitely, it is not perfect. However, in my opinion, it is good enough and gets the job done.

To get live unit testing in sbt, open a terminal window, navigate to your project directory, run sbt in interactive mode, and then run this command:


It periodically looks for changes in your code and runs the relevant tests.

You can even run it in the “sbt-shell” window in IntelliJ and use the window “Floating mode” to make it always visible on the side of the screen.

Live unit testing with sbt with a floating sbt-shell window
Live unit testing with sbt with a floating sbt-shell window

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.

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

Subscribe to the newsletter and get access to my free email course on building trustworthy data pipelines.