Share this page

# lr.resumeTransaction

Resumes reporting transaction data within a script.

Example: Transactions | Transaction Functions

## Syntax

    lr.resumeTransaction( transactionName );

This function is retained for backward compatibility. For more general ways of reporting partial transaction durations, see lr.setTransaction.

The lr.resumeTransaction function resumes the reporting of transaction data within the script that was suspended by lr.stopTransaction. After a call to lr.stopTransaction, statistics returned by the "get" Transaction Functions reflect only the data up to that call, until this function is called.

Data collection, however, is not interrupted. After the call to lr.resumeTransaction, the "get" functions return all data since the start of the transaction. Furthermore, the final results when the test is analyzed will reflect the total values, including the periods in between the transaction stop and resume.

If lr.resumeTransaction is not called, the "get" functions and the final results reflect only the duration from the transaction start to the lr.stopTransaction call. Thus, lr.stopTransaction and lr.resumeTransaction can be used conditionally to collect information either about an entire transaction, or only the beginning. To accomplish this, call lr.resumeTransaction only if your condition is met.

Note: When data is collected this way, the data in analysis will reflect both the tests where the condition for lr.resumeTransaction is met, and the tests where it is not.

If the section you may wish to exclude ends before the end of the transaction, this technique does not apply. If you need to differentiate between occurrences where the lr.resumeTransaction condition is met and those where it is not in the analysis data, this technique does not apply.

For other ways of recording durations conditionally, see lr.setTransaction.

## Return Values

Not applicable

## Parameterization

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

## Example

    function Action(){
        var i;
        var iteration = 100;
        var aStr =[];
        lr.startTransaction("Stop&Start");

     /* Do part of business process. Represented
            here by loop to ensure that some
            time passes. */

     for (i=0; i < iteration; ++i) {
            lr.logMessage(i);
        }
        /* Output the duration to this point (0.343750 seconds)
            with transaction active. */
        lr.outputMessage("First time = "+lr.getTransactionDuration("Stop&Start"));

        // Stop the transaction
        lr.stopTransaction("Stop&Start");
        /* Output the duration to this point (0.359375 seconds)
            with transaction stopped. */

        lr.outputMessage("Immediately after stop = "+lr.getTransactionDuration("Stop&Start"));

        // Ensure that some time passes
        for (i=0; i < iteration; ++i) {
            lr.logMessage(i);
        }

        /* Output the duration to this point (0.359375 seconds)
            with transaction still stopped but
            more time passed. Note that time is the same.
            The time spent in the loop while the transaction
            was stopped is not reported. */
        lr.outputMessage("After stop and loop = "+lr.getTransactionDuration("Stop&Start"));

        // Resume the transaction
        lr.resumeTransaction("Stop&Start");
        /* Note that with the transaction resumed,
            all the time passed since the start is
            reported (0.781250 seconds), including the time spent
            in the loop while the transaction was stopped. */
        lr.outputMessage("After resume time = "+lr.getTransactionDuration("Stop&Start"));

        // Add time to duration
        for (i=0; i < iteration; ++i) {
            lr.logMessage(i);
        }

        /* Total time reported (1.140625 seconds) */
        lr.outputMessage("After resume and loop = " + lr.getTransactionDuration("Stop&Start"));

        // End transaction
        lr.endTransaction("Stop&Start",lr.AUTO);
        return 0;

    }

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