Class WebBrowserScript
- java.lang.Object
-
- com.facilita.fc.runtime.VirtualUserScript
-
- com.facilita.fc.web.WebBrowserScript
-
- All Implemented Interfaces:
DataDictionary
public abstract class WebBrowserScript extends VirtualUserScript
Represents a Web Java Virtual User Script. When a test containing Web Java Virtual Users is run, aWebBrowserVirtualUser
object is created by the eggPlant Performance engine for every Virtual User in the test. TheseWebBrowserVirtualUser
objects runs scripts/workflows by creating instances of script classes (which are subclasses of thisWebBrowserScript
class) and calling thescript()
method on them.Whenever a Web Java Virtual User Script is created using eggPlant Performance Studio, either by recording a web trace and generating the script automatically or by creating a blank script, a template is used to fill in the basic structure of the script.
e.g.
The name you give your script in eggPlant Performance Studio will be used as the name of the class in the script file, and the class will be a subclass ofpackage com.testplant.testing; public class MyNewWebJavaScript extends com.facilita.fc.web.WebBrowserScript { public void pre() throws Exception { super.pre(); // Put any code that needs to execute at the start of the test here } public void script() throws Exception { // Place your iterated script code here. } }
WebBrowserScript
. (If you have customised the Web Java Virtual User type as outlined in the description of theWebBrowserVirtualUser
class, then the script class will be a subclass of the VU Script source class, which will be a subclass ofWebBrowserScript
.)In eggPlant Performance Studio you can define a test which includes a Virtual User Group running your Web Java Virtual User Script (or a workflow containing your script). When the test is run in Test Controller, then code written in the
script()
method will execute. Thescript()
method will be called a number of times, relating to the number of iterations that the VU Group is set to perform. This may be a fixed number per test, or a VU Group can be set to run continuously for a certain period of time.- See Also:
WebBrowserVirtualUser
-
-
Field Summary
-
Fields inherited from class com.facilita.fc.runtime.VirtualUserScript
ct, isMainScript
-
-
Constructor Summary
Constructors Constructor Description WebBrowserScript()
For internal use only.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Protocol
getProtocol(java.lang.String key, java.lang.String defaultValue)
Gets aProtocol
by looking up aString
in this Virtual User's data dictionary.<T> T
getSoapService(java.lang.Class<T> soapServiceInterface, Url url, com.testplant.soap.SoapVersion soapVersion)
WebBrowser
getWebBrowser()
Gets theWebBrowser
belonging to this Virtual User.WebBrowserVirtualUser
getWebBrowserVirtualUser()
Gets theWebBrowserVirtualUser
object that is executing this script.-
Methods inherited from class com.facilita.fc.runtime.VirtualUserScript
acceptCancellation, add, checkIfCancellationRequested, clearProgressPoint, createBackgroundScript, createBackgroundScript, endRequest, endRequest, endTiming, endTiming, endTransaction, endTransaction, endTransaction, error, error, error, error, error, exitVU, exitVU, exitVU, fail, failTiming, failTransaction, failTransaction, finalSequence, finishIterating, finishIteratingRequested, flushEventLog, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, get, get, getBackgroundScriptID, getBackgroundScriptIDs, getBackgroundScriptStatus, getBoolean, getBoolean, getCurrentIteration, getCurrentTimeInXml, getCurrentTransaction, getDataDictionary, getDataDictionary, getDataPath, getDataTable, getDouble, getDouble, getElapsedTime, getFilesDataPath, getFloat, getFloat, getGroupSize, getGroupSize, getGroupSizes, getIndex, getInitialDelay, getInjectorFamilyName, getInjectorName, getInt, getInt, getInteger, getInteger, getIsStopped, getIteration, getIterationDelay, getIterationForTime, getLastError, getLastTransaction, getList, getList, getLong, getLong, getMap, getMaxFailures, getMillisecondsSinceEpoch, getMillisecondsSinceEpoch, getName, getNumberOfErrors, getNumberOfFailures, getNumberOfIterations, getNumberOfWarmupIterations, getNumberOfWarnings, getPauseFactor, getProgressPoint, getRunPath, getSandboxPath, getScriptName, getSecondsSinceEpoch, getSecondsSinceEpoch, getService, getString, getString, getTimingElapsedTime, getTransactionData, getTransactionElapsedTime, getTransactionElapsedTime, getTransactionLoggingOn, getUniqueID, getUniqueID, getVirtualUser, getVU, getVUName, hasKey, isFinalScript, isFirstScript, isInitialScript, isIteratedScript, isLastIteration, isPacing, isReadOnly, keys, lastIterationDelay, logCurrentDataValues, nextIteration, nextScript, nextSequence, onBackgroundScriptCancellation, pause, pause, pre, raiseAlert, recordMetric, recordMetrics, recordTransaction, recordTransaction, recordTransaction, recordTransaction, requestToStopBackgroundScript, resume, resumeBackgroundScript, resumeTransaction, resumeTransaction, script, selectRandomEntryFromList, set, setBackgroundScriptID, setBoolean, setCancellationToken, setDouble, setFloat, setInt, setInteger, setList, setLong, setName, setNumberOfWarmupIterations, setPauseFactor, setProgressPoint, setProgressPoint, setProgressPoint, setString, setSynchronizationPoint, setTransactionLoggingOn, startBackgroundScript, startRequest, startTiming, startTransaction, startTransaction, stopBackgroundScriptImmediately, stopImmediately, suspend, suspendBackgroundScript, suspendTransaction, suspendTransaction, timeToPause, toString, tryToSuspend, unsetSynchronizationPoint, verify, verifyEQ, verifyEQ, verifyEQ, verifyEQ, verifyLE, verifyLE, verifyLE, verifyLE, verifyLT, verifyLT, verifyLT, verifyLT, waitFor, waitForBackgroundScriptToFinish, waitForBoolean, waitForDouble, waitForFloat, waitForInt, waitForList, waitForLong, waitForString, waitForSynchronizationPoint, warn, warn, warn, warn, whereAmI, writeMessage, writeMessage, writeMessage, writeMessage, writeSystemLog, writeSystemLog
-
-
-
-
Method Detail
-
getWebBrowser
public WebBrowser getWebBrowser()
Gets theWebBrowser
belonging to this Virtual User.- Returns:
- the
WebBrowser
belonging to this Virtual User
-
getWebBrowserVirtualUser
public WebBrowserVirtualUser getWebBrowserVirtualUser()
Gets theWebBrowserVirtualUser
object that is executing this script.- Returns:
- the
WebBrowserVirtualUser
object that is executing this script
-
getProtocol
public Protocol getProtocol(java.lang.String key, java.lang.String defaultValue) throws NoSuchValueException, NotAllowedException, BadValueException
Gets aProtocol
by looking up aString
in this Virtual User's data dictionary.e.g.
// Look in the data dictionary for the key "protocol1". If this key doesn't exist, then default to Protocol.HTTP Protocol protocol1 = getProtocol("protocol1", "http");
- Parameters:
key
- the key to look for in the data dictionarydefaultValue
- the default value to use if the specified key does not exist in this Virtual User's data dictionary- Returns:
- the
Protocol
, or aProtocol
relating to thedefaultValue
parameter - Throws:
NoSuchValueException
- Invalid protocol nameNotAllowedException
- The key could not be found in the data dictionaryBadValueException
- The key could not be found in the data dictionary
-
getSoapService
public <T> T getSoapService(java.lang.Class<T> soapServiceInterface, Url url, com.testplant.soap.SoapVersion soapVersion) throws NoSuchValueException, java.lang.NoSuchMethodException, java.lang.SecurityException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
- Throws:
NoSuchValueException
java.lang.NoSuchMethodException
java.lang.SecurityException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
-
-