Share this page

# lr.exit

Exits from the script, action, or iteration.

    void lr.exit (int continuation_option, int exit_status);

Runtime Functions | Java Syntax

## Arguments

Name | Comments
--- | ---
continuation_option | The Script Continuation Options specifies how the script continues after the call to lr.exit
exit_status | The Script Exit Status of the scenario group as a result of calling lr.exit

The lr.exit function allows you to exit from the script run during execution.

A transaction in which lr.exit is called does not appear in Controller in the Transaction Status box. It is ignored in the count of passed and failed transactions.

If lr.exit is called several times in the same script, whether in different actions or different iterations, it is the exit status of the last call that determines the status of the Vuser group running the script. The Controller Scenario Groups Status box displays the status. It is the column in which the group appears after the run stops.

lr.exit(lr.EXIT_VUSER, lr.ABORT); is equal to lr.abort

## Return Values

No value is returned.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, lr.exit is called if a file cannot be opened.

    import lrapi.lr;
    import java.io.*;
    public class Actions {

    public int init() {return 0;}
    public int action() {
    try {
        File file = new File("d:/temp/Java" + Thread.currentThread() + ".txt");
        FileOutputStream fos = new FileOutputStream(file.getName());
        PrintStream outstr = new PrintStream(fos);
    }
    catch (IOException e) {
        PrintStream outstr = null;
        outstr.println("Init (vuser " + lr.get_vuser_id() + ")");
        lr.exit(lr.EXIT_VUSER, lr.FAIL);
    };
    return 0;
    }//end of action
    public int end() {return 0;}
    }

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: