Running unit tests in Rider

Guide to running unit tests

Many of the programming-related worksheets provide a (limited) set of unit tests to assist you in testing your solutions. Please note these tests are provided for formative pruposes only. The unit tests used for evaluation will be different, and not all tasks and cases (especially extention tasks) will be covered by the provided tests.

This guide assumes you are using the Jetbrains Editor, Rider. If you are using Mirosoft Visual Studio, you should use Running unit tests in Visual Sudio instead. Please note that Visual Studio is the officially supported editor for this module.

Open the project

Open the project in the IDE.

Rider editor window

Locate the project which contains the unit tests. It should be listed on the left-hand side, next to the place were you are expected to write your code.

Running the unit tests

Right click on test project in order to open the context menu. In this menu select the ‘Run Unit Tests’ option. The IDE will then run the tests and provide a report.

Running unit tests

Test Report

The panel which shows test results should show up at the bottom of the editor. This will show the current test status for each of the unit tests.

Running unit tests

The tests will not run if your code cannot compile. Please fix any compliation issues before attempting to run the unit tests.

Individual Test Results

You can expand tests in the test explorer to see individual test results. For each test, the panel should tell you which tests passed, which failed and what the expected outcome is.

note tests are provided for formative purposes. Test cases used for marking will be different - do not try to ‘game’ the tests.

Test Result

You can also see the test output in this view. This will allow you to find out where each test case is located for debugging purposes.

Test Result Detail

Useful Buttons

The options listed on the side of the test panel allow you to re-run all or some of thests. You can also find the option to debug a test to see where your code went wrong fro the expected output.

Test tools panel

Logical Errors


Last updated 0001-01-01

Graduation Cap Book Open book GitHub Info chevron-right Sticky Note chevron-left Puzzle Piece Square Lightbulb Video Exclamation Triangle Globe