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.
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:
Right-click a specific test file or a directory containing the required tests, for example, test, spec, or features.
From the context menu, select testing framework.
or depending on the used
Run tests from the editor
To run tests from the editor, perform the following steps:
In the test file, do one of the following:
Click the Run button on the gutter next to the required test or test class.
Place the caret at the required test or test class name and press Alt+Enter.
Select
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:
From the main menu, select
Ctrl+Alt+R.In the invoked popup, start typing the name of a Rake task that runs tests, for example,
rake test
orrake spec:controllers
.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 Shift+F10.
Select
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 on the toolbar of Run tool window.
Rerun an individual test
In the Run tool window, right-click the test and select .
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 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 on the Run tool window.
Debug failed tests
Place a breakpoint in the failed test.
In the Run tool window, press Shift and click the Rerun Failed Tests button .
Select Debug from the Restart Failed Tests popup.
Stop running tests
In the Run tool window, click the Stop button . Alternatively, press Ctrl+F2.