If your tests don't require any specific actions before start, and you don't want to configure additional options, such as code coverage, you can run them by using the following options:
Place the caret at the test file to run all tests in that file, or at the test method, and press Control+Shift+F10. Alternatively, click the gutter icon next to the test method.
Press Control twice to open the Run Anything popup and specify the
cargo testcommand with additional arguments if required.
Double-click the test target in the Cargo tool window ( ).
To run all tests in a folder, select this folder in the Project tool window and press Control+Shift+F10 or select Run Tests in 'folder' from the context menu .
Customizable way (using a run/debug configuration)
When you run a test, RustRover creates a temporary run configuration. You can save temporary run configurations, change their settings, share them with other members of your team. For more information, refer to Run/debug configurations.
Create a test configuration
Open the Run/Debug Configuration dialog by doing one of the following:
From the configuration switcher on the main toolbar, select.
Press Alt+Shift+F10 and select Edit Configuration from the context menu.
Click on the toolbar and select Cargo.
Name your configuration (or leave the default name).
In the Command field, type the Cargo command:
test+ extra arguments if needed.
Click Apply and close the Run/Debug Configurations dialog.
After RustRover finishes running your tests, it shows the results in the Run tool window on the Test Runner tab. For more information about analyzing test results, refer to Explore test results.
Use the following options on the Run toolbar of the Test Runner tab:
Click or press Control+F2 to terminate the process immediately.
Click to terminate the process gracefully, allowing shutdown hooks to run.
Rerun a single test
Right-click a test on the Test Runner tab of the Run tool window and select Run 'test name'.
Rerun all tests in a session
Click on the Run toolbar or press Control+F5 to rerun all tests in a session.
Rerun tests automatically
In RustRover, you can enable the autotest-like runner: any test in the current run configuration restarts automatically after you change the related source code.
Click Rerun Automatically on the Run toolbar to enable the autotest-like runner.
Run or debug a test
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:
Use the main toolbar:
Select the necessary run/debug configuration from the list on the main toolbar.
Press Alt+Shift+F10 to see the list of available run configurations or Alt+Shift+F9 for debug configurations.
Click Run or Debug to the right of the list. Alternatively, select Shift+F10 or Shift+F9 from the main menu.
Use a context menu:
Right-click a test class in the Project tool window or open it in the editor, and right-click the background. From the context menu, select Run <class name> or Debug....
For a test method, open the class in the editor and right click anywhere in the method. The context menu suggests the command Run / Debug <method name>.