RubyMine 2020.2 Help

Perform tests

RubyMine provides a convenient way to run and debug tests: you can run them from a context menu of a test file or directory containing tests, execute specific tests from the editor's gutter or by using intention actions, and so on. All of these actions create test run/debug configurations. You can use run/debug configurations to run specific subsets of tests with customized parameters.

Test results

Run tests

Run tests from the Project view

To run a test or multiple tests from the Project view Alt+1, follow the steps below:

  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 'All tests in <directory name>' or Run 'All specs in <directory name>' depending on the used testing framework.

    Run all tests in a directory

Run 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. Select Run '<test name>' and press Enter.

RubyMine will run and display test results in the Run tool window. If some tests are failed, you can rerun them. Learn how to explore test results from View and explore test results.

After you've run tests, RubyMine automatically creates a special profile - a temporary run/debug configuration. You can customize settings of this configuration, for example, you can pass task arguments, specify environment variables, and so on. Then, you can save the customized configuration to quickly run this configuration in the future.

Run tests using Rake tasks

To run tests using a Rake 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. Select the desired Rake task from the list and press Enter.

Run tests using a predefined configuration

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

  • Press Ctrl twice to invoke the Run Anything popup. Start typing the required configuration name, select it from the list, and press Enter.

  • Select the desired configuration on the toolbar and click Run Shift+F10.

  • Select Run | Run... Alt+Shift+F10 from the main menu, select the desired configuration from the list and press Enter.

Rerun tests

Rerun a testing session

  • Press Ctrl+F5 or click the Rerun button the Run button on the toolbar of Run tool window.

Rerun an individual test

  • In the Run tool window, right-click the test and select Run <test_target>.

Rerun tests automatically

RubyMine lets you rerun run/debug configuration of a test automatically, if the source code has been changed.

  • Press the Toggle auto-test button the Toggle Auto-Test button on the Run tool window.

Rerun failed tests

RubyMine lets you rerun the failed tests only, instead of rerunning all the tests.

  • To rerun failed tests, click the Rerun Failed Tests button the Rerun Failed Tests button on the Run tool window.

Debug failed tests

  1. Place a breakpoint in the failed test.

  2. In the Run tool window, press Shift and click the Rerun Failed Tests button The Rerun Failed Tests button.

  3. Select Debug from the Restart Failed Tests popup.

Stop running tests

  • In the Run tool window, click the Stop button the Stop button. Alternatively, press Ctrl+F2.

Last modified: 27 July 2020