RubyMine 2018.1 Help

Performing 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.

rm context dependent testing

To run or debug a test, follow these general steps:

To start running or debugging a test, you can use the main toolbar, or a context menu in the Project tool window or in the editor:

  • Using the main toolbar:
    1. Select the necessary run/debug configuration from the list on the main toolbar.
    2. Click Run run or Debug debug to the right of the list. (Alternatively, choose Run | Run (Shift+F10) or Run | Debug (Shift+F9) from the main menu.)
  • Using a context menu:

    Right-click a test class in the Project tool window, or open it in the editor, and right-click the background. On the context menu, choose Run < class name> or Debug....

To run all tests in a directory

  1. In the Project tool window, select the directory that contains tests to be executed.
  2. On the context menu, choose the corresponding run command.

    If the directory contains tests that belong to the different testing frameworks, select the configuration to be used.

    For example, choose Run 'All tests in: <directory name>' .

    ruby runAllTests
  3. Explore results in the test runner.

To run a test case or test script

  1. Open the desired test in the editor, or select it in the Project tool window.
  2. On the context menu of the selection, choose Run <test class name>.

To run a test method or example

  1. Open the desired test in the editor.
  2. Place the caret somewhere within the test method body.
  3. On the context menu, choose Run <test method name>.
Last modified: 30 May 2018

See Also

Reference: