BM-Bloggers

The blogs of Black Marble staff

VB.Net samples - Source Release 1.1

I was asked via this blog if the GUITester tool can be used with VB.NET. Well because of the architecture of .NET in theory it can be used with any .NET language, as long as the language designers implemented attributes.

The only change that is required is to make sure that the attributes are declared in the correct manner. To this end I have added a very small VB.NET demo to the show the basic functions. There is a single form with a basic button click event. You then need to add the following attributes

First the flag that says that the class is testable:


    <GUITestable> _
    Public Class Form1

Then the actual test attributes:

    <ClickTextTestAttribute("buttonChangeText Click Test 2", "Label1", "Button Pressed")> _
    Friend WithEvents Button1 As System.Windows.Forms.Button

Now be careful with these test attributes, the _ line continuation character is required and they have to be placed in the region marked 'Windows Form Designer generated code'. Mnaually adding them here does work, but I am worried that the Visual Studio Desginer may remove these lines if the GUI is altered, I need to investigate this further, but my initial test seem to show this is not the case.

The revised set of demo code can be found at 

http://www.blackmarble.co.uk/guitester/GUITesterSourceV1.1.zip