February 16, 2009

WinTask - The Hello World Test

In Chapter 8 of the terrific book "How We Test Software At Microsoft" by Alan Page, Ken Johnston and Bj Rollison, the authors talk about Model-Based Testing.
As part of this discussion, Alan Page introduces a simple application for modeling.  This program is reproduced here as a WinTask script.

If you compile this script to a .rob file, and give the new or prospective tester a copy of WinTask and the .rob file, he can try testing the program for himself, using test cases he has devised.

You may even choose to intentionally create a buggy version of this script, to see if the new tester can find all of the bugs.

' Hello World Sample Application - Model Based Testing
' Author: Joe Strazzere
' Adapted from "How We Test Software at Microsoft"
' - Alan Page, Ken Johnston, Bj Rollison
' Chapter 8
BEGINDIALOG Dialog 345, 355, 260, 260
CAPTION "Hello World Application"
    PUSHBUTTON "Say Hello", Button1, 20, 20, 90, 30
    EDITTEXT Edit1$, 140, 20, 90, 30
    PUSHBUTTON "Say World", Button2, 20, 70, 90, 30
    EDITTEXT Edit2$, 140, 70, 90, 30
    PUSHBUTTON "Clear Text", Button3, 20, 120, 90, 30
    DEFPUSHBUTTON "&Cancel", Button4, 93, 170, 69, 31

Instr$=Instr$+"Hello World is a simple application with four buttons."+CRLF
Instr$=Instr$+"The first button prints 'Hello' into the first text box."+CRLF
Instr$=Instr$+"The second button prints 'World' into the second text box."+CRLF
Instr$=Instr$+"The third button clears the text boxes."+CRLF
Instr$=Instr$+"The Cancel button stops the application."

MsgBox(Instr$,64,"Hello World")

CallDialog Dialog,"Hello World Application"

While Button4 <> 1
    If Button1 = 1 Then
    If Button2 = 1 Then
    If Button3 = 1 Then
    CallDialog Dialog,"Hello World Application"

also see: http://blogs.msdn.com/microsoft_press/archive/2009/02/13/new-book-how-we-test-software-at-microsoft.aspx