R. E. Cook
Home 
Contact Us 

Dr. Cook
Resume 

RunningShoes Library for WinRunner 
RunningShoes 

Custom WinRunner Functions 
and Utilities,
to Your Specs
Custom 

A Random Collection of WinRunner Solutions
Solutions 

Creating DLLs for WinRunner 
"DLLs Demystified" 
(Mercury Interactive's Worldwide Users Conference 2000)

Stop a test run from within a function.

 

It is often desirable to stop a test run from within a function. However, WinRunner does not allow using either the texit or treturn() statements in a function. A simple workaround is to put the texit or treturn() in an eval() statement in a function.

This statement cannot be used in a function:
texit;

However, this statement can be used, and has the same effect as the texit statement:
eval("texit;");


Process

Create a simple function StopRun() that contains the eval() statement. Then call that StopRun() function from within other functions that evaluate conditions to determine whether a test can continue. For example, create another function to stop the test if a window is not found.


Code

public function StopRun()
{
eval("texit;");
}


The code for both functions is in a text file to avoid browser format mangling. View StopRun.txt.

 



Top of  This Page | R. E. Cook Home Page

Copyright R. E. Cook Consulting, 2000 - 2011.
All rights reserved.

The site is designed to look best when viewed with Internet Explorer 5.0 - 8.0. Results with other browsers will probably deviate from what is intended.

NOTE: This website refers to registered trademarks and service marks that are owned by other companies, including Mercury Interactive, WinRunner, TestDirector, TSL, Microsoft, Windows.