2

According to the Infinitest User Guide, after installing the Infinitest plugin in IntelliJ IDEA, you're supposed to be able to right click your project and "choose facet, add Infinitest". However, there is no "facet" option in my project's context menu; I presume it may have to do with the fact that my project is a gradle project, though it does have the .idea project folder as well.

Other specifics about my project (that I don't think are related but could be possibly):

  • it is a multi-module gradle project, with one root project and 4 modules
  • it also has the Scala nature and scala gradle plugin.
  • It has both Junit4 and ScalaTest tests.
  • I'm using Intellij IDEA version 15
voxoid
  • 1,164
  • 1
  • 14
  • 31

2 Answers2

6

EDIT: Infinitest does work for gradle projects; see accepted answer. Below merely serves as an alternative using gradle itself (but Infinitest provides faster feedback on test passing/failing)


It appears that the Infinitest plug-in for IntelliJ does not work for gradle projects. Alternatively you can use the semi-new continuous mode of gradle itself for continuous testing:

  1. Create a run configuration for running the test task in gradle. The easiest way I know of is to find the test task in the Gradle view (View -> Tool Windows -> Gradle), expand your root project -> Tasks -> verification -> test (double click)
  2. Edit that run configuration to add the --continuous argument: From the run configurations dropdown select "Edit Configurations...", then add --continuous to the Script parameters field.
  3. Run the configuration. This time, after building and running tests the first time, Gradle's console output will say Waiting for changes to input files of tasks... . Once you save changes to a file (you may have to press Ctrl+S), it will run the tests again.

It's not nearly as nice as say NCrunch for .NET -- it can't run only affected tests; it has to run all of them, which creates a slower "continuousness". But it does the job. Also, Gradle 2.11 (the newest at the time of writing this) admits "Continuous build is an incubating feature", which gives us hope for improvements in the future.

voxoid
  • 1,164
  • 1
  • 14
  • 31
3

To add a facet, you have to go in the module settings (⌘ ↓ on OSX, or "Open Module Settings" in the contextual menu).

In there, under project settings there is a "Facet" entry, in which you can add an Infinitest facet.

After that it will appear as a tab at the bottom of the UI.

cf. the IntelliJ documentation.

Xavier
  • 1,536
  • 2
  • 16
  • 29
  • Much appreciated! I googled for adding facets in intellij idea 15, but apparently didn't search deep enough. – voxoid Mar 10 '16 at 13:44
  • While this enables Infinitest on the project, it does not make Infinitest rerun the tests whenever a source file is changed, like continual testing is supposed to work. See [this stackoverflow question](http://stackoverflow.com/questions/35948582/infinitest-not-refreshing-in-intellij-idea-15-on-gradle-project) – voxoid Mar 14 '16 at 12:49
  • F4 on Windows for "Open Module Settings" – voxoid Mar 21 '16 at 13:39