Object Test Bench – I: Debugging unplugged!!!
As you may have seen from the various blogs and articles floating around on the internet, Visual Studio 2005 will ship with a new feature called the Object Test Bench (OTB, here after). My super cool test lead, Gopinath, suggested that I should give you guys a tour of this feature so you can start working on it as soon as Beta 2 hits the stands! So – here I am, doing just that.
What is OTB?
OTB is a rich GUI front end to the VS Debugger in design mode. It provides a graphical visualization (1) of the objects created at design time from within the IDE and the GUI to interact with these objects. It also provides a GUI to interact with the classes in the Class View (CV, here after) & Class Designer (CD, here after).
OTB was designed with the following in mind, which make it pretty interesting:
1. Design time debugging (?!?): Users create and interact with objects at design time and *without* having to write driver code and/or starting a debugging session. These objects are instances of either the classes the users has just written or the classes from the referenced assemblies.
2. It provides rich GUI: Users are guided by a rich wizard type GUI in all their tasks viz. instantiating class, calling methods, inspecting objects, and a lot of other activities.
3. It is language agnostic: OTB respects the user’s individuality (J, in terms of choice of coding language) by performing its tasks, irrespective of whether it is a J#, C# or VB project – yup, OTB Beta 2 supports VB! (2)
Who/what is OTB meant for?
OTB is intended to simplify the debugging & testing the functionality of classes & their methods within a VS project or any of its references.
In other words, it could be used to shorten the design-code-debug loop for almost all classes & their methods you write. E.g. say you are writing a class library that provides utility classes/methods – you could use OTB to quickly test your code. The alternative is to create a console application as a driver for your code and then step through the driver application as it calls your code.
A corollary to the above is that OTB helps you to explore the functionality provided by the classes in a 3rd party or .NET FX assembly. E.g. say you were banging your head on the wall with a question like:
Umm… What was that function again? The one in System .Environment that returned all the process environment variables in the current process? What exactly does it return?
Well with OTB around, the good news is you don’t have to create a console application and write code to call System . Environment . GetEnvironmentVariables, store its return value in a System . Collections . IDictionary reference and then step through the driver application to examine the return value. Using OTB all you have to do is create the bare bones zero impact J# console application, navigate to System . Environment in the CV and invoke the System . Environment . GetEnvironmentVariables method using a GUI and save the return value on the test bench. Once the return value is in the test bench, you can simply use the Enhanced Debugger Datatips to do pretty much anything you want with it.
While on the subject of survey and exploration, I have to confess that I have myself used the OTB at times to quickly verify whether some of OTB’s internal classes were indeed working the way I wanted them to.
Another thing to note is that OTB with its rich GUI and its language agnostic behavior along with the CD will probably attract the new timers (3) , who are comfortable with GUIs and all but not so comfortable with debugging yet. They are trying to build a strong foundation in Computer Science by first learning the basics of OOP amongst other concepts. They should not have to delve deep into language syntax/semantics and other language idiosyncrasies. I mean, from within a class, why would a beginner care how to call the instance methods? He doesn’t need to know that you have to do a this.GetType() in J# or me.GetType() in VB, well not just yet, at least!
Hmm… OK, enough ranting for a day! Let’s proceed! J
Who/what is OTB *not* meant for?
OTB is designed/developed to provide a tool for the academia to help teachers/students for teaching/learning various concepts of software engineering. A hobbyist developer can also use it to explore the various 3rd party class libraries written for .NET FX. Although, theoretically anyone can use it during development and testing of complex software projects, OTB, depending on the code will probably not scale up adequately for large projects!
Specifically OTB is an unlikely tool:
1. For folks involved in large/complex or distributed projects.
2. For doing unit testing on a given piece of code.
3. For extending/automating via DTE and other automation interfaces.
4. For Just-in-Time or post mortem debugging.
5. To be used in the break/run modes of the Visual Studio 2005 IDE.
Where/how/when is OTB available?
Here is a conversation we might just have at this point of time:
Me: You have done well, going through this huge pile of blog. And now I sense that you wish to continue your search for young OTB.
You: Yes, my master!
Me: Patience, my friend, in time he will seek you out and when he does, you must bring him before me. He has grown strong. Only together can we turn him to the unplugged side of debugging.
You: As you wish, my master!
Me: Everything is proceeding as I have foreseen.
Me: <laugh type="evil">eh eh eh he he</laugh>
Well the good news is that you can play with this Visual Studio 2005 Beta 2. As always, if you need more information you can contact me and I will put you through to someone who can answers your questions.
In my next set of blogs, I will walk you through the OTB functionality. Basically what you can do and how! I will also present a few use cases that illustrate how OTB can be used. These won’t be the canonical cat.Meow()/dog.Bark() type examples, but something more realistic.
Finally the ever so clichéd: Hope you enjoy working with OTB as much as we have enjoyed designing/developing/testing it for you!
Please note that my blogs aren’t the official documentation on OTB or any other feature or component that write about – if you do see any discrepancy between my blogs and the product – then it is me goofing up big time! You are most welcome to contact me to get things clarified. Please also refer to the disclaimer on the left.
Here is the official OTB documentation on MSDN. This is based on the Beta 1 bits. So you will have to wait a while for the Beta 2 docs to appear at this link.
(To be continued…)
1. (1) Not to be confused with Debugger Visualizers.
2. (2) Party time for Elvis and Mort! Einstein will probably have to wait for v2! Sorry about that! :)
3. (3) I was a new-timer w.r.t. computer programming in my 10th grade… Nowadays, the new timers are from what? The 2nd grade? 3rd? 4th? Ummm… I don’t know…