Home

Programming

Biography

Gallery

Music Links

Games

Mail Me

visual basic logo

Visual Basic Programming - Automatic Testing Part II

This is a continuation of a previous article that I have written on the subject of automating testing procedures to make the process both more reliable and easier to run rapidly over the course of a project. Take a quick sneak at the output and then read on to find out how you can have this report created every day.

DOS batch scripts can be used to automatically compile your programs.  If this is combined with a switch to activate testing then we can build and test every function each night.

vb6 /make mytest.vpb /d Testing /out errors.txt
mytest.exe test

Next we need to modify the code contained within Sub Main.  This code runs when the  project is started. We test to see if a parameter has been passed in from a comand line or batch script. If we find this parameter then we will run the testing code. If the parameter is not present then we need to execute the program as usual, so we do our usual processing or load the default form.

Sub main()
   'This next line tests the command line for a value called test
   If Instr(UCase(Command$), "TEST") Then
      call test () 'run the test suite
      End 'the program
   End If
   MainForm.Show 'Continue by loading the default form
End Sub

During testing of the testing procedure we can pass in command line parameters using the Comand Line Arguments option in the Project Properties dialog.

 

Last updated insert_Date