Run/debug configurations for tests
When you run tests for the first time, RubyMine automatically creates a corresponding RSpec or Test::Unit/Shoulda/MiniTest temporary configuration, which can be saved. If necessary, you can create the required test run/debug configuration manually from the predefined template.
Create a test configuration
Create a test configuration from the Project view
In the Project view Alt+1, 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 usedIn the dialog that opens, specify the run/debug configuration parameters (RSpec or Minitest), apply changes and close the dialog.
Create a test configuration from the editor
Open the test file in the editor and 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
or and press Enter.In the dialog that opens, specify the run/debug configuration parameters (RSpec or Minitest), apply changes and close the dialog.
Run/debug configuration: RSpec
Configure a newly created or existing RSpec run configuration on the Configuration tab:
Item | Description | |
---|---|---|
Name | Specify the name of the current run/debug configuration. | |
Mode | Define the scope of tests to run:
| |
Specs folder | Specify the fully qualified path to the directory that contains the desired specs. Alternatively, click and select the specs directory in the dialog that opens. This field is only available, when the All specs in folder option is selected. | |
File name mask | Specify the mask of the spec file name, for example, **/*_spec.rb. This field is only available, when the All specs in folder option is selected. | |
Spec script | Specify the name of the script to be executed. This field is only available, when the Spec script option is selected. | |
Specs | Specify the names of the desired specs. Alternatively, click and select the specs in the dialog that opens. This field is only available, when the Multiple specs option is selected. | |
Example names | Specify one or several names of the examples within the script to be executed. Use If no example is specified, all examples will be executed. This field is only available, if either the Spec script or Multiple specs option is selected. | |
Example IDs/line number | Specify the Unique ID of an example or example group to run or, alternatively, specify the line number with the desired example or example group. An example ID consists of a combination of the example number and the numbers of example groups that contain it, separated by colons. For instance, if you have a test file with three example groups, the second group contains three examples, and you want to run the first example, its example ID will be Use square brackets when specifying example IDs and separate multiple IDs with commas, such as To run an example or example group using its line number, specify it without using square brackets. | |
Runner options | Provide additional options to customize RSpec's behavior. Learn more about the available options from Command line. | |
'rspec' gem | Use this list to select the desired gem version, which will be used to run the tests. The list shows the versions that are available in the Ruby SDK. By default, the latest available version is taken. | |
Use custom RSpec runner script | Select this checkbox if you want to use an alternative spec runner. You can type the fully qualified path to the spec runner in the text field, or click , and select the desired runner in the dialog that opens. | |
Use pre-load server | From the list, select the server to be used for executing scripts or examples. Select None if you want to execute a script or example locally, without any server. Refer to Spork DRb for details. | |
Output full backtrace | Select this checkbox to enable the | |
Working directory | Specify the working directory used by the running task. For example, this option is in effect when the running script loads other scripts by relative paths. | |
Environment variables | Specify the list of environment variables as the name-value pairs, separated with semi-colons. Alternatively, click to create variables and specify their values in the Environment Variables dialog. | |
Ruby arguments | Specify the command-line arguments to be passed to the Ruby interpreter. | |
Ruby SDK | Specify the desired Ruby interpreter. You can choose the project default Ruby SDK, or select a different one from the list of configured Ruby SDKs. |
Run/debug configuration: Test::Unit/Shoulda/MiniTest
Configure a newly created or existing Test::Unit/Shoulda/MiniTest run configuration on the Configuration tab:
Item | Description | |
---|---|---|
Name | Specify the name of the current run/debug configuration. | |
Mode | Define the scope of tests to run:
| |
Test folder | Specify the fully qualified path to the directory that contains the desired tests. Alternatively, click and select the test directory in the dialog that opens. This field is only available, when the All tests in folder option is selected. | |
Test file name mask | Specify the mask for a test filename, for example: This field is only available, when the All tests in folder option is selected. | |
Ruby scripts | Specify one or multiple fully qualified paths to the desired tests. Alternatively, click and select one or multiple test files in the dialog that opens. This field is only available, when the Test scripts option is selected. | |
Ruby script | Specify the fully qualified path to the test that contains the method you want to run. Alternatively, click and select the test file in the dialog that opens. This field is only available, when the Test method option is selected. | |
Test name filter | Type a filtering expression or the name of a test method. The test name filter can be a regular expression. This field is only available, when the Test method option is selected. | |
Use pre-load server | From the list, select the server to be used for executing scripts or examples. Select None if you want to execute a script or example locally, without any server. Refer to Spork DRb for details. | |
Runner options | Specify the options to be passed to the test runner. | |
Working directory | Specify the working directory used by the running task. For example, this option is in effect when the running script loads other scripts by relative paths. | |
Environment variables | Specify the list of environment variables as the name-value pairs, separated with semi-colons. Alternatively, click to create variables and specify their values in the Environment Variables dialog. | |
Ruby arguments | Specify the command-line arguments to be passed to the Ruby interpreter. | |
Ruby SDK | Specify the desired Ruby interpreter. You can choose the project default Ruby SDK, or select a different one from the list of configured Ruby SDKs. |
Run tests using a predefined configuration
To run the test(s) using the already created run/debug configuration, do one of the following:
Press Control 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.