Creating a custom base state in script

Creating a custom base state in script

If your test case involves closing an application and then restarting it, you may be interested in writing your own base state.

The base state is simply a recovery system used to execute the Application Under Test (AUT) to ensure it is ready for automated testing.

If you wish to create your own base state via Workbench VB.Net script, please see the steps below:-

1)      Create a new VB.Net script

2)      Create a new sub newBaseState()

3)      See the below example of the information required to declare a custom base state for an Internet Explorer application :-

Public Sub newBaseState()


'Store path for exectuable of the program

Dim execPath As String = "%ProgramW6432%\Internet Explorer\iexplore.exe"

'Store locator of the program
Dim sLocator As String = "WebBrowser"

'Store URL to be passed to executable                                                                                                                   Dim cmdlineArgs As String ="

'Create new base state and pass in all parameters                                                                                                    Dim AppBaseState As New BaseState(execPath,cmdlineArgs,sLocator)

'Execute the base State                                          AppBaseState.Execute()

'10 Second Sleep to ensure browser is ready for interaction               Threading.Thread.Sleep(10000)

'Attach Open Agent to the Application, passing the parameters execPath and cmdlineArgs.


'Sleep statement to allow more time for the Agent to attach System.Threading.Thread.Sleep(2000)


End Sub

4) With the newBaseState() created , we can now call the sub within the Main() similar to below:-

Public Sub Main()


End Sub



Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2014-04-29 23:37
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.