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:

~test

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
Older post

Monte Carlo simulation in Python

How to make business decisions using the Monte Carlo simulation?

Newer post

Count unique elements of an infinite stream of objects

HyperLogLog - probabilistic counting algorithm