R. E. Cook
Contact Us 

Dr. Cook

RunningShoes Library for WinRunner 

Custom WinRunner Functions 
and Utilities,
to Your Specs

A Random Collection of WinRunner 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:

However, this statement can be used, and has the same effect as the texit statement:


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.


public function StopRun()

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.