IntelliJ IDEA 2017.2 Help


This feature is supported in the Ultimate edition only.

The following is only valid when Ruby Plugin is installed and enabled!

On this page:


IntelliJ IDEA helps you write tests using the MiniTest testing framework. MiniTest comes bundled with Ruby 1.9.x, but we suggest to use minitest, as a more up-to-date version.


Before you start, make sure that:

  • minitest is downloaded and installed on your computer.

    IntelliJ IDEA supports minitest versions higher than 3.1.0

  • minitest-reporters, version 0.5.0 or higher, is downloaded and installed on your computer. This gem is required for integration with IntelliJ IDEA test runner.

    For minitest >= 5.0.0, minitest-reporters gem is not required.

  • For Windows, win32Console, version '1.3.0' is downloaded and installed.
  • The gems should be properly attached to your project. For example, if you use the Bundler for managing gems, the required gems should be added to the Gemfile of your project.

    For example, the Gemfile can contain the following code:

    group :test do if RUBY_PLATFORM =~ /(win32|w32)/ gem "win32console", '1.3.0' end gem "minitest" gem 'minitest-reporters', '>= 0.5.0' gem 'cucumber-rails' end
  • Depending on the version of minitest-reporters gem, one of the following code fragments is added to your tests (if you are working with a Rails application, it is better accomplished with test/test-helper.rb file):
    • Version 0.8.0 and higher
      require 'minitest/reporters' MiniTest::Reporters.use!
    • Older versions
      require 'minitest/reporters' MiniTest::Unit.runner = if ENV["RM_INFO"] || ENV["TEAMCITY_VERSION"] MiniTest::Unit.runner.reporters << elsif ENV['TM_PID'] MiniTest::Unit.runner.reporters << else MiniTest::Unit.runner.reporters << end

      The above code enables specific results reporter, which depends on the environment where tests have been launched: IntelliJ IDEA, TeamCity CI server, or TextMate text editor/ terminal. This approach is helpful, when you work in a mixed team that uses different IDEs, or text editors.

      It is important to execute this code at the test initialization, before running the tests.

Important note

As mentioned before, minitest-reporters gem is required for integration with IntelliJ IDEA for minitest version lower than 5.0.0.

However, this gem is still essential for the higher versions of minitest, if you want to see the test results in a tree view:

rm minitest1

rather than as plain list:

rm minitest2


It's important that the names of the minitest files match the following patterns:

*_test`.rb test_`*`.rb

The test case classes should have suffix Test:

FooTest < AcceptanceTest

This limitation is not related to MiniTest, but rather is imposed by IntelliJ IDEA's code insight.

Last modified: 29 November 2017

See Also