Friday, November 7, 2008

VS2008 Object Test Bench

My amazingly talented co-worker Dan Esparza showed me the Object Test Bench in VS2008 which I never knew about until today. Looks like a productive tool:

If you want to test an object and invoke its methods then you can instantiate a class directly from the VS2008 IDE and call its methods.

  • Open the Class View in your project and right click on a class and select Create Instance... and then select the constructor from the sub-menu (there'll only be one option if you don't have a constructor or a single constructor).
  • The Object Test Bench window will open and the instantiated object will be in that window.
  • Right click the object and select a method to invoke on it.
  • If you have a break-point on the object then execution will stop there and you can inspect the values etc.

The only oddity I've seen so far is that it will only work on class in the start-up project. More info here...

3 comments:

  1. I use Testdriven.NET (http://www.testdriven.net/). Quicker and easier than object test bench. This tool is one reason I've turned my back on C++ wherever possible - it does code coverage, test under debug, you name it. It doesn't, however, julienne carrots!

    ReplyDelete
  2. Whoever cracks the julienning of carrots in C# will no doubt be the next Bill Gates...

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete