biz.neustar.wpm.api
Interface TransactionStep


public interface TransactionStep

Aggregate information about a particular step in the script. This object contains basic timing information, such as the start and end time, as well as the total number of bytes transferred during this step.


Method Summary
 long getBytes()
          The total number of bytes received via HTTP requests while this step was active.
 java.util.Date getEnd()
          Returns the time the step ended, or null if the step has not yet ended.
 TransactionStepObject getFirstObject()
          Finds the first (chronologically ordered) object associated with this step, or null if there are no objects.
 TransactionStepObject getLastObject()
          Finds the last (chronologically ordered) object associated with this step, or null if there are no objects.
 java.util.List<TransactionStepObject> getObjects()
          Returns all objects associated with this step, or an empty list of no objects are.
 java.util.Date getStart()
          Returns the time the step started.
 long getStepTimeout()
          Returns the step timeout in milliseconds.
 long getTimeActive()
          The time spent actively running the script, such as 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.
 java.lang.String put(java.lang.String name, java.lang.String value)
          Associates a generic name/value pair with this step.
 void setBytes(long bytes)
          Set the total number of bytes received while this step was active.
 void setStepTimeout(long timeoutInMilliseconds)
          Set the timeout, in milliseconds, that the step is allowed to run.
 void setTimeActive(long timeActive)
          Sets the time you want recorded for the step.
 void setTimePaused(long timePaused)
          Sets the time spent actively paused.
 void verifyItemDownload(java.lang.String url)
          Verify that the given url matches a downloaded item.
 void verifyItemDownloadRegex(java.lang.String regex)
          Verify that the given regex matches a downloaded item.
 

Method Detail

put

java.lang.String put(java.lang.String name,
                     java.lang.String value)
Associates a generic name/value pair with this step. The name must be unique. If you are putting a value on this step with a previously used name, then the old value will be lost. The name/value pair will be associated with this step'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 step started.

Returns:
the time the step started.

getEnd

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

Returns:
the time the step ended.

getBytes

long getBytes()
The total number of bytes received via HTTP requests while this step was active. If the step 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 step was active. If the step is still active when calling this function additional bytes will be added as they are received.

Parameters:
bytes - the number of bytes received.

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 step 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 step was paused to simulate user input speed.

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

getTimeActive

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

Returns:
the time, in milliseconds, that this step was actively running or waiting for a response.

getFirstObject

TransactionStepObject getFirstObject()
Finds the first (chronologically ordered) object associated with this step, or null if there are no objects. Good in conjunction with getLastObject() to determine the total time spent downloading objects for the step.

Returns:
the first object

getLastObject

TransactionStepObject getLastObject()
Finds the last (chronologically ordered) object associated with this step, or null if there are no objects. Good in conjunction with getFirstObject() to determine the total time spent downloading objects for the step.

Returns:
the last object

getObjects

java.util.List<TransactionStepObject> getObjects()
Returns all objects associated with this step, or an empty list of no objects are.

Returns:
all objects

setStepTimeout

void setStepTimeout(long timeoutInMilliseconds)
Set the timeout, in milliseconds, that the step is allowed to run. If the step runs longer than this time the transaction will error out.

Parameters:
timeoutInMilliseconds - the maximum time, in milliseconds, that this step is allowed to run before the transaction errors out.

getStepTimeout

long getStepTimeout()
Returns the step timeout in milliseconds.

Returns:
the step timeout in milliseconds or -1 if not step timeout is set.

setTimeActive

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

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

verifyItemDownload

void verifyItemDownload(java.lang.String url)
                        throws java.lang.Exception
Verify that the given url matches a downloaded item.

For example:

 var driver = test.openBrowser();
 test.beginTransaction();
 var step = test.beginStep("verifyDownload");
 driver.get("http://cdn.doubleverify.com/monitor/Webmetrics/BS_2.0_Mon-NonSSL.html");
 test.waitForNetworkTrafficToStop(30000, 30000);
 step.verifyItemDownload("http://cdn.doubleverify.com/monitor/Webmetrics/BS_2.0_Mon-NonSSL.html")
 step.verifyItemDownload("http://cdn.doubleverify.com/monitor/Webmetrics/300x250.jpg")
 test.endStep();
 test.endTransaction();
 

Parameters:
url - the url to be verified
Throws:
java.lang.Exception - when url cannot be found from list of downloaded items.

verifyItemDownloadRegex

void verifyItemDownloadRegex(java.lang.String regex)
                             throws java.lang.Exception
Verify that the given regex matches a downloaded item.

For example:

 var driver = test.openBrowser();
 test.beginTransaction();
 var step = test.beginStep("verifyDownload");
 driver.get("http://cdn.doubleverify.com/monitor/Webmetrics/BS_2.0_Mon-NonSSL.html");
 test.waitForNetworkTrafficToStop(30000, 30000);
 step.verifyItemDownloadRegex("http://cdn\.doubleverify\.com/monitor/Web.*")
 step.verifyItemDownloadRegex("http://cdn\.doubleverify\.com/monitor/Webmetrics/300x250\..{3}")
 test.endStep();
 test.endTransaction();
 
Only a partial match is required. E.g. the following:
r.verifyItemDownloadRegex("http://www\.neu.*");
will succeed for both "http://www.neustar.biz/index.htm" and "http://www.neumarkt.de/index.php"

Parameters:
regex - the regular expression to be matched
Throws:
java.lang.Exception - when url cannot be found from list of downloaded items.

Copyright © 2014 Neustar, Inc. All Rights Reserved.