Quantcast
Channel: Verisium Software Testing Blog » Functional Testing
Viewing all articles
Browse latest Browse all 7

Running vTest in Batch Mode

$
0
0

After you have completed creating and running a script successfully in vTest, you may wish to automate the unattended execution of this script. You might want to have it execute at 4am in the night every night to allow you to inspect the results as soon as you get into work every morning. What are your options in this regard, you might ask.

vTest allows you to save a batch script by selecting the menu item File > Generate Batch Script. This saves a VBScript file to your intended location that automates the execution of the loaded project. Here is what the generated VBScript looks like

Set vtObj = CreateObject(“vTest.Document”)
vtObj.Open(“C:\Program Files\Verisium\vTest\Projects\Project1.vtp”)
vtObj.SetValue “ReportBase”, “C:\Users\Paul\Desktop\Misc”
vtObj.Run()
vtObj.Close()

The above script is mostly self-explanatory with the exception of the line that calls the “SetValue” function. This function can be used to set the value of “ReportBase” variable that allows you to specify where the HTML reports should be saved. “SetValue” can also be used to determine if you wish to run through all the iterations specified in the project or whether you wish to limit the execution to only the first iteration. This is done using the variable “ShouldIterate”. A value of “0″ limits the execution to only the first iteration. A value of “1″ is the default value and allows you to run through all the iterations specified in the project.

Another function called the “GetValue” function allows the caller to obtain several variables. One of these, the “ResultsXml” variable allows the user to obtain an XML representation of the result. This can be useful if you wish to eventually parse these results and save them in your own file or database. This would be called as follows.

Dim xml
……
xml = vtObj.GetValue(“ResultsXml”)

After saving and customizing your batch script, you can run it unattended using the Windows Task Scheduler at a specified time and frequency.

Share


Viewing all articles
Browse latest Browse all 7