Partilhar via


New Unit Testing Features in Orcas (Part 1)

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

Comments

  • Anonymous
    June 06, 2007
    PingBack from http://jayflowers.com/WordPress/?p=163

  • Anonymous
    June 24, 2007
    Preliminary thoughts on TDD with MSTest in Orcas

  • Anonymous
    June 24, 2007
    Naysawn , the PM for MSTest, asked that I take a look at the new unit testing features of Orcas, after

  • Anonymous
    July 16, 2007
    InCisif.net is a functional web testing tool for the .NET platform (www.incisif.net). In the release 1.4, we have added support for Orcas/VS2008 test framework. see out post at http://blog.incisif.net/2007/06/06/using-visual-studio-2008orcas-testing-framework-with-incisifnet-14.aspx#Comment

  • Anonymous
    July 31, 2007
    From the blog posting of Scott Guthrie , Unit Testing will be available on the Pro edition of Visual

  • Anonymous
    August 01, 2007
    Lot's of new stuff for web, load, and unit tests in Orcas. Follow the links for more info. Web test ·

  • Anonymous
    August 30, 2007
    Time for another weekly roundup of news that focuses on .NET and general development related content

  • Anonymous
    September 18, 2007
    The comment has been removed

  • Anonymous
    September 18, 2007
    The comment has been removed

  • Anonymous
    October 05, 2007
    These improvements are much needed.  Looking forward to it.

  • Anonymous
    October 16, 2007
    I'm starting to take a look at VS 2008 and writing down some things that are still "not there": Renaming