.net SmokeTest for Reflector

With .net SmokeTest, you can take any assembly, construct an instance, call a method, set a property or field of any class Type from a dialog: Then drill-down into the result without ever writing a single line code.

What is .net SmokeTest?

.Net SmokeTest is a Windows application that presents an interactive interface into any .NET Assembly allowing you to smoke-test an API via reflection. You can call any member without ever writing a single line code. An indispensible tool for anyone involved in developing, testing and managing software products for Windows.

Now you can experience the full power of SmokeTest from inside .NET Reflector. Don’t just view the code – smoke-test it. The SmokeTest Add-In allows you to interactively:

  • Create an instance of any Class
  • Call any Method
  • Get and set any Property
  • Read and write any Field
  • Create and edit object instances to pass as arguments
  • Drill-down and smoke-test the returned result

For a detailed tutorial on how to use .net SmokeTest, see my blog.

Installation

Download and install the latest version of .net SmokeTest if you haven’t already done so.

From Reflector select the Add-Ins menu item and select the “Add” button then navigate to the directory where you installed .net SmokeTest and choose the SmokeTest.Reflector.AddIn.dll file. This should load the SmokeTest Add-In into your Reflector installation.

1726-smoketest1.png

Using the SmokeTest Add-In

Now when you navigate to a smoke-testable Type in Reflector’s Assembly tree (try System.DateTime in mscorlib) you will see a SmokeTest panel appear as shown here.

1726-smoketest2.png

For a managed type to be smoke-testable it must be a class or struct (ValueType). Generic classes are currently not supported. Interfaces are not smoke-testable for obvious reasons. Also, unlike .NET Reflector, SmokeTest must instantiate the type under test and therefore requires all supporting dlls and resources to be available to the Assembly under test.

The Basics

So, just for fun, let’s smoke-test the built-in DateTime class. The same procedures apply to any class in the .NET hierarchy in of course and most importantly your own. Navigate to the System.DateTime class under the mscorlib Assembly. The SmokeTest panel should appear when you select the DateTime type as shown above.

1726-smoketest3.png

Note that the main smoketest panel displays only the static members and constructors of the DateTime class. Of course, until you actually create an instance of a type all you can invoke are the constructors and static members.

Just out of interest click on the Methods, Properties and Fields tabs to see what other static members are available for this class. Note that Properties and Fields will always “get” the current value automatically when you select them and display the result in the preview panel at the bottom. Constructors and Methods require that you invoke the function explicitly.

Now, under the Properties tab select the “Now” property. The current local time will be displayed in the ToString preview tab as a result of invoking the property.

Notice also the “drill-down” button at the bottom right lights-up with the name of the type returned from calling the property, a DateTime in this case. The drill-down button always links to the last result object whether from a Constructor, Method, Property or Field invocation. Clicking the drill-down button will open another SmokeTest window where you can smoke-test all the members of the object instance (not just the static members).

And that’s all there is to it. Now try it out with other classes and methods from your own Assemblies or just browse the Microsoft libraries.