RubyMine 2019.3 Help

Run and debug tests

Generally, RubyMine runs and debugs tests in the same way as other applications, by running the run/debug configurations you have created. When doing so, it passes the specified test classes or methods to the test runner.

In many cases, you can initiate a testing session from a context menu. For this purpose, the Run and Debug commands are provided in certain context menus. For example, these commands are available for a test class, directory, or a package in the Project Tool Window. They are also available for a test class or method you are currently working on in the editor.

If you run a test for which there is no permanent run/debug configuration, a temporary configuration is created. You can then save such a configuration using the Run/debug configuration dialog if you want to reuse it later.

The tests run in the background, so you can execute several tests at the same time.

Each running configuration gets its own tab in the Run tool window (the Test Results tab). One tab can aggregate several tests.

Note also that the commands shown in the context menu, are context-sensitive, that is the testing command that shows depends on the test runner and the place where this command is invoked.

Run or debug tests using a predefined configuration

To run/debug the test(s) using the already created run configuration, do one of the following:

  • Press Ctrl twice. In the invoked popup, start typing a name of the configuration, select it from the list and press Enter. To debug the selected configuration, hold down the Shift key when running tests.

  • Press Shift+Alt+F10, select the required configuration and press Enter. For debugging, use the Shift+Alt+F9 shortcut.

  • To run tests from the main toolbar:

    • Select the required run/debug configuration from the list on the main toolbar.

    • Click Run Run Shift+F10 or Debug Debug Shift+F9 on the right.

Run or debug tests using Rake tasks

To run or debug tests using a Run Rake tasks task, perform the following steps:

  1. From the main menu, select Tools | Run Rake Task Ctrl+Alt+R.

  2. In the invoked popup, start typing the name of a Rake task that runs tests, for example, rake test or rake spec:controllers.

  3. Depending on whether you want to run or debug tests, select the desired Rake task from the list and do one of the following:

    • Press Enter.

    • Hold down the Shift key (the dialog title will be changed to Debug) and pressEnter.

Run or debug tests from the Project view

To run or debug a test or multiple tests from the Project view, do the following:

  1. Right-click a specific test file or a directory containing the required tests, for example, test, spec, or features.

  2. From the context menu, select Run or Debug.

  3. From the submenu, select a command corresponding to the used testing framework. For example, this will be All tests in: <directory name> for Minitest or All specs in: <directory name> for RSpec.

    Run all tests in a directory

Run or debug tests from the editor

To run tests from the editor, perform the following steps:

  1. In the test file, do one of the following:

    • Click the Run button on the gutter next to the required test or test class.

      Run a specific test
    • Place the caret at the required test or test class name and press Alt+Enter.

  2. Depending on whether you want to run or debug tests, select Run '<test name>' or Debug '<test name>'. Press Enter.

RubyMine will run and display test results in the Run tool window.

If some tests are failed, you can rerun them.

Last modified: 30 January 2020