Toggle Test

A few years back, I was working with a great team of Java developers who introduced me to IntelliJ. (Thanks!) The team used to even have a plugin, tailored to our coding practices. One indispensible feature was the ‘Toggle Test’, to flick between production code and the corresponding unit test.

That feature has long since been incorporated into IDEA, but has been sadly absent for Scala users. But as of tomorrow, the wait is over! You can use CTRL-SHIFT-T to generate tests, or  to navigate between a test and its subject.

Creating a Test

CTRL-SHIFT-T on the production class, Create New Test…

Choose Language = Scala, and a test framework of your choice.


Navigating between Test and Subject


Currently we only create the empty test class: you can’t generate test methods based on a selection of methods.