Infinitest for IntelliJ Documentation
This is the documentation for Infinitest for Intellij. (Looking for the Infinitest for Eclipse? Click here.)
Get Started
Installation
Install the Infinitest plugin from the plugin manager:
- Go to “File > Settings”
- Select Plugins node in the settings tree
- Click “Browse repositories…” button
- In the “Browse Repositories” dialog Type “Infinitest”
- Click “install”
- Restart IntelliJ
Note: You can alternatively download the jar from Jetbrains Plugin Repository and then install it from disk.
Enabling Infinitest
Since version 5.4 Infinitest is enabled automatically, there’s no facet anymore.
To enable the Infinitest facet for your project you need to add the Infinitest facet to your project modules.
To do so:
- Go to “File > Project Structure”
- Add the the Infinitest Facet to your test modules by:
- clicking a module
- Click the green “+” button
- Select “Infinitest”
How it works
Infinitest inspects your classes to find tests.
Every time you change some code and IntelliJ recompiles it infinitest computes which tests need to be executed and runs them.
Infinitest detects changes on the .class files but by default, IntelliJ does not compile classes when saving code. So Infinitest will only detect changes and run test when building project (Ctrl+F9).
Alternatively you can configure IntelliJ to “Make project automatically” on save in “Settings->Compiler”. This way, your tests will be executed on save.
Viewing test results
The test failures are displayed:
- As Markers in the test files
- In the Infinitest Tool Window for each module.
Additionally the Tool Window allows to:
- Stop/start Infinitest.
- View the Infinitest logs.
- View the Console output of the tests.
- Disable tests of a module by right-clicking it
Configuring Infinitest
Filtering executed tests using infinitest.filters
By default Infinitest executes all Junit and TestNG tests.
You can configure which tests it should execute by adding an “infinitest.filters” file in the .idea/modules directory.
See Filtering Syntax for more info on how to filter tests.
When changing “infinitest.filters” you need to do “Build>Rebuild Project” to force infinitest to reinitialize.
Configuring JVM options
JVM option can be configured by defining a infinitest.args file.
Common Problems
Infinitest isn’t running my tests
You have to compile the file after you change it. By default, IntelliJ does not compile classes automatically like Eclipse.
Also, check the “infinitest.filters” file to make sure your tests are not ignored.