Object Test Bench (OTB)

Many times in development cycle,we face that for invoking a method in data access layer or business layer we have to run all the project from UI and then debug the method we want.Its just so time consuming if I had many projects under my solution.

There is one quick and easy way to create instances of your project’s objects, invoke methods, and evaluate the results. This way, you shorten the task of coding, debugging and re-coding.
Object Test Bench (OTB) is designed for simple object-level testing.

How-To:


1. Open up your project’s class diagram into class designer.[for this right click on project in solution explorer-> go to properties–> Click on View class diagram]
e.g. Let’s create a demo project called OTB having a single class named “TestClass” which have method called “SayHell()” which accepts the string as a parameter and show the messagebox.
The class diagram for this is as shown

2. In the Class View, right-click the name of the class or struct whose instance you want to create.

3. Click Create Instance to display the public constructors of the class.In the Create Instance dialog box, provide the parameters, and then type the name of the object(instance of your class). The name is not provided by default; you must provide a name.
e.g.: for our OTB project I will name the instance of TestClass as “testClass1”.


4. You can now see the object test bench window and your class instance with various methods as shown below.
e.g.: Now in our demo project,All the methods of “testclass1” object/instance can be seen as below.

5. You can invoke the desired method of the class instace and debug that method according to various parameters passed to it and observe the results.
To Find more on Object Test Bench:

1. http://msdn2.microsoft.com/en-us/library/s9fwfe71(VS.80).aspx
2. http://msdn2.microsoft.com/en-us/library/k6d9x2fx(VS.80).aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s