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

    Fatal error: Uncaught Error: Call to undefined function eregi_replace() in H:\root\home\megazoid-001\www\skorkincom\wp-content\plugins\bbcomments\BBComments.php:41 Stack trace: #0 H:\root\home\megazoid-001\www\skorkincom\wp-includes\class-wp-hook.php(289): render_comment() #1 H:\root\home\megazoid-001\www\skorkincom\wp-includes\plugin.php(212): WP_Hook->apply_filters() #2 H:\root\home\megazoid-001\www\skorkincom\wp-includes\comment-template.php(1028): apply_filters() #3 H:\root\home\megazoid-001\www\skorkincom\wp-content\themes\inove\functions.php(1163): comment_text() #4 H:\root\home\megazoid-001\www\skorkincom\wp-includes\class-walker-comment.php(179): custom_comments() #5 H:\root\home\megazoid-001\www\skorkincom\wp-includes\class-wp-walker.php(144): Walker_Comment->start_el() #6 H:\root\home\megazoid-001\www\skorkincom\wp-includes\class-walker-comment.php(139): Walker->display_element() #7 H:\root\home\megazoid-001\www\skorkincom\wp-includes\class-wp-walker.php(332): Walker_Comment->display_element() #8 H:\root\home\me in H:\root\home\megazoid-001\www\skorkincom\wp-content\plugins\bbcomments\BBComments.php on line 41
    WordPress › Error

    There has been a critical error on this website.

    Learn more about debugging in WordPress.