This is a part of a series of postings on the new unit testing features appearing in Orcas.  All these features will be available in Orcas beta 2.

I know that MSTest isn’t yet the darling of the TDD world, but I’d like to think that our TDD story has improved a decent amount in Orcas.  These are some of the improvements:

1 – Better Execution Times: We have rewritten our test execution engine to significantly improve the time that it takes to execute unit tests from the command prompt and via the IDE. 

2 – Run Tests: We have added a menu item to execute the tests in the current context of the test class’ code.  Executing “Run Tests” from a right click context menu will execute the best guess of the tests we think you would like to execute.  Therefore if the focus is on a test method, Run tests will execute the test method, if the focus is in a test class, Run Tests will execute all the tests in the test class, if the focus is in the test results window, Run Tests will execute the tests which are checked, etc.  Ctl R, T also accesses this command. I think you guys will love it. 

3 – Short Cut Keys to Run Tests: We have added in a lot of short cut keys to kick off a test quickly.  They are as follows:

·         Ctl R, T: Run Tests in Current context (see #2)

·         Ctl R, C: Run Tests in Current Test Class

·         Ctl R, N: Run Tests in Current Namespace

·         Ctl R, S: Run All Tests in Solution

·         Ctl R, D: Run the Tests in the Last Test Run

·         Ctl R, F: Run the Failed Tests of the Last Test Run

 

Holding Ctl while pressing the second key in the key combo executes the tests with the debugger.  We hope that these additions will significantly improve the TDD flow.

4 – Disable Deployment:  As many of you are aware, MSTest currently “deploys” tests for every test run it executes.  This means that in addition to generating a Test Results (trx) file, it also copies all the test binaries, code coverage files and debug information to a deployment folder, where the tests are executed.  This design provides for convenient features for collaboration, specifically publishing old test results and their deployments, allowing another team member to  re-run the tests and step through a test run.  It is however, inconvenient for TDD users, since most TDD’ers want their tests to execute as fast as possible.  We have therefore added an option in the Test Run Configuration to disable deployment.  To do so, go to the Test Run Configuration file in a Test Project (double click on *.testrunconfig in solution explorer), Deployment, and uncheck “Enable deployment.”

5 – Inheritance of Tests:  In Whidbey, we did not support the inheritance of tests methods or initializations.  We have added support for inheritance in Orcas.  I’m planning to use a future post to dive in to the nitty gritties of Test Inheritance.

6 – Directly go to the Point of Failure: We have enabled an option in Orcas to directly jump to the point of failure.  We have made the stack trace in the Test Results window clickable as well.  To specify that double clicking on a failed test result takes you to the first element in the stack trace, go to Tools->Options->Test Tools -> Test Execution and check the last box in the window.

Props to Alan Ridlehoover, Peter Provost and Peli de Halleux for their help in trying to get the TDD experience right. J