Share this page

# lr.abort

Aborts the execution of a script.

void lr.abort( );

Runtime Functions | Java Syntax

The lr.abort function aborts the execution of a script . It stops the execution of the Actions section, executes the vuser_end section, and ends the execution. This function is useful when you need to manually abort a run as a result of a specific error condition. When you end a run using this function, the status is "Stopped."

lr.abort is equivalent to `lr.exit(lr.EXIT_VUSER, lr.ABORT);`. For more options, see lr.exit.

## Return Values

No value is returned.

## Parameterization

Parameterization is not applicable to this function.

## Example

In the following example, lr.abort aborts the script if it cannot open a file.

    try {
         File file = new File("c:/temp/Java" + Thread.currentThread() + ".txt");
         FileOutputStream fos = new FileOutputStream(file.getName());
         outstr = new PrintStream(fos);
       }

    catch (IOException e) {
         outstr = null;
         outstr.println("Init (vuser " + lr.get_vuser_id() + ")");
        lr.abort( );
       };

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: