Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run tests on every code change in IntelliJ IDEA from Scala sbt project?

I have a new Scala/sbt project set up in IntelliJ IDEA with ScalaTest and jUnit interface successfully installed as dependencies. I have one test that passes when I hit run or debug.

My problem is that it doesn't rerun if I change something. I have to hit run or debug again and then it runs and gives the expected response.

How do I set up IntelliJ IDEA (with or without sbt) to run all tests every time the code changes? Is it possible to run the tests related to the files that were changed only?

like image 864
Mark Avatar asked Jun 17 '14 21:06

Mark


People also ask

How do I run a test in IntelliJ Scala?

Open the test in the editor, press Ctrl+Shift+F10 or right-click on the test class and from the context menu select Run 'test name'. IntelliJ IDEA creates a run/debug configuration for the test automatically, but if you want to edit settings in your configuration, click Run | Edit Configurations on the main menu.


1 Answers

As answered in comment by Boris the Spider you can run

> ~test

from sbt shell. Hopefully sbt and IntelliJ can integrate better via sbt server, but I don't think it's currently possible.

like image 133
Eugene Yokota Avatar answered Oct 26 '22 06:10

Eugene Yokota