Quantcast
Channel:
Viewing all articles
Browse latest Browse all 43849

Wiki Page: Creating a custom base state in Workench.net script

$
0
0
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 ="http://demo.borland.com/InsuranceWebExtJS/ '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. Agent.Attach(execPath,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() newBaseState()   End Sub  

Viewing all articles
Browse latest Browse all 43849


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>