|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface BrowserMob
The main control interface for BrowserMob scripts - All scripts must start here first. This object allows the
script author to create both Real Bruwser User (RBU) and Virtual User (VU) scripts. This object is available as the
variable browserMob from within the a JavaScript-enabled script. This object is effectively the "starting
point" for all other scripts, as it serves as the interface for interacting with web sites (via openBrowser() and openHttpClient() as well as the mechanism for controling transactions and steps (via
beginTransaction() and beginStep(String)).
filePath(String)),
simulating "user think time" (pause(long)), and parameterizing tests with unique data (getUserNum()
and getTxCount()).
| Method Summary | |
|---|---|
TransactionStep |
beginStep(java.lang.String step)
Starts a BrowserMob step (must be called from within a transaction). |
Transaction |
beginTransaction()
Starts a BrowserMob transaction. |
void |
closeBrowser()
Terminates the active Selenium browser session. |
void |
endStep()
Stops the current step. |
void |
endTransaction()
Ends the current transaction. |
java.lang.String |
filePath(java.lang.String name)
Returns the local path for the specified file name. |
java.lang.String[] |
findRegexMatches(java.lang.String content,
java.lang.String regex)
A simple way to find one or more regular expression matches against some content. |
Transaction |
getActiveTransaction()
Returns the currently active transaction, which is useful for advanced use cases where the transaction object is being manipulated directly. |
CSVTable |
getCSV(java.lang.String name)
Creates and returns a table of data backed by a Comma Separated Value file. |
int |
getTxCount()
Returns the count of transactions that have been completed (regardless of success or failure) for this particular RBU/VU. |
int |
getUserNum()
Returns the unique number for each independent RBU or VU in a load test. |
boolean |
isValidation()
Indicates if the current execution environment is an actual real time script playback or if this is simply a script validation run that is used during script development. |
void |
log(java.lang.String log)
Logs some text to the log buffer. |
Selenium |
openBrowser()
Starts a Selenium browser session. |
HttpClient |
openHttpClient()
Starts a basic HTTP client that is capabable of GET and POST requests, allowing the script author to simulate real web browsers. |
void |
pause(long pauseTimeInMs)
Instructs the script to pause for a specified ammount of time. |
void |
quickStop()
Normally when a load test is paused or the load level drops to fewer concurrent users, BrowserMob allows the actively running scripts to finish executing and complete the current transaction. |
void |
setSimulatedBps(int simulatedBps)
Sets an artificial bits-per-second value for all data transfered to and from the RBU or VU. |
void |
stopExpected()
Tells BrowserMob that the script is expecting that it could be stopped at any time and that if that happens, it should not be considered an error. |
void |
waitForNetworkTrafficToStop(long quietPeriodInMs,
long timeoutInMs)
Waits until no HTTP traffic associated with the current test has taken place for at least quietPeriodInMs. |
| Method Detail |
|---|
Selenium openBrowser()
HttpClient openHttpClient()
Transaction beginTransaction()
TransactionStep beginStep(java.lang.String step)
step - a description of the step, to be used for various reporting.
void endStep()
void pause(long pauseTimeInMs)
throws java.lang.InterruptedException
pauseTimeInMs - the time to pause (in milliseconds).
java.lang.InterruptedException - if the script is paused, stopped, or aborted during executionvoid endTransaction()
Transaction getActiveTransaction()
void closeBrowser()
void setSimulatedBps(int simulatedBps)
simulatedBps - the bits-per-second to simulate.int getUserNum()
int getTxCount()
java.lang.String filePath(java.lang.String name)
name - the name of the file used by the script - usually a simple name like "foo.txt".
void log(java.lang.String log)
log - the text to log.boolean isValidation()
pause(long) function to a shorter time period
when validating the script.
void stopExpected()
quickStop().
void quickStop()
stopExpected().
CSVTable getCSV(java.lang.String name)
name - the name of the CSV file, which you will be asked to upload by BrowserMob upon saving your script the
first time.
void waitForNetworkTrafficToStop(long quietPeriodInMs,
long timeoutInMs)
quietPeriodInMs - the period of time that we expect to not see any HTTP traffic.timeoutInMs - the total time the function should wait before giving up and throwing an error.
java.lang.String[] findRegexMatches(java.lang.String content,
java.lang.String regex)
var matches = browserMob.findRegexMatches(resp.getBody(), '<span class="foo">([^<]*)<span>');
content - the content to match against.regex - the regular expression to match, which should include one and only one regular expression group.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||