biz.neustar.wpm.api
Interface Transaction


public interface Transaction

Aggregate information about a transaction in a script. This object contains basic timing information, such as the start and end time, as well as the total number of bytes transferred during the transaction. It also holds a flag that indicates if the transaction is considered a success or a failure.


Method Summary
 long getBytes()
          The total number of bytes received via HTTP requests while this transaction was active.
 java.util.Date getEnd()
          Returns the time the transaction ended, or null if the step has not yet ended.
 java.util.Date getStart()
          Returns the time the transaction started.
 long getTimeActive()
          The time spent actively running the script, such as time spent waiting for a page to finish loading.
 long getTimePaused()
          The time spent actively paused due to an explicit call to pause() by the script author.
 boolean isSuccess()
          Returns true if the transaction is going to be considered "successful".
 java.lang.String put(java.lang.String name, java.lang.String value)
          Associates a generic name/value pair with this transaction.
 void setBytes(long bytes)
          Set the total number of bytes received while this transaction was active.
 void setSuccess(boolean success)
          Sets the "success" parameter of the transaction, which will be stored with the overall test records and charts.
 void setTimeActive(long timeActive)
          Sets the time you want recorded for the transaction.
 void setTimePaused(long timePaused)
          Sets the time spent actively paused.
 

Method Detail

put

java.lang.String put(java.lang.String name,
                     java.lang.String value)
Associates a generic name/value pair with this transaction. The name must be unique. If you are putting a value on this transaction with a previously used name, then the old value will be lost. The name/value pair will be associated with this transaction's ID when stored in the test results.

Parameters:
name - the unique name of the name/value pair
value - the value to be stored
Returns:
returns null if this is a new name, otherwise returns the old value being replaced

getStart

java.util.Date getStart()
Returns the time the transaction started.

Returns:
the time the transaction started.

getEnd

java.util.Date getEnd()
Returns the time the transaction ended, or null if the step has not yet ended.

Returns:
the time the transaction ended.

getBytes

long getBytes()
The total number of bytes received via HTTP requests while this transaction was active. If the transaction is currently active, this number may grow as additional HTTP requests are made.

Returns:
the number of bytes received.

setBytes

void setBytes(long bytes)
Set the total number of bytes received while this transaction was active. If the transaction is still active when calling this function additional bytes will be added as they are received.

Parameters:
bytes - the number of bytes received.

isSuccess

boolean isSuccess()
Returns true if the transaction is going to be considered "successful".

Returns:
true if the transaction is a success.

setSuccess

void setSuccess(boolean success)
Sets the "success" parameter of the transaction, which will be stored with the overall test records and charts. This function can be called if the script author wishes to mark a transaction as a failure without actually throwing an exception. Such usage is uncommon and should be used with case.

Parameters:
success - true if the transaction should be considered a success.

getTimePaused

long getTimePaused()
The time spent actively paused due to an explicit call to pause() by the script author.

Returns:
the time, in milliseconds, that this transaction was paused due to a pause() function call.

setTimePaused

void setTimePaused(long timePaused)
Sets the time spent actively paused. The paused time indicates the length of time that the transaction was paused to simulate user input speed.

Parameters:
timePaused - the time, in milliseconds, that this transaction was paused.

getTimeActive

long getTimeActive()
The time spent actively running the script, such as time spent waiting for a page to finish loading.

Returns:
the time, in milliseconds, that this transaction was actively running.

setTimeActive

void setTimeActive(long timeActive)
Sets the time you want recorded for the transaction. Call after test.endTransaction() otherwise the length of time between test.beginTransaction() and test.endTransaction() will be recorded.

Parameters:
timeActive - the time, in milliseconds, that this transaction was actively running.

Copyright © 2020 Neustar, Inc. All Rights Reserved.