Please enable JavaScript to view this site.

Performance Validator Help

Navigation: » No topics above this level «

Working with VBUnit

Scroll Prev Top Next More

 

note This page gives information about using Performance Validator with programs that use VBUnit.

 

 

About VBUnit

 

VBUnit works by spawning a worker service process, vbUnitTestServer.exe which works in conjunction with the main process RunVBUnit.exe.

 

Because vbUnitTestServer.exe is a service and is not launched directly using CreateProcess from RunVBUnit.exe we can't monitor and hook this process.

 

This means that to get the Performance Validator stub dll into your Visual Basic process you'll have to load the stub dll yourself.

 

note At the time of writing, the current VBUnit is VBUnit3.

 

 

Using Performance Validator with VBunit

 

There are two steps: preparing the executable and running the test.

 

 

Step 1: Modifying the VB DLL/EXE

 

To load the Performance Validator stub dll into your Visual Basic process do the following steps:

 

1) Copy svlPerformanceValidatorStub.dll to the same directory (or any directory on the $PATH) as the Visual Basic executable (or DLL) you wish to test.

 

2) Copy DbgHelp.dll from the Performance Validator install directory to the same directory (or any directory on the $PATH) as the Visual Basic executable (or DLL) you wish to test.

 

Don't copy the DbgHelp.dll from elsewhere as you may get an earlier version of the DbgHelp.dll and not be able to read symbols as a result.

 

3) Modify the start of your test DLL or exe so that the first thing it does is load the Performance Validator stub DLL.

 

Do this as follows:

 

a) Add these lines to the start of your Visual Basic code.

 
  Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
  Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long

 
 

b) Add these lines where you wish to load the Performance Validator DLL.

 

   Dim lbCVStub As Long
 
   lbCVStub = LoadLibrary("svlCoverageValidatorStub")

 
 

c) Add this line where you wish to unload the Performance Validator DLL.

 

   FreeLibrary lbCVStub

 

This step is optional, but do it as close to the end of the execution of your DLL or EXE as possible.

 

4) Ensure each VB exe or DLL has been built with debug symbols. Debug symbols are required so that Performance Validator can monitor each line visit.

 

Do this as follows:

 

a) Open the Visual Studio properties dialog for the project. Project Menu instructionStep Properties...

 

b) Go to the Compile tab.

 

c) Select the Compile to Native Code radio box.

 

d) Check the Create Symbol Debug Info check box. Click OK.

 

e) Make the project. File Menu instructionStep Make [name of project].

 

 vb6DebugSettings

 

 

Step 2: Setting up Performance Validator

 

1) Setup where the Visual Basic PDB files are stored

 

Do this as follows:

 

a) Open the settings dialog.

 

b) Go to "File Locations".

 

 cvSettingsFileLocationsPDB

 

c) Choose "Program Database (PDB) Files" in the combo box.

 

d) Click Add. Enter the directory name where the PDB files are located.

 

e) Click OK.

 

2) Setup Visual Basic file associations.

 

Do this as follows:

 

a) Open the settings dialog.

 

b) Go to "Hooked File Extensions".

 

 cvSettingsHookedSourceTypes

 

d) Check if the file extensions "cls" and "bas" are present, or remove all file types, If no file types are present every type of file will be instrumented.

 

e) For any file extension that is not present click Add then enter the extension.

 

e) Click OK.

 

 

Step 3: Running the test

 

To run the test do the following:

 

1) Start Performance Validator.

 

2) Start your Unit tests from your command line or batch file.

 

When the Performance Validator DLL loads into your DLL/EXE it will instrument your DLL/EXE.

 

It will then contact the Performance Validator UI and proceed as if you had launched the unit tests from Performance Validator.