Home > Testing > Unit testing inside the code editor and the Solution Explorer

Unit testing inside the code editor and the Solution Explorer

July 21st, 2011

Let’s compare the benefit of the CodeRush Unit Testing Service against the native Visual Studio unit testing support as an example. The first things that may catch your attention are test icons near test methods, test fixtures and namespaces containing test cases:

CodeRush Test icons inside code editor

You can see different test icons depending on the status of a test:

 CodeRush Icon Test Tube Test(s) has not run yet
 CodeRush Icon Test has passed Test(s) has run and passed
 CodeRush Icon Test has passed but changes Test(s) has run and passed, however there have been changes to the code since the last run
 CodeRush Icon Test has failed Test(s) has run and failed
 CodeRush Icon test has failed but changes Test(s) has run and failed, however there have been changes to the code since the last run
 CodeRush Icon test has been ignored Test(s) has been ignored

By clicking on this icon, a context menu appears giving you several options:

CodeRush Test icon popup menu

This lets you run or debug a single test in all supported frameworks, including Silverlight. Note that Visual Studio’s built-in test runner can’t do this.

Test fixtures and namespaces containing unit tests have icons summarizing the run results of their contents. For example, if at least one test has failed, the namespace and the test fixture will both have a red “X”  icon, indicating they contain failed test cases.

If you hover the mouse over one of the test icons, you can see the status of the test in a summary hint:

CodeRush Hint Test has passed

CodeRush Hint Test has passed but changes were made

CodeRush Hint with test run summary

The failed state of a test will show additional testing results such as message, expected results and a call stack:

CodeRush Hint Test has failed with message

Instead of seeing results in the Visual Studio’s Test Results window, you see them straight in the code. Such visualization provides a better overview of a test state, and you can apply changes to a test immediately if required.

Tests can also be run or debug test cases from the code editor context menu:

CodeRush Code editor context menu

And from the Solution Explorer:

Unit Tests in Solution Explorer context menu

The Visual Studio Output window will have all details about test runs performed:

Unit Tests Visual Studio Output window

The summary of all test cases inside entire solution can be seen in the special Unit Test Runner window:

CodeRush Unit Test Runner Window preview

Don’t forget that you can use keyboard shortcuts without interacting with the code editor.

Products: CodeRush Pro
Versions: 12.1 and up
VS IDEs: any
Updated: Oct/29/2012
ID: C115

Similar Posts:

  1. Xronosd
    July 22nd, 2011 at 12:10 | #1

    Is it possible to run tests from console?

  2. July 23rd, 2011 at 06:49 | #2

    No at the moment, but you are always welcome to suggest any ideas to improve the product to DevExpress Support.