Class VirtualUser

  • All Implemented Interfaces:
    com.facilita.fc.runtime.Commands, DataDictionary, com.facilita.fc.runtime.IMonitoredVU, java.lang.Runnable
    Direct Known Subclasses:
    EggplantVirtualUser, SeleniumVirtualUser, WebBrowserVirtualUser

    public class VirtualUser
    extends java.lang.Object
    implements java.lang.Runnable, com.facilita.fc.runtime.Commands, DataDictionary, com.facilita.fc.runtime.IMonitoredVU
    Represents a single Virtual User.

    eggPlant Performance emulates real user activity on a system through Virtual Users. Each Virtual User executes a script, or sequence of scripts (workflow) that contain actions which replicate a real user's interaction with an application. Although a real user requires a single desktop or workstation client, many Virtual Users can be simulated from a single client machine.

    It is important to understand the distinction between a Virtual User (represented by the VirtualUser class) and a Virtual User Script (represented by the VirtualUserScript class). A Virtual User Script defines a series of actions that a user performs when interacting with a client/server application; whereas a Virtual User runs Virtual User Scripts during test execution. A Virtual User can run a single Virtual User Script, or a sequence of Virtual User Scripts. In eggPlant Performance a sequence of Virtual User Scripts is called a Workflow.

    • Field Summary

      • Fields inherited from interface com.facilita.fc.runtime.Commands

        ABORT_CMD, cmds, END_CMD, NULL_CMD, RESUME_CMD, SUSPEND_CMD, TERMINATE_CMD
    • Constructor Summary

      Constructors 
      Constructor Description
      VirtualUser()
      Creates a VirtualUser object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(DataDictionary d)
      Merges the specified DataDictionary into this DataDictionary.
      protected void atEndOfIteration()
      This method is called at the end of every iteration.
      protected void atStartOfIteration()
      This method is called at the start of every iteration.
      void attachLogMessageSender​(com.facilita.fc.runtime.IMessageSender messageSender)
      For internal use only.
      void clearProgressPoint()
      Clears the current progress point set for this Virtual User.
      void createBackgroundScript​(java.lang.String id, java.lang.String vuScriptClassName, AutomaticStopCriteria stopCriterion, java.util.EnumSet<ExecutionFlags> executionFlags, java.time.Duration pauseBetweenScriptsLoops, java.time.Duration autoStopTimeout)
      Creates a new background script and starts it if requested.
      com.facilita.fc.runtime.VUSnapshot createMonitorSnapshot()  
      void endRequest​(java.lang.String request)
      For internal use only.
      void endRequest​(java.lang.String request, MetricCollection metrics)
      For internal use only.
      void endRequest​(java.lang.String request, MetricCollection metrics, VirtualUserScript script)
      For internal use only.
      void endTiming​(java.lang.String id)
      Writes an end timing event to the VU event log.
      void endTiming​(java.lang.String id, boolean pass)
      Writes an end timing event to the VU event log, specifying whether the timing passed.
      void endTiming​(java.lang.String id, boolean pass, VirtualUserScript script)
      Writes an end timing event to the VU event log, specifying whether the timing passed.
      int endTransaction​(java.lang.String id)
      Writes an end transaction event to the VU event log.
      int endTransaction​(java.lang.String id, boolean pass)
      Writes an end transaction event to the VU event log, specifying whether the transaction passed.
      int endTransaction​(java.lang.String id, boolean pass, java.lang.String tag)
      Writes an end transaction event to the VU event log, specifying whether the transaction passed, and specifying a tag which appears in the Info column.
      int endTransaction​(java.lang.String id, boolean pass, java.lang.String tag, VirtualUserScript script)
      Writes an end transaction event to the VU event log, specifying whether the transaction passed, and specifying a tag which appears in the Info column.
      void error​(java.lang.String info)
      Writes an error message to the VU event log.
      void error​(java.lang.String message, java.lang.Exception e)
      Writes an error message to the VU event log, which will include the stack trace of the specified Exception.
      void error​(java.lang.String id, java.lang.String info)
      Writes an error message to the VU event log, specifying an identifier which appears in the ID column.
      void error​(java.lang.String id, java.lang.String info, java.lang.String imagePath)
      Writes an error message and an image link to the VU event log, specifying an identifier which appears in the ID column.
      void error​(java.lang.Throwable e)
      Writes an error message to the VU event log, which will consist of the details of the specified Exception.
      void executeCommand()
      For internal use only.
      void executeCommand​(VirtualUserScript script)
      For internal use only.
      void exitVU()
      Stops execution of this Virtual User.
      void exitVU​(boolean pass)
      Stops execution of this Virtual User, specifying whether the script completed successfully.
      void exitVU​(java.lang.String msg, boolean pass)
      Stops execution of this Virtual User, specifying whether the script completed successfully and a message to display at the end of the event log.
      void fail​(java.lang.String message, boolean throwException)
      Writes a fail event to the VU event log.
      void failAction​(ActionType action, java.lang.String msg)
      Takes the specified action, using the specified error msg.
      void failTiming​(java.lang.String id)
      Writes a fail timing event to the VU event log.
      void failTiming​(java.lang.String id, VirtualUserScript script)
      Writes a fail timing event to the VU event log.
      int failTransaction​(java.lang.String id)
      Writes a fail transaction event to the VU event log.
      int failTransaction​(java.lang.String id, java.lang.String tag)
      Writes a fail transaction event to the VU event log, specifying a tag which appears in the Info column.
      int failTransaction​(java.lang.String id, java.lang.String tag, VirtualUserScript script)
      Writes a fail transaction event to the VU event log, specifying a tag which appears in the Info column.
      void finalSequence()
      Stops execution of the current script and then executes the scripts in the final section of the current workflow.
      void finishIterating()
      Prevents further iterations of the iterated sequence of scripts for this Virtual User.
      boolean finishIteratingRequested()
      Returns true if this Virtual User has been requested to finish iterating.
      void flushEventLog()
      Flushes the event log to disk.
      static java.lang.String formatDateTime​(java.lang.String format)
      Converts the current date/time to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.Duration offset)
      Converts the current date/time, offset by a specified Duration, to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.Duration offset, java.time.ZoneId timezone)
      Converts the current date/time to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.Duration offset, java.time.ZoneId timezone, java.util.Locale locale)
      Converts the current date/time to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.Duration offset, java.util.Locale locale)
      Converts the current date/time to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.LocalDateTime dateTime)
      Converts a LocalDateTime object to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.LocalDateTime dateTime, java.time.Duration offset)
      Converts a LocalDateTime object to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.LocalDateTime dateTime, java.time.Duration offset, java.time.ZoneId timezone)
      Converts a LocalDateTime object to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.LocalDateTime dateTime, java.time.Duration offset, java.time.ZoneId timezone, java.util.Locale locale)
      Converts a LocalDateTime object to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.LocalDateTime dateTime, java.time.Duration offset, java.util.Locale locale)
      Converts a LocalDateTime object to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.LocalDateTime dateTime, java.time.ZoneId timezone)
      Converts a LocalDateTime object to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.LocalDateTime dateTime, java.time.ZoneId timezone, java.util.Locale locale)
      Converts a LocalDateTime object to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.LocalDateTime dateTime, java.util.Locale locale)
      Converts a LocalDateTime object to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.ZoneId timezone)
      Converts the current date/time to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.time.ZoneId timezone, java.util.Locale locale)
      Converts the current date/time to its equivalent string representation using the specified format.
      static java.lang.String formatDateTime​(java.lang.String format, java.util.Locale locale)
      Converts the current date/time to its equivalent string representation using the specified format.
      <T> T get​(java.lang.String key)
      Returns a reference to an Object held in the dictionary.
      java.lang.Object get​(java.lang.String key, java.lang.Object defaultValue)
      Returns an Object value held in the dictionary, or the defaultValue if the key cannot be found.
      java.util.List<java.lang.String> getBackgroundScriptIDs()
      Returns a list of currently registered with the VU background script IDs.
      ScriptStatus getBackgroundScriptStatus​(java.lang.String id)
      Returns a status of the given background script.
      boolean getBoolean​(java.lang.String key)
      Returns a boolean value held in the dictionary.
      boolean getBoolean​(java.lang.String key, boolean defaultValue)
      Returns a boolean value held in the dictionary, or the defaultValue if the key cannot be found.
      int getContextState()
      For internal user only
      int getCurrentIteration()
      Gets the number of the iteration that this Virtual User is currently executing (beginning at 1).
      VirtualUserScript getCurrentScript()
      Gets the currently-executing script.
      static javax.xml.datatype.XMLGregorianCalendar getCurrentTimeInXml()  
      java.lang.String getCurrentTransaction()
      Gets the name of the transaction that is currently in progress.
      com.facilita.fc.runtime.CompoundDataDictionary getDataDictionary()
      Gets the Data Dictionary belonging to this VirtualUser.
      DataDictionary getDataDictionary​(java.lang.String key)
      Gets the Data Dictionary named with the specified key and assigned to the Virtual User in eggPlant Performance Studio.
      java.lang.String getDataPath()
      Gets the path to the data folder.
      DataTable getDataTable​(java.lang.String key)
      Gets the specified Data Table.
      double getDouble​(java.lang.String key)
      Returns a double value held in the dictionary.
      double getDouble​(java.lang.String key, double defaultValue)
      Returns a double value held in the dictionary, or the defaultValue if the key cannot be found.
      int getElapsedTime()
      Gets the elapsed time since the beginning of the test, in milliseconds.
      java.lang.String getFilesDataPath()
      Gets the path of the data\Files folder.
      float getFloat​(java.lang.String key)
      Returns a float value held in the dictionary.
      float getFloat​(java.lang.String key, float defaultValue)
      Returns a float value held in the dictionary, or the defaultValue if the key cannot be found.
      int getGroupSize()
      Gets the number of Virtual Users in the group that this Virtual User belongs to.
      int getGroupSize​(java.lang.String groupName)
      Gets the number of Virtual Users in the specified Virtual User group.
      com.facilita.fc.runtime.SimpleDataDictionary getGroupSizes()
      Gets the number of Virtual Users in each Virtual User group.
      int getIndex()
      Gets the index number of this Virtual User within the Virtual User group that it belongs to.
      int getIndexForEngineGroup()
      For internal use only.
      int getInitialDelay()
      Gets the initial delay for this Virtual User, between the start of the test and the start of the first script execution.
      java.lang.String getInjectorFamilyName()
      Returns the injector family name
      java.lang.String getInjectorName()
      Returns the injector machine name
      int getInt​(java.lang.String key)
      Returns an int value held in the dictionary.
      int getInt​(java.lang.String key, int defaultValue)
      Returns an int value held in the dictionary, or the defaultValue if the key cannot be found.
      java.lang.Integer getInteger​(java.lang.String key)
      Returns a java.lang.Integer value held in the dictionary.
      java.lang.Integer getInteger​(java.lang.String key, java.lang.Integer defaultValue)
      Returns a java.lang.Integer value held in the dictionary, or the defaultValue if the key cannot be found.
      int getIteration()
      Gets the number of the iteration that this Virtual User is currently executing (beginning at 0).
      int getIterationDelay()
      Gets the delay time in milliseconds between iterations of the repeated sequence of scripts.
      int getIterationForTime()
      Gets the time in milliseconds that the iterated sequence of scripts will iterate for.
      java.lang.String getJmeterTestPlanName()  
      java.lang.String getLastError()
      Gets the most recent error encountered by this Virtual User.
      java.lang.String getLastTransaction()
      Gets the name of the most recent transaction to have ended.
      java.util.List getList​(java.lang.String key)
      Returns a List value held in the dictionary.
      java.util.List getList​(java.lang.String key, java.util.List defaultList)
      Returns a List value held in the dictionary, or the defaultList if the key cannot be found.
      long getLong​(java.lang.String key)
      Returns a long value held in the dictionary.
      long getLong​(java.lang.String key, long defaultValue)
      Returns a long value held in the dictionary, or the defaultValue if the key cannot be found.
      java.util.Map getMap()
      Gets a Map containing all the keys/values in this dictionary.
      int getMaxFailures()
      Gets the maximum number of failures allowed in the script before this Virtual User terminates.
      static java.lang.String getMillisecondsSinceEpoch()  
      static java.lang.String getMillisecondsSinceEpoch​(long offset)  
      java.lang.String getName()
      Gets the name of this dictionary.
      int getNumberOfErrors()
      Gets the number of errors that have been reported for this Virtual User.
      int getNumberOfFailures()
      Gets the current number of script failures for this Virtual User.
      int getNumberOfIterations()
      Gets the total number of iterations that the repeated sequence of scripts will execute.
      int getNumberOfWarmupIterations()
      Gets the number of warm-up iterations for this Virtual User.
      int getNumberOfWarnings()
      Gets the number of warnings that have been reported for this Virtual User.
      int getPauseFactor()
      Gets the current percentage pause factor.
      java.lang.String getProgressPoint()
      Gets the text of the most recent progress point that was set.
      java.lang.String getRunPath()
      Gets the path to the test run results.
      java.lang.String getSandboxPath()
      Gets the path to the sandbox location.
      static java.lang.String getSecondsSinceEpoch()  
      static java.lang.String getSecondsSinceEpoch​(long offset)  
      com.facilita.fc.runtime.Service getService​(java.lang.Class<com.facilita.fc.runtime.Service> serviceClass)
      Get a Service object of the specified type
      protected java.util.List<com.facilita.fc.runtime.Service<?>> getServices()  
      long getStartTime()
      For internal use only.
      int getStartTimeSeconds()
      For internal use only.
      java.lang.String getString​(java.lang.String key)
      Returns a String value held in the dictionary.
      java.lang.String getString​(java.lang.String key, java.lang.String defaultValue)
      Returns a String value held in the dictionary, or the defaultValue if the key cannot be found.
      int getTimingElapsedTime()
      Gets the elapsed time of the current active timing.
      int getTimingElapsedTime​(VirtualUserScript script)
      Gets the elapsed time of the current active timing.
      TransactionData getTransactionData​(java.lang.String id)
      Get data about the specified transaction.
      int getTransactionElapsedTime​(java.lang.String id)
      Gets the current elapsed time of the transaction with the specified id.
      int getTransactionElapsedTime​(java.lang.String id, java.lang.String tag)
      Gets the current elapsed time of the transaction with the specified id and tag.
      int getTransactionElapsedTime​(java.lang.String id, java.lang.String tag, VirtualUserScript script)
      Gets the current elapsed time of the transaction with the specified id and tag.
      boolean getTransactionLoggingOn()
      Returns true if transactions should be logged for this VU.
      int getUniqueID()
      Gets a test-wide unique identifier for this Virtual User.
      int getUniqueID​(java.lang.String groupName, int index)
      Gets a test-wide unique identifier for a specified Virtual User within a Virtual User group.
      java.lang.String getVUName()
      Gets the name of the group that this Virtual User belongs to.
      boolean hasKey​(java.lang.String key)
      Returns true if the specified key is contained within the dictionary.
      boolean isDebugMode()  
      boolean isFinalScript()
      Returns true if the current executing script is within the final section of this Virtual User's workflow.
      boolean isFirstScript()
      Returns true if the current executing script is the first script to be executed.
      boolean isInitialScript()
      Returns true if the current executing script is within the initial section of this Virtual User's workflow.
      boolean isIteratedScript()
      Returns true if the current executing script is within the repeated section of this Virtual User's workflow.
      boolean isLastIteration()
      Returns true if more iterations will occur for the current Virtual User.
      boolean isPacing()
      Returns true if this Virtual User will adjust the delay between iterations to maintain a steady pace of iterations.
      boolean isReadOnly()
      Returns true if this dictionary is read-only.
      java.util.Iterator keys()
      Returns an Iterator that can be used to iterate over the keys in this dictionary.
      int lastIterationDelay()
      Gets the delay time in milliseconds between the previous iteration and the current iteration.
      void logCurrentDataValues()
      Write all of the current data values to the VU event log
      void nextIteration()
      Stops execution of the current script, and starts execution of the next iteration.
      void nextScript()
      Stops execution of the current script, and starts execution of the next script in the sequence.
      void nextSequence()
      Stops execution of the current script and any other scripts in the current sequence, and starts execution of the next sequence of scripts.
      static long nowSeconds()
      For internal use only.
      protected void onDataDictionaryChanged()  
      protected void onEndTiming​(java.lang.String timing, boolean pass)
      This method is called whenever a timing is ended using the endTiming(String) or endTiming(String, boolean) methods.
      protected void onEndTransaction​(java.lang.String id, boolean pass, java.lang.String tag)
      protected boolean onError​(java.lang.String id, java.lang.String info)
      This method is called whenever an error is written to the VU event log using the error(String), error(String, Exception) or error(String, String) methods.
      protected boolean onException​(java.lang.Exception e)
      This method is called whenever an unhandled exception is thrown by a script.
      protected void onExitVU​(java.lang.String msg, boolean pass)
      This method is called whenever the Virtual User stops execution as a result of the exitVU(), exitVU(boolean) or exitVU(String, boolean) methods.
      protected void onRaiseAlert​(int severity, java.lang.String description)
      This method is called whenever an alert is raised using the raiseAlert(int, String) method.
      protected void onResumeTransaction​(java.lang.String id, java.lang.String tag)
      This method is called whenever a transaction is resumed using the resumeTransaction(String) or resumeTransaction(String, String) methods.
      protected void onSetProgressPoint​(java.lang.String progressPoint, java.lang.String info, boolean pass)
      This method is called whenever a progress point is set using the setProgressPoint(String), setProgressPoint(String, boolean) or setProgressPoint(String, String, boolean) methods.
      void onStartFinalSection()
      This method is called whenever the Virtual User is about to start executing the final sequence of scripts in its workflow.
      void onStartInitialSection()
      This method is called whenever the Virtual User is about to start executing the initial sequence of scripts in its workflow.
      protected void onStartTiming​(java.lang.String timing)
      This method is called whenever a timing is started using the startTiming(String) method.
      protected void onStartTransaction​(java.lang.String id, java.lang.String tag)
      This method is called whenever a transaction is started using the startTransaction(String) or startTransaction(String, String) methods.
      protected void onSuspendTransaction​(java.lang.String id, java.lang.String tag)
      This method is called whenever a transaction is suspended using the suspendTransaction(String) or suspendTransaction(String, String) methods.
      protected boolean onWarn​(java.lang.String id, java.lang.String info)
      This method is called whenever a warning is written to the VU event log using the warn(String) or warn(String, String) methods.
      protected void onWriteMessage​(java.lang.String id, java.lang.String message)
      This method is called whenever an information message is written to the VU event log using the writeMessage(String) or writeMessage(String, String) methods.
      void openEventLog()
      For internal use only.
      int pause()
      Pauses the execution of the script.
      int pause​(int interval)
      Pauses the execution of the script for a specified interval (modified by getPauseFactor()).
      int pause​(int interval, VirtualUserScript script)
      Pauses the execution of the script for a specified interval (modified by getPauseFactor()).
      int pause​(VirtualUserScript script)
      Pauses the execution of the script.
      protected void post()
      This method is called after all scripts have finished executing.
      protected void pre()
      This method is called before any scripts are executed.
      void raiseAlert​(int severity, java.lang.String message)
      Writes an alert of the specified severity to the Alerts table in Test Controller.
      void recordMetric​(java.lang.String name, int value)
      Records a user metric.
      void recordMetric​(java.lang.String name, int value, VirtualUserScript script)
      Records a user metric.
      void recordMetrics​(MetricCollection metrics)
      Records multiple user metrics simultaneously.
      void recordMetrics​(MetricCollection metrics, VirtualUserScript script)
      Records multiple user metrics simultaneously.
      void recordTransaction​(java.lang.String id, int startTime, int duration)
      Records a transaction in the VU event log.
      void recordTransaction​(java.lang.String id, int startTime, int duration, boolean pass)
      Records a transaction in the VU event log, specifying whether the transaction passed.
      void recordTransaction​(java.lang.String id, int startTime, int duration, boolean pass, VirtualUserScript script)
      Records a transaction in the VU event log, specifying whether the transaction passed.
      void recordTransaction​(java.lang.String id, java.util.Date startTime, int duration)
      Records a transaction in the VU event log.
      void recordTransaction​(java.lang.String id, java.util.Date startTime, int duration, boolean pass)
      Records a transaction in the VU event log, specifying whether the transaction passed.
      void recordTransaction​(java.lang.String id, java.util.Date startTime, int duration, boolean pass, VirtualUserScript script)
      Records a transaction in the VU event log, specifying whether the transaction passed.
      void requestToStopBackgroundScript​(java.lang.String id)
      Requests currently running background script to stop.
      void resumeBackgroundScript​(java.lang.String id)
      Resumes currently suspended background script.
      void resumeTransaction​(java.lang.String id)
      Resumes the timing of the specified transaction.
      void resumeTransaction​(java.lang.String id, java.lang.String tag)
      Resumes the timing of the specified transaction, identified by tag as well as id.
      void resumeTransaction​(java.lang.String id, java.lang.String tag, VirtualUserScript script)
      Resumes the timing of the specified transaction, identified by tag as well as id.
      void run()  
      void runAsBackgroundThread​(VirtualUserScript script)  
      <T> T selectRandomEntryFromList​(java.lang.String key)
      Selects a random entry from a list stored in this Virtual User's data dictionary.
      <T> void set​(java.lang.String key, T item)
      Sets an Object value in the dictionary.
      void setBoolean​(java.lang.String key, boolean b)
      Sets a boolean value in the dictionary.
      void setDebugMode​(boolean debugMode)  
      void setDouble​(java.lang.String key, double i)
      Sets a double value in the dictionary.
      void setFloat​(java.lang.String key, float i)
      Sets a float value in the dictionary.
      void setInt​(java.lang.String key, int i)
      Sets an int value in the dictionary.
      void setInteger​(java.lang.String key, java.lang.Integer i)
      Sets an Integer value in the dictionary.
      void setList​(java.lang.String key, java.util.List list)
      Sets a List value in the dictionary.
      void setLong​(java.lang.String key, long i)
      Sets a long value in the dictionary.
      void setName​(java.lang.String name)
      Sets the name of this dictionary.
      void setNumberOfWarmupIterations​(int numberOfWarmupIterations)
      Sets the number of warm-up iterations for this Virtual User.
      void setPauseFactor​(int pauseFactor)
      Sets the current percentage pause factor.
      void setProgressPoint​(java.lang.String progressPoint)
      Sets a progress point in the VU event log.
      void setProgressPoint​(java.lang.String progressPoint, boolean pass)
      Sets a progress point in the VU event log, specifying whether the progress point passed.
      void setProgressPoint​(java.lang.String progressPoint, java.lang.String info, boolean pass)
      Sets a progress point in the VU event log, specifying whether the progress point passed and specifying extra information which appears in the Info column.
      void setProgressPoint​(java.lang.String progressPoint, java.lang.String info, boolean pass, VirtualUserScript script)
      Sets a progress point in the VU event log, specifying whether the progress point passed and specifying extra information which appears in the Info column.
      void setString​(java.lang.String key, java.lang.String string)
      Sets a String value in the dictionary.
      void setSynchronizationPoint​(java.lang.String id)
      Set a named synchronization point.
      void setTransactionLoggingOn​(boolean value)
      Sets whether transactions should be logged for this VU.
      protected void setup​(com.facilita.fc.runtime.EventLog eventLog, com.facilita.util.Time time, com.facilita.fc.runtime.CompoundDataDictionary dataDictionary, int index, java.lang.String vuName, com.facilita.fc.runtime.SimpleDataDictionary groupSizes, com.facilita.fc.runtime.VUGroup group, com.facilita.fc.runtime.AlertManager alertManager)
      For internal use only.
      void startBackgroundScript​(java.lang.String id)
      Starts previously created and not started background script.
      void startCustomVUWatcher()
      For internal use only.
      void startRequest​(java.lang.String request)
      For internal use only.
      void startRequest​(java.lang.String request, VirtualUserScript script)
      For internal use only.
      void startTiming​(java.lang.String id)
      Writes a start timing event to the VU event log.
      void startTransaction​(java.lang.String id)
      Writes a start transaction event to the VU event log.
      void startTransaction​(java.lang.String id, java.lang.String tag)  
      void startTransaction​(java.lang.String id, java.lang.String tag, VirtualUserScript script)
      Writes a start transaction event to the VU event log, specifying a tag which appears in the Info column.
      void stopBackgroundScriptImmediately​(java.lang.String id)
      Tells the script to stop immediately.
      void stopCustomVUWatcher()
      For internal use only.
      void suspendBackgroundScript​(java.lang.String id)
      Suspends currently executing background script.
      void suspendTransaction​(java.lang.String id)
      Suspends the timing of the specified transaction.
      void suspendTransaction​(java.lang.String id, java.lang.String tag)
      Suspends the timing of the specified transaction, identified by tag as well as id.
      void suspendTransaction​(java.lang.String id, java.lang.String tag, VirtualUserScript script)
      Suspends the timing of the specified transaction, identified by tag as well as id.
      int timeToPause​(int interval)
      Gets the length of time that this Virtual User would pause for if pause(int) were called with the specified interval.
      java.lang.String toString()
      Returns a String representation of the dictionary.
      void unsetSynchronizationPoint​(java.lang.String id)
      Unset a named synchronization point.
      boolean verify​(boolean arg, boolean throwException)
      Verifies that a boolean expression is true.
      boolean verifyEQ​(double arg1, double arg2, double delta, boolean throwException)
      Verifies that two doubles are equal.
      boolean verifyEQ​(int arg1, int arg2, boolean throwException)
      Verifies that two integers are equal.
      boolean verifyEQ​(long arg1, long arg2, boolean throwException)
      Verifies that two longs are equal.
      boolean verifyEQ​(java.lang.String arg1, java.lang.String arg2, boolean throwException, boolean caseInsensitive)
      Verifies that two String objects are equal.
      boolean verifyLE​(double arg1, double arg2, double delta, boolean throwException)
      Verifies that one double is less than or equal to another.
      boolean verifyLE​(int arg1, int arg2, boolean throwException)
      Verifies that one integer is less than or equal to another.
      boolean verifyLE​(long arg1, long arg2, boolean throwException)
      Verifies that one long is less than or equal to another.
      boolean verifyLE​(java.lang.String arg1, java.lang.String arg2, boolean throwException, boolean caseInsensitive)
      Verifies that one String is less than or equal to another.
      boolean verifyLT​(double arg1, double arg2, double delta, boolean throwException)
      Verifies that one double is less than another.
      boolean verifyLT​(int arg1, int arg2, boolean throwException)
      Verifies that one integer is less than another.
      boolean verifyLT​(long arg1, long arg2, boolean throwException)
      Verifies that one long is less than another.
      boolean verifyLT​(java.lang.String arg1, java.lang.String arg2, boolean throwException, boolean caseInsensitive)
      Verifies that one String is less than another.
      <T> T waitFor​(java.lang.String key, long timeout)
      Returns a reference to an object stored in the data dictionary.
      void waitForBackgroundScriptToFinish​(java.lang.String id, java.time.Duration timeout)
      Waits for the background script to finish work in the given timeout, if timeout is not provided or null it waits until the tasks finish (if at all), if timeout is not null, then it returns false if it expired before the timeout reached.
      boolean waitForBoolean​(java.lang.String key, long timeout)
      Returns a boolean stored in the data dictionary.
      double waitForDouble​(java.lang.String key, long timeout)
      Returns a double stored in the data dictionary.
      float waitForFloat​(java.lang.String key, long timeout)
      Returns a float stored in the data dictionary.
      int waitForInt​(java.lang.String key, long timeout)
      Returns an int stored in the data dictionary.
      java.util.List waitForList​(java.lang.String key, long timeout)
      Returns a reference to a List stored in the data dictionary.
      long waitForLong​(java.lang.String key, long timeout)
      Returns a long stored in the data dictionary.
      java.lang.String waitForString​(java.lang.String key, long timeout)
      Returns a reference to a String stored in the data dictionary.
      void waitForSynchronizationPoint​(java.lang.String id, long timeoutMilliseconds)
      Wait for a named synchronization point to be set.
      void warn​(java.lang.Exception e)
      Writes a warning message to the VU event log, consisting of the specified exception
      void warn​(java.lang.String info)
      Writes a warning message to the VU event log.
      void warn​(java.lang.String id, java.lang.String info)
      Writes a warning message to the VU event log, specifying an identifier which appears in the ID column.
      void warn​(java.lang.String id, java.lang.String info, java.lang.String imagePath)
      Writes a warning message and an image link to the VU event log, specifying an identifier which appears in the ID column.
      void writeMessage​(java.lang.Exception e)
      Write an information message to the VU event log, consisting of the exception specified.
      void writeMessage​(java.lang.String message)
      Writes an information message to the VU event log.
      void writeMessage​(java.lang.String id, java.lang.String message)
      Writes an information message to the VU event log, specifying an identifier which appears in the ID column.
      void writeMessage​(java.lang.String id, java.lang.String info, java.lang.String imagePath)
      Writes an information message to the VU event log and also a link to an image, specifying an identifier which appears in the ID column.
      void writeSystemLog​(java.lang.String message)
      Writes an alert of Error severity to the Alerts table in Test Controller.
      void writeSystemLog​(java.lang.String heading, java.lang.String message)
      Writes an alert of Error severity to the Alerts table in Test Controller, specifying a heading to prefix to the message.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • VirtualUser

        public VirtualUser()
        Creates a VirtualUser object.
    • Method Detail

      • getBackgroundScriptIDs

        public java.util.List<java.lang.String> getBackgroundScriptIDs()
        Returns a list of currently registered with the VU background script IDs.
        Returns:
        a list of currently registered with the VU background script IDs.
      • getBackgroundScriptStatus

        public ScriptStatus getBackgroundScriptStatus​(java.lang.String id)
        Returns a status of the given background script.
        Parameters:
        id - Unique script ID, identifying the background script.
        Returns:
        the status of the specified background script
      • createBackgroundScript

        public void createBackgroundScript​(java.lang.String id,
                                           java.lang.String vuScriptClassName,
                                           AutomaticStopCriteria stopCriterion,
                                           java.util.EnumSet<ExecutionFlags> executionFlags,
                                           java.time.Duration pauseBetweenScriptsLoops,
                                           java.time.Duration autoStopTimeout)
                                    throws java.lang.Exception
        Creates a new background script and starts it if requested.
        Parameters:
        id - Unique script ID, identifying the background script.
        vuScriptClassName - Fully qualified script's class name.
        stopCriterion - Automatic stop criterion, describing how and when to terminate the background script (if at all).
        executionFlags - Bitwise flags describing execution of the script.
        pauseBetweenScriptsLoops - If script is run in a loop (executionFlags contain ExecutionFlags.Loop) then you can set the pause between such loops. Zero here means no pause.
        autoStopTimeout - Automatic timeout is used when stopCriterion is not AutomaticStopCriteria.NeverStopAutomatically. If it is null, default setting from VU Group is used instead. Zero here means no wait. -1 ms timeout mean indefinite timeout.
        Throws:
        java.lang.Exception - An error occurred
      • startBackgroundScript

        public void startBackgroundScript​(java.lang.String id)
        Starts previously created and not started background script.
        Parameters:
        id - Unique script ID, identifying the background script.
      • requestToStopBackgroundScript

        public void requestToStopBackgroundScript​(java.lang.String id)
                                           throws java.lang.InterruptedException
        Requests currently running background script to stop. Since it just requests it to stop, the background script must check periodically if it was asked to do so and gracefully exit when detects it by checking this.ct.IsCancellationRequested flag.
        Parameters:
        id - Unique script ID, identifying the background script.
        Throws:
        java.lang.InterruptedException - if any thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.
      • stopBackgroundScriptImmediately

        public void stopBackgroundScriptImmediately​(java.lang.String id)
                                             throws java.lang.InterruptedException
        Tells the script to stop immediately. It will result in the script terminating if it calls any API or exits itself by checking this.ct.IsCancellationRequested flag. Mind that if it does something in a tight loop or made a call to another library it can take as much time as it needed to finish those operations.
        Parameters:
        id - Unique script ID, identifying the background script.
        Throws:
        java.lang.InterruptedException - if any thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.
      • suspendBackgroundScript

        public void suspendBackgroundScript​(java.lang.String id)
                                     throws java.lang.InterruptedException,
                                            java.util.concurrent.ExecutionException
        Suspends currently executing background script.
        Parameters:
        id - Unique script ID, identifying the background script.
        Throws:
        java.lang.InterruptedException - if any thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.
        java.util.concurrent.ExecutionException - when attempting to retrieve the result of a task that aborted by throwing an exception
      • resumeBackgroundScript

        public void resumeBackgroundScript​(java.lang.String id)
                                    throws java.lang.InterruptedException,
                                           java.util.concurrent.ExecutionException
        Resumes currently suspended background script.
        Parameters:
        id - Unique script ID, identifying the background script.
        Throws:
        java.lang.InterruptedException - if any thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.
        java.util.concurrent.ExecutionException - when attempting to retrieve the result of a task that aborted by throwing an exception
      • waitForBackgroundScriptToFinish

        public void waitForBackgroundScriptToFinish​(java.lang.String id,
                                                    java.time.Duration timeout)
                                             throws java.lang.InterruptedException
        Waits for the background script to finish work in the given timeout, if timeout is not provided or null it waits until the tasks finish (if at all), if timeout is not null, then it returns false if it expired before the timeout reached.
        Parameters:
        id - Unique script ID, identifying the background script.
        timeout - How long to wait before give up. Zero timeout means no waiting, -1 ms timeout means indefinite timeout
        Throws:
        java.lang.InterruptedException - if any thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.
      • getService

        public com.facilita.fc.runtime.Service getService​(java.lang.Class<com.facilita.fc.runtime.Service> serviceClass)
                                                   throws NoSuchValueException,
                                                          java.lang.NoSuchMethodException,
                                                          java.lang.SecurityException,
                                                          java.lang.InstantiationException,
                                                          java.lang.IllegalAccessException,
                                                          java.lang.IllegalArgumentException,
                                                          java.lang.reflect.InvocationTargetException
        Get a Service object of the specified type
        Parameters:
        serviceClass - the type of Service object to get
        Returns:
        a Service object of the specified type
        Throws:
        NoSuchValueException - Unknown service class
        java.lang.NoSuchMethodException - Failed to construct service instance
        java.lang.SecurityException - Failed to construct service instance
        java.lang.InstantiationException - Failed to construct service instance
        java.lang.IllegalAccessException - Failed to construct service instance
        java.lang.IllegalArgumentException - Failed to construct service instance
        java.lang.reflect.InvocationTargetException - Failed to construct service instance
      • getServices

        protected final java.util.List<com.facilita.fc.runtime.Service<?>> getServices()
                                                                                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
      • getCurrentScript

        public final VirtualUserScript getCurrentScript()
        Gets the currently-executing script.
        Returns:
        the currently-executing script
      • isInitialScript

        public final boolean isInitialScript()
        Returns true if the current executing script is within the initial section of this Virtual User's workflow.
        Returns:
        true if the current executing script is within the initial section of this Virtual User's workflow
        See Also:
        isFinalScript(), isIteratedScript()
      • isIteratedScript

        public final boolean isIteratedScript()
        Returns true if the current executing script is within the repeated section of this Virtual User's workflow.
        Returns:
        true if the current executing script is within the repeated section of this Virtual User's workflow
        See Also:
        isInitialScript(), isFinalScript()
      • isFinalScript

        public final boolean isFinalScript()
        Returns true if the current executing script is within the final section of this Virtual User's workflow.
        Returns:
        true if the current executing script is within the final section of this Virtual User's workflow
        See Also:
        isInitialScript(), isIteratedScript()
      • isFirstScript

        public boolean isFirstScript()
        Returns true if the current executing script is the first script to be executed.
        Returns:
        Returns true if the current executing script is the first script to be executed.
      • getNumberOfFailures

        public final int getNumberOfFailures()
        Gets the current number of script failures for this Virtual User.

        Failures are exceptions - such as communication exceptions - which are caught and produce an error message in the event log. They do not cause the Virtual User to exit until the number of failures reaches the value returned by getMaxFailures().

        Returns:
        the current number of script failures for this Virtual User
        See Also:
        getMaxFailures()
      • getMaxFailures

        public final int getMaxFailures()
        Gets the maximum number of failures allowed in the script before this Virtual User terminates.

        Failures are exceptions - such as communication exceptions - which are caught and produce an error message in the event log. They do not cause the Virtual User to exit until the number of failures reaches this value.

        Returns:
        the maximum number of failures allowed in the script before this Virtual User terminates
        See Also:
        getNumberOfFailures()
      • getIterationForTime

        public final int getIterationForTime()
        Gets the time in milliseconds that the iterated sequence of scripts will iterate for.
        • Returns 0 if the iterated sequence of scripts have been set to execute a certain number of iterations, or to iterate forever.
        • Returns a value greater than 0 if the iterated sequence of scripts have been set to execute for a given length of time.
        In the second case, the value returned is the amount of time to be spent iterating. Once this length of time is met or exceeded, no further iterations of the iterated sequence of scripts will occur.
        Returns:
        the time in milliseconds that the iterated sequence of scripts will iterate for
      • isLastIteration

        public final boolean isLastIteration()
        Returns true if more iterations will occur for the current Virtual User.

        If the currently executing script belongs to the initial or final sequence of scripts in this Virtual User's workflow, then this will always return true.

        If the currently executing script belongs to the iterated sequence of scripts and this method returns true, then the VU will cease to iterate once the current sequence has completed execution.

        If the Virtual User is set to iterate for a certain length of time, then the time remaining is checked and an estimate is made as to whether further iterations may occur.

        Returns:
        true if there will be no more iterations in the current sequence
      • getIterationDelay

        public final int getIterationDelay()
        Gets the delay time in milliseconds between iterations of the repeated sequence of scripts.

        This is the value set in the VU Group runtime properties in eggPlant Performance Studio. If the pacing option is selected, then the iteration delay value is adjusted each time to maintain a fixed rate of script iterations.

        Returns:
        the time between iterations, in milliseconds
        See Also:
        lastIterationDelay()
      • lastIterationDelay

        public final int lastIterationDelay()
        Gets the delay time in milliseconds between the previous iteration and the current iteration.

        This method will return zero on the first iteration. If the pacing option is selected, then the iteration delay value is adjusted each time to maintain a fixed rate of script iterations.

        Returns:
        the time between the previous iteration and the current iteration, in milliseconds
        See Also:
        getIterationDelay(), isPacing()
      • isPacing

        public final boolean isPacing()
        Returns true if this Virtual User will adjust the delay between iterations to maintain a steady pace of iterations.

        The Virtual User pauses between each iteration of the iterated sequence of scripts. If the pacing option is selected in the VU Group runtime properties in eggPlant Performance Studio, then the iteration delay value is adjusted each time to maintain a fixed rate of script iterations.

        Returns:
        true if this Virtual User will adjust the delay between iterations to maintain a steady pace of iterations
        See Also:
        getIterationDelay()
      • getTransactionLoggingOn

        public final boolean getTransactionLoggingOn()
        Returns true if transactions should be logged for this VU.

        When the Transaction Logging flag is false, start and end transaction events are not written to the event log.

        Returns:
        true if transactions should be logged
        See Also:
        setTransactionLoggingOn(boolean)
      • setTransactionLoggingOn

        public final void setTransactionLoggingOn​(boolean value)
        Sets whether transactions should be logged for this VU.

        When the Transaction Logging flag is false, start and end transaction events are not written to the event log.

        Parameters:
        value - true if transactions should be logged
        See Also:
        getTransactionLoggingOn()
      • finishIterating

        public final void finishIterating()
        Prevents further iterations of the iterated sequence of scripts for this Virtual User.

        The current script will continue executing, and any subsequent scripts in the iterated sequence of scripts will also be executed. Once the end of the iteration is reached, the Virtual User will not start another iteration but will instead execute the scripts in the final sequence of scripts before exiting.

      • finishIteratingRequested

        public boolean finishIteratingRequested()
        Returns true if this Virtual User has been requested to finish iterating. This happens when finishIterating() is called.
        Returns:
        true if this Virtual User has been requested to finish iterating
      • getNumberOfIterations

        public final int getNumberOfIterations()
        Gets the total number of iterations that the repeated sequence of scripts will execute.

        A return value of zero indicates that the iterated scripts are iterating for a specified time or forever, and not for a specified number of iterations.

        Returns:
        the number of iterations that the repeated sequence of scripts will execute, as set in the VU Group runtime settings in eggPlant Performance Studio
      • getNumberOfWarmupIterations

        public final int getNumberOfWarmupIterations()
        Gets the number of warm-up iterations for this Virtual User.

        The value indicates the number of warm-up iterations this Virtual User will execute and is only relevant to the repeated sequence of scripts. Warm-up iterations are considered to be of no interest statistically and during a warm-up iteration the start and end transaction events are not written to the VU event log.

        Returns:
        the number of warm-up iterations for this Virtual User
        See Also:
        startTransaction(String), endTransaction(String)
      • setNumberOfWarmupIterations

        public final void setNumberOfWarmupIterations​(int numberOfWarmupIterations)
        Sets the number of warm-up iterations for this Virtual User.

        The value indicates the number of warm-up iterations this Virtual User will execute and is only relevant to the repeated sequence of scripts. Warm-up iterations are considered to be of no interest statistically and during a warm-up iteration the start and end transaction events are not written to the VU event log.

        Parameters:
        numberOfWarmupIterations - the number of warm-up iterations for this VU
        See Also:
        startTransaction(String), endTransaction(String)
      • getCurrentIteration

        public final int getCurrentIteration()
        Gets the number of the iteration that this Virtual User is currently executing (beginning at 1).

        As a Virtual User completes execution of the iterated sequence of scripts, the iteration number is increased by 1 and execution of the next iteration of the iterated sequence of scripts is started from the beginning.

        This method returns 1 if this Virtual User is executing the first iteration. Compare to getIteration().

        Returns:
        the number of the iteration that this Virtual User is currently executing (beginning at 1)
      • getIteration

        public final int getIteration()
        Gets the number of the iteration that this Virtual User is currently executing (beginning at 0).

        As a Virtual User completes execution of the iterated sequence of scripts, the iteration number is increased by 1 and execution of the next iteration of the iterated sequence of scripts is started from the beginning.

        This method returns 0 if this Virtual User is executing the first iteration. Compare to getCurrentIteration().

        Returns:
        the number of the iteration that this Virtual User is currently executing (beginning at 0)
      • raiseAlert

        public final void raiseAlert​(int severity,
                                     java.lang.String message)
        Writes an alert of the specified severity to the Alerts table in Test Controller.

        The AlertManager class contains static final variables which can be passed as the severity parameter, i.e. AlertManager.Information, AlertManager.Warning and AlertManager.Error.

        RaiseAlert must be used sparingly. It is possible to flood the Alerts log. For diagnostic purposes use writeMessage(String), setProgressPoint(String), error(String) and warn(String) to output to the VU event log; this can be viewed at runtime in Test Controller. The Alerts log should only be used for a small number of important messages.

        Parameters:
        severity - the severity of the alert
        message - an alert message which appears in the Description column of the alerts table in the Alerts sub-view of Test Controller
      • onRaiseAlert

        protected void onRaiseAlert​(int severity,
                                    java.lang.String description)
        This method is called whenever an alert is raised using the raiseAlert(int, String) method.

        Override this method in your custom Virtual User if you have code which should be run whenever an alert is raised.

        The AlertManager class contains static final variables which can be passed as the severity parameter, i.e. AlertManager.Information, AlertManager.Warning and AlertManager.Error.

        Parameters:
        severity - the severity of the alert
        description - an alert message which appears in the Description column of the alerts table in the Alerts sub-view of Test Controller
      • writeSystemLog

        public void writeSystemLog​(java.lang.String message)
        Writes an alert of Error severity to the Alerts table in Test Controller.

        This method was included for backwards compatibility with older eggPlant Performance scripts. The Test Controller Alerts table is made accessible from the script using writeSystemLog(String). writeSystemLog() will add an alert of severity level Error. Other table fields include the time into the test the error alert was raised (HH:MM:SS), the source of the alert (this will always be 'Engine' when called from the script), the index of the VU which raised the alert and the injector that the VU was deployed on, the group which the VU was a member of and the script that the VU was executing when the alert was raised.

        WriteSystemLog must be used sparingly. It is possible to flood the Alerts log. For diagnostic purposes use writeMessage(String), setProgressPoint(String) , error(String) and warn(String) to output to the VU event log; this can be viewed at runtime in Test Controller. The Alerts log should only be used for a small number of important messages.

        Parameters:
        message - an alert message which appears in the Description column of the alerts table in the Alerts sub-view of Test Controller
        See Also:
        raiseAlert(int, String), writeMessage(String), error(String), warn(String)
      • writeSystemLog

        public void writeSystemLog​(java.lang.String heading,
                                   java.lang.String message)
        Writes an alert of Error severity to the Alerts table in Test Controller, specifying a heading to prefix to the message.

        This method was included for backwards compatibility with older eggPlant Performance scripts. The Test Controller Alerts table is made accessible from the script using writeSystemLog(String). writeSystemLog() will add an alert of severity level Error. Other table fields include the time into the test the error alert was raised (HH:MM:SS), the source of the alert (this will always be 'Engine' when called from the script), the index of the VU which raised the alert and the injector that the VU was deployed on, the group which the VU was a member of and the script that the VU was executing when the alert was raised.

        WriteSystemLog must be used sparingly. It is possible to flood the Alerts log. For diagnostic purposes use writeMessage(String), setProgressPoint(String) , error(String) and warn(String) to output to the VU event log; this can be viewed at runtime in Test Controller. The Alerts log should only be used for a small number of important messages.

        Parameters:
        heading - a String to be prefixed to the output message
        message - an alert message which appears in the Description column of the alerts table in the Alerts sub-view of Test Controller
        See Also:
        raiseAlert(int, String), writeMessage(String), error(String), warn(String)
      • getDataDictionary

        public final com.facilita.fc.runtime.CompoundDataDictionary getDataDictionary()
        Gets the Data Dictionary belonging to this VirtualUser.
        Returns:
        the Data Dictionary belonging to this VirtualUser
      • getContextState

        public final int getContextState()
        For internal user only
        Specified by:
        getContextState in interface com.facilita.fc.runtime.IMonitoredVU
      • getElapsedTime

        public final int getElapsedTime()
        Gets the elapsed time since the beginning of the test, in milliseconds.
        Returns:
        the elapsed time since the beginning of the test, in milliseconds
      • getStartTimeSeconds

        public final int getStartTimeSeconds()
        For internal use only.
        Returns:
        internal use only
      • nowSeconds

        public static final long nowSeconds()
        For internal use only.
        Returns:
        Internal use only
      • getStartTime

        public long getStartTime()
        For internal use only.
        Returns:
        Internal use only
      • getString

        public final java.lang.String getString​(java.lang.String key,
                                                java.lang.String defaultValue)
                                         throws BadValueException
        Description copied from interface: DataDictionary
        Returns a String value held in the dictionary, or the defaultValue if the key cannot be found.

        Default data warning:
        When called from a VU script, if the defaultValue is returned then a message is also written to the VU Event Log. This feature helps highlight problems with data bindings when data is expected to come from a data source, but the default value is returned instead.

        An example of the message entry in the Event Log:

        TypeIDInfo
        MessageDefault data warningNo value found for key: myString, using default value instead: abcd

        To turn this feature off, go to the Test view in eggPlant Performance Studio and uncheck the option "Enable default data warnings" on the Data tab.

        Specified by:
        getString in interface DataDictionary
        Parameters:
        key - the key to be looked up in the dictionary
        defaultValue - the value to return if the key is not present in the dictionary
        Returns:
        a String value held in the dictionary, or the defaultValue if the key cannot be found
        Throws:
        BadValueException - the key was null
        See Also:
        DataDictionary.setString(String, String)
      • getInteger

        public final java.lang.Integer getInteger​(java.lang.String key,
                                                  java.lang.Integer defaultValue)
                                           throws BadValueException
        Description copied from interface: DataDictionary
        Returns a java.lang.Integer value held in the dictionary, or the defaultValue if the key cannot be found.

        Default data warning:
        When called from a VU script, if the defaultValue is returned then a message is also written to the VU Event Log. This feature helps highlight problems with data bindings when data is expected to come from a data source, but the default value is returned instead.

        An example of the message entry in the Event Log:

        TypeIDInfo
        MessageDefault data warningNo value found for key: myInteger, using default value instead: 1234

        To turn this feature off, go to the Test view in eggPlant Performance Studio and uncheck the option "Enable default data warnings" on the Data tab.

        Specified by:
        getInteger in interface DataDictionary
        Parameters:
        key - the key to be looked up in the dictionary
        defaultValue - the value to return if the key is not present in the dictionary
        Returns:
        a java.lang.Integer value held in the dictionary, or the defaultValue if the key cannot be found
        Throws:
        BadValueException - the key was null
        See Also:
        DataDictionary.setInteger(String, Integer)
      • getInt

        public final int getInt​(java.lang.String key,
                                int defaultValue)
                         throws BadValueException
        Description copied from interface: DataDictionary
        Returns an int value held in the dictionary, or the defaultValue if the key cannot be found.

        Default data warning:
        When called from a VU script, if the defaultValue is returned then a message is also written to the VU Event Log. This feature helps highlight problems with data bindings when data is expected to come from a data source, but the default value is returned instead.

        An example of the message entry in the Event Log:

        TypeIDInfo
        MessageDefault data warningNo value found for key: myInt, using default value instead: 1234

        To turn this feature off, go to the Test view in eggPlant Performance Studio and uncheck the option "Enable default data warnings" on the Data tab.

        Specified by:
        getInt in interface DataDictionary
        Parameters:
        key - the key to be looked up in the dictionary
        defaultValue - the value to return if the key is not present in the dictionary
        Returns:
        an int value held in the dictionary, or the defaultValue if the key cannot be found
        Throws:
        BadValueException - the key was null
        See Also:
        DataDictionary.setInt(String, int)
      • getLong

        public final long getLong​(java.lang.String key,
                                  long defaultValue)
                           throws BadValueException
        Description copied from interface: DataDictionary
        Returns a long value held in the dictionary, or the defaultValue if the key cannot be found.

        Default data warning:
        When called from a VU script, if the defaultValue is returned then a message is also written to the VU Event Log. This feature helps highlight problems with data bindings when data is expected to come from a data source, but the default value is returned instead.

        An example of the message entry in the Event Log:

        TypeIDInfo
        MessageDefault data warningNo value found for key: myLong, using default value instead: 1234567890L

        To turn this feature off, go to the Test view in eggPlant Performance Studio and uncheck the option "Enable default data warnings" on the Data tab.

        Specified by:
        getLong in interface DataDictionary
        Parameters:
        key - the key to be looked up in the dictionary
        defaultValue - the value to return if the key is not present in the dictionary
        Returns:
        a long value held in the dictionary, or the defaultValue if the key cannot be found
        Throws:
        BadValueException - the key was null
        See Also:
        DataDictionary.setLong(String, long)
      • getFloat

        public final float getFloat​(java.lang.String key,
                                    float defaultValue)
                             throws BadValueException
        Description copied from interface: DataDictionary
        Returns a float value held in the dictionary, or the defaultValue if the key cannot be found.

        Default data warning:
        When called from a VU script, if the defaultValue is returned then a message is also written to the VU Event Log. This feature helps highlight problems with data bindings when data is expected to come from a data source, but the default value is returned instead.

        An example of the message entry in the Event Log:

        TypeIDInfo
        MessageDefault data warningNo value found for key: myFloat, using default value instead: 3.142F

        To turn this feature off, go to the Test view in eggPlant Performance Studio and uncheck the option "Enable default data warnings" on the Data tab.

        Specified by:
        getFloat in interface DataDictionary
        Parameters:
        key - the key to be looked up in the dictionary
        defaultValue - the value to return if the key is not present in the dictionary
        Returns:
        a float value held in the dictionary, or the defaultValue if the key cannot be found
        Throws:
        BadValueException - the key was null
        See Also:
        DataDictionary.setFloat(String, float)
      • getDouble

        public final double getDouble​(java.lang.String key,
                                      double defaultValue)
                               throws BadValueException
        Description copied from interface: DataDictionary
        Returns a double value held in the dictionary, or the defaultValue if the key cannot be found.

        Default data warning:
        When called from a VU script, if the defaultValue is returned then a message is also written to the VU Event Log. This feature helps highlight problems with data bindings when data is expected to come from a data source, but the default value is returned instead.

        An example of the message entry in the Event Log:

        TypeIDInfo
        MessageDefault data warningNo value found for key: myDouble, using default value instead: 1.234

        To turn this feature off, go to the Test view in eggPlant Performance Studio and uncheck the option "Enable default data warnings" on the Data tab.

        Specified by:
        getDouble in interface DataDictionary
        Parameters:
        key - the key to be looked up in the dictionary
        defaultValue - the value to return if the key is not present in the dictionary
        Returns:
        a double value held in the dictionary, or the defaultValue if the key cannot be found
        Throws:
        BadValueException - the key was null
        See Also:
        DataDictionary.setDouble(String, double)
      • getBoolean

        public final boolean getBoolean​(java.lang.String key,
                                        boolean defaultValue)
                                 throws BadValueException
        Description copied from interface: DataDictionary
        Returns a boolean value held in the dictionary, or the defaultValue if the key cannot be found.

        Default data warning:
        When called from a VU script, if the defaultValue is returned then a message is also written to the VU Event Log. This feature helps highlight problems with data bindings when data is expected to come from a data source, but the default value is returned instead.

        An example of the message entry in the Event Log:

        TypeIDInfo
        MessageDefault data warningNo value found for key: myBoolean, using default value instead: true

        To turn this feature off, go to the Test view in eggPlant Performance Studio and uncheck the option "Enable default data warnings" on the Data tab.

        Specified by:
        getBoolean in interface DataDictionary
        Parameters:
        key - the key to be looked up in the dictionary
        defaultValue - the value to return if the key is not present in the dictionary
        Returns:
        a boolean value held in the dictionary, or the defaultValue if the key cannot be found
        Throws:
        BadValueException - the key was null
        See Also:
        DataDictionary.setBoolean(String, boolean)
      • get

        public final java.lang.Object get​(java.lang.String key,
                                          java.lang.Object defaultValue)
                                   throws BadValueException
        Description copied from interface: DataDictionary
        Returns an Object value held in the dictionary, or the defaultValue if the key cannot be found.

        Default data warning:
        When called from a VU script, if the defaultValue is returned then a message is also written to the VU Event Log. This feature helps highlight problems with data bindings when data is expected to come from a data source, but the default value is returned instead.

        An example of the message entry in the Event Log:

        TypeIDInfo
        MessageDefault data warningNo value found for key: myObject, using default value instead: abcd1234

        To turn this feature off, go to the Test view in eggPlant Performance Studio and uncheck the option "Enable default data warnings" on the Data tab.

        Specified by:
        get in interface DataDictionary
        Parameters:
        key - the key to be looked up in the dictionary
        defaultValue - the value to return if the key is not present in the dictionary
        Returns:
        an Object value held in the dictionary, or the defaultValue if the key cannot be found
        Throws:
        BadValueException - the key was null
      • setString

        public final void setString​(java.lang.String key,
                                    java.lang.String string)
                             throws BadValueException,
                                    NotAllowedException
        Description copied from interface: DataDictionary
        Sets a String value in the dictionary.

        key is associated with the value in the dictionary. If the key already exists in the dictionary then the old value is replaced by the new value, otherwise a new key/value pair is added to the dictionary.

        e.g.

        
         setString("hostName", "www.testplant.com");
         
        Specified by:
        setString in interface DataDictionary
        Parameters:
        key - the key to associate with string in the dictionary
        string - the String to be associated with the key in the dictionary
        Throws:
        BadValueException - the key was null
        NotAllowedException - This dictionary is read only
        See Also:
        DataDictionary.getString(String)
      • setInteger

        public final void setInteger​(java.lang.String key,
                                     java.lang.Integer i)
                              throws NotAllowedException,
                                     BadValueException
        Description copied from interface: DataDictionary
        Sets an Integer value in the dictionary.

        key is associated with the value in the dictionary. If the key already exists in the dictionary then the old value is replaced by the new value, otherwise a new key/value pair is added to the dictionary.

        e.g.

        
         setInteger("port", 8080);
         
        Specified by:
        setInteger in interface DataDictionary
        Parameters:
        key - the key to associate with i in the dictionary
        i - the Integer to be associated with the key in the dictionary
        Throws:
        NotAllowedException - This dictionary is read only
        BadValueException - the key was null
        See Also:
        DataDictionary.getInteger(String)
      • setInt

        public final void setInt​(java.lang.String key,
                                 int i)
                          throws NotAllowedException,
                                 BadValueException
        Description copied from interface: DataDictionary
        Sets an int value in the dictionary.

        key is associated with the value in the dictionary. If the key already exists in the dictionary then the old value is replaced by the new value, otherwise a new key/value pair is added to the dictionary.

        e.g.

        
         setInt("port", 8080);
         
        Specified by:
        setInt in interface DataDictionary
        Parameters:
        key - the key to associate with i in the dictionary
        i - the int to be associated with the key in the dictionary
        Throws:
        NotAllowedException - This dictionary is read only
        BadValueException - the key was null
        See Also:
        DataDictionary.getInt(String)
      • set

        public <T> void set​(java.lang.String key,
                            T item)
                     throws NotAllowedException,
                            BadValueException
        Description copied from interface: DataDictionary
        Sets an Object value in the dictionary.

        key is associated with the value in the dictionary. If the key already exists in the dictionary then the old value is replaced by the new value, otherwise a new key/value pair is added to the dictionary.

        e.g.

        
         set("today", new Date());
         
        Specified by:
        set in interface DataDictionary
        Type Parameters:
        T - The type of object to add to the dictionary
        Parameters:
        key - the key to associate with o in the dictionary
        item - the Object to be associated with the key in the dictionary
        Throws:
        NotAllowedException - This dictionary is read only
        BadValueException - the key was null
        See Also:
        DataDictionary.get(String)
      • setDouble

        public final void setDouble​(java.lang.String key,
                                    double i)
                             throws NotAllowedException,
                                    BadValueException
        Description copied from interface: DataDictionary
        Sets a double value in the dictionary.

        key is associated with the value in the dictionary. If the key already exists in the dictionary then the old value is replaced by the new value, otherwise a new key/value pair is added to the dictionary.

        e.g.

        
         setDouble("amount", 123.45);
         
        Specified by:
        setDouble in interface DataDictionary
        Parameters:
        key - the key to associate with i in the dictionary
        i - the double to be associated with the key in the dictionary
        Throws:
        NotAllowedException - This dictionary is read only
        BadValueException - the key was null
        See Also:
        DataDictionary.getDouble(String)
      • setFloat

        public final void setFloat​(java.lang.String key,
                                   float i)
                            throws NotAllowedException,
                                   BadValueException
        Description copied from interface: DataDictionary
        Sets a float value in the dictionary.

        key is associated with the value in the dictionary. If the key already exists in the dictionary then the old value is replaced by the new value, otherwise a new key/value pair is added to the dictionary.

        e.g.

        
         setFloat("amount", 123.45);
         
        Specified by:
        setFloat in interface DataDictionary
        Parameters:
        key - the key to associate with i in the dictionary
        i - the float to be associated with the key in the dictionary
        Throws:
        NotAllowedException - This dictionary is read only
        BadValueException - the key was null
        See Also:
        DataDictionary.getFloat(String)
      • setLong

        public final void setLong​(java.lang.String key,
                                  long i)
                           throws NotAllowedException,
                                  BadValueException
        Description copied from interface: DataDictionary
        Sets a long value in the dictionary.

        key is associated with the value in the dictionary. If the key already exists in the dictionary then the old value is replaced by the new value, otherwise a new key/value pair is added to the dictionary.

        e.g.

        
         setLong("amount", 9156598231230);
         
        Specified by:
        setLong in interface DataDictionary
        Parameters:
        key - the key to associate with i in the dictionary
        i - the long to be associated with the key in the dictionary
        Throws:
        NotAllowedException - This dictionary is read only
        BadValueException - the key was null
        See Also:
        DataDictionary.getLong(String)
      • getList

        public final java.util.List getList​(java.lang.String key,
                                            java.util.List defaultList)
                                     throws BadValueException
        Description copied from interface: DataDictionary
        Returns a List value held in the dictionary, or the defaultList if the key cannot be found.

        Default data warning:
        When called from a VU script, if the defaultList is returned then a message is also written to the VU Event Log. This feature helps highlight problems with data bindings when data is expected to come from a data source, but the default value is returned instead.

        An example of the message entry in the Event Log:

        TypeIDInfo
        MessageDefault data warningNo value found for key: myList, using default value instead: List with first item: Item01

        To turn this feature off, go to the Test view in eggPlant Performance Studio and uncheck the option "Enable default data warnings" on the Data tab.

        Specified by:
        getList in interface DataDictionary
        Parameters:
        key - the key to be looked up in the dictionary
        defaultList - the value to return if the key is not present in the dictionary
        Returns:
        a List value held in the dictionary, or the defaultList if the key cannot be found
        Throws:
        BadValueException - the key was null
        See Also:
        DataDictionary.setList(String, List)
      • setList

        public final void setList​(java.lang.String key,
                                  java.util.List list)
                           throws NotAllowedException,
                                  BadValueException
        Description copied from interface: DataDictionary
        Sets a List value in the dictionary.

        key is associated with the value in the dictionary. If the key already exists in the dictionary then the old value is replaced by the new value, otherwise a new key/value pair is added to the dictionary.

        e.g.

        
         List<String> hostList = new ArrayList<String>();
         hostList.add("www.testplant.com");
         setList("hosts", hostList);
         
        Specified by:
        setList in interface DataDictionary
        Parameters:
        key - the key to associate with list in the dictionary
        list - the List to be associated with the key in the dictionary
        Throws:
        NotAllowedException - This dictionary is read only
        BadValueException - the key was null
        See Also:
        DataDictionary.getList(String)
      • setBoolean

        public final void setBoolean​(java.lang.String key,
                                     boolean b)
                              throws NotAllowedException,
                                     BadValueException
        Description copied from interface: DataDictionary
        Sets a boolean value in the dictionary.

        key is associated with the value in the dictionary. If the key already exists in the dictionary then the old value is replaced by the new value, otherwise a new key/value pair is added to the dictionary.

        e.g.

        
         setBoolean("retryLogon", false);
         
        Specified by:
        setBoolean in interface DataDictionary
        Parameters:
        key - the key to associate with b in the dictionary
        b - the boolean to be associated with the key in the dictionary
        Throws:
        NotAllowedException - This dictionary is read only
        BadValueException - the key was null
        See Also:
        DataDictionary.getBoolean(String)
      • getVUName

        public final java.lang.String getVUName()
        Gets the name of the group that this Virtual User belongs to.
        Specified by:
        getVUName in interface com.facilita.fc.runtime.IMonitoredVU
        Returns:
        the Virtual User group name
      • getInitialDelay

        public final int getInitialDelay()
        Gets the initial delay for this Virtual User, between the start of the test and the start of the first script execution.

        By the time this method can be called, the initial delay will already have happened, and this will return the actual number of milliseconds that this Virtual User waited before starting script execution. The value returned includes the initial group delay and the ramp-up for this specific Virtual User.

        Returns:
        the initial delay, in milliseconds
      • atStartOfIteration

        protected void atStartOfIteration()
        This method is called at the start of every iteration.

        Override this method in your custom Virtual User if you have code which should be run at the start of every iteration.

        The current iteration number can be obtained using getCurrentIteration().

      • atEndOfIteration

        protected void atEndOfIteration()
        This method is called at the end of every iteration.

        Override this method in your custom Virtual User if you have code which should be run at the end of every iteration.

        The current iteration number can be obtained using getCurrentIteration().

      • onDataDictionaryChanged

        protected void onDataDictionaryChanged()
      • nextIteration

        public final void nextIteration()
                                 throws ScriptContextTerminationException
        Stops execution of the current script, and starts execution of the next iteration.

        The execution of the calling script ceases and the execution of the next iteration of scripts is begun. If the sequence of scripts being executed is the initial or final sequence of scripts, then the execution of this sequence is curtailed. Otherwise, the execution of the repeated sequence of scripts begins again at the next iteration.

        This method raises a ScriptContextTerminationException, and under normal conditions you should not write any code to catch this exception, as this would interfere with the mechanism of the eggPlant Performance engine.

        Throws:
        ScriptContextTerminationException - Exception indicating that this script shoudl terminate
      • finalSequence

        public final void finalSequence()
                                 throws ScriptContextTerminationException
        Stops execution of the current script and then executes the scripts in the final section of the current workflow.

        The execution of the calling script ceases and the execution of all further scripts in the current sequence is curtailed.

        This method raises a ScriptContextTerminationException, and under normal conditions you should not write any code to catch this exception, as this would interfere with the mechanism of the eggPlant Performance engine.

        Throws:
        ScriptContextTerminationException - Exception indicating that this script shoudl terminate
      • nextSequence

        public final void nextSequence()
                                throws ScriptContextTerminationException
        Stops execution of the current script and any other scripts in the current sequence, and starts execution of the next sequence of scripts.

        This method raises a ScriptContextTerminationException, and under normal conditions you should not write any code to catch this exception, as this would interfere with the mechanism of the eggPlant Performance engine.

        Throws:
        ScriptContextTerminationException - Exception indicating that this script shoudl terminate
      • nextScript

        public final void nextScript()
                              throws ScriptContextTerminationException
        Stops execution of the current script, and starts execution of the next script in the sequence.

        The execution of the calling script ceases and the execution of the next script in the sequence of scripts to be executed is begun. This method and the return statement are not equivalent. This method should be used in preference to the return statement. Remember that a VirtualUserScript may have additional methods other than VirtualUserScript.script() and executing a return statement from anywhere other than the VirtualUserScript.script() method will not exit the execution of the VirtualUserScript object.

        This method raises a ScriptContextTerminationException and under normal conditions you should not write any code to catch this exception, as this would interfere with the mechanism of the eggPlant Performance engine.

        Throws:
        ScriptContextTerminationException - Exception indicating that this script shoudl terminate
      • runAsBackgroundThread

        public void runAsBackgroundThread​(VirtualUserScript script)
      • run

        public final void run()
        Specified by:
        run in interface java.lang.Runnable
      • warn

        public final void warn​(java.lang.String id,
                               java.lang.String info)
        Writes a warning message to the VU event log, specifying an identifier which appears in the ID column.
        Parameters:
        id - the warning identifier, which appears in the ID column
        info - a warning message which appears in the Info column
      • warn

        public void warn​(java.lang.String id,
                         java.lang.String info,
                         java.lang.String imagePath)
                  throws java.io.FileNotFoundException
        Writes a warning message and an image link to the VU event log, specifying an identifier which appears in the ID column.

        An error message is written to the VU event log, and then the event log is flushed.

        The image must be contained within the run directory (as returned by getRunPath()), and the path passed should be relative to this path.

        Parameters:
        id - the error identifier, which appears in the ID column
        info - an error message which appears in the Info column
        imagePath - the path to an image file (such as a png or bmp). The path should be a relative path.
        Throws:
        java.io.FileNotFoundException - The image specified does not exist
      • warn

        public final void warn​(java.lang.String info)
        Writes a warning message to the VU event log.
        Parameters:
        info - a warning message which appears in the Info column
      • warn

        public final void warn​(java.lang.Exception e)
        Writes a warning message to the VU event log, consisting of the specified exception
        Parameters:
        e - The exception to write to the event log.
      • onWarn

        protected boolean onWarn​(java.lang.String id,
                                 java.lang.String info)
                          throws java.lang.Exception
        This method is called whenever a warning is written to the VU event log using the warn(String) or warn(String, String) methods.

        Override this method in your custom Virtual User if you have code which should be run whenever a warning is written to the VU event log.

        Parameters:
        id - the warning identifier, which appears in the ID column
        info - a warning message which appears in the Info column
        Returns:
        true if the warning should be written to the event log, or false if the warning should be ignored.
        Throws:
        java.lang.Exception - An error occurred when processing the warning
      • error

        public final void error​(java.lang.String id,
                                java.lang.String info)
        Writes an error message to the VU event log, specifying an identifier which appears in the ID column.

        An error message is written to the VU event log, and then the event log is flushed.

        Parameters:
        id - the error identifier, which appears in the ID column
        info - an error message which appears in the Info column
      • error

        public void error​(java.lang.String id,
                          java.lang.String info,
                          java.lang.String imagePath)
                   throws java.io.FileNotFoundException
        Writes an error message and an image link to the VU event log, specifying an identifier which appears in the ID column.

        An error message is written to the VU event log, and then the event log is flushed.

        The image must be contained within the run directory (as returned by getRunPath()), and the path passed should be relative to this path.

        Parameters:
        id - the error identifier, which appears in the ID column
        info - an error message which appears in the Info column
        imagePath - the path to an image file (such as a png or bmp). The path should be a relative path.
        Throws:
        java.io.FileNotFoundException - The image specified does not exist
      • error

        public void error​(java.lang.String message,
                          java.lang.Exception e)
        Writes an error message to the VU event log, which will include the stack trace of the specified Exception.

        An error event is written to the VU's event log and the the event log is flushed.

        Parameters:
        message - an error message which appears in the Info column
        e - the stack trace of this Exception will be recorded in the error message
      • error

        public void error​(java.lang.Throwable e)
        Writes an error message to the VU event log, which will consist of the details of the specified Exception.

        An error message is written to the VU event log, and then the event log is flushed.

        Parameters:
        e - The exception to record in the event log.
      • getNumberOfWarnings

        public int getNumberOfWarnings()
        Gets the number of warnings that have been reported for this Virtual User.
        Returns:
        the number of warnings that have been reported for this Virtual User
      • getNumberOfErrors

        public int getNumberOfErrors()
        Gets the number of errors that have been reported for this Virtual User.
        Returns:
        the number of errors that have been reported for this Virtual User
      • onError

        protected boolean onError​(java.lang.String id,
                                  java.lang.String info)
                           throws java.lang.Exception
        This method is called whenever an error is written to the VU event log using the error(String), error(String, Exception) or error(String, String) methods.

        Override this method in your custom Virtual User if you have code which should be run whenever an error is written to the VU event log.

        Parameters:
        id - the error identifier, which appears in the ID column
        info - an error message which appears in the Info column
        Returns:
        true if the error should be written to the event log, or false if the error should be ignored.
        Throws:
        java.lang.Exception - An error occurred when processing the error
      • onException

        protected boolean onException​(java.lang.Exception e)
        This method is called whenever an unhandled exception is thrown by a script.
        Parameters:
        e - The exception that was thrown
        Returns:
        true if the exception should be recorded as an error and counted as a script failure, false if the exception should be ignored.
      • getLastError

        public java.lang.String getLastError()
        Gets the most recent error encountered by this Virtual User.
        Returns:
        the most recent error encountered by this Virtual User
      • error

        public final void error​(java.lang.String info)
        Writes an error message to the VU event log.

        An error message is written to the VU event log, and then the event log is flushed.

        Parameters:
        info - an error message which appears in the Info column
      • pause

        public int pause​(int interval)
                  throws BadValueException,
                         ContextTerminationException
        Pauses the execution of the script for a specified interval (modified by getPauseFactor()).

        The specified interval may be altered by a previous call to setPauseFactor(int) or by the runtime options set in eggPlant Performance Studio.

        Parameters:
        interval - the number of milliseconds to pause before executing the next statement
        Returns:
        the length of time that the script actually paused for, in milliseconds
        Throws:
        BadValueException - The interval is less than 0
        ContextTerminationException - This Virtual User has been terminated
      • timeToPause

        public int timeToPause​(int interval)
                        throws BadValueException
        Gets the length of time that this Virtual User would pause for if pause(int) were called with the specified interval.

        When calling pause(int), a length of time in milliseconds is passed as a parameter. The actual pause time may be different, depending on values passed to setPauseFactor(int) or runtime options set in eggPlant Performance Studio. This method returns the actual time that the Virtual User would pause for, if pause(int) were called with the specified interval.

        Parameters:
        interval - the interval, in milliseconds
        Returns:
        the actual length of the pause, in milliseconds
        Throws:
        BadValueException - The interval is less than 0
      • pause

        public int pause()
                  throws BadValueException,
                         ContextTerminationException
        Pauses the execution of the script.

        The script pauses for a random number of milliseconds between the minimum and maximum values set in eggPlant Performance Studio. The actual pause time may be altered by a previous call to setPauseFactor(int) or by the runtime options set in eggPlant Performance Studio.

        Returns:
        the length of time that the script paused for, in milliseconds
        Throws:
        BadValueException - Invalid pause interval settings
        ContextTerminationException - This Virtual User has been terminated
      • pause

        public int pause​(VirtualUserScript script)
                  throws BadValueException,
                         ContextTerminationException
        Pauses the execution of the script.

        The script pauses for a random number of milliseconds between the minimum and maximum values set in eggPlant Performance Studio. The actual pause time may be altered by a previous call to setPauseFactor(int) or by the runtime options set in eggPlant Performance Studio.

        Parameters:
        script - the current VirtualUserScript
        Returns:
        the length of time that the script paused for, in milliseconds
        Throws:
        BadValueException - Invalid pause interval settings
        ContextTerminationException - This Virtual User has been terminated
      • getDataDictionary

        public final DataDictionary getDataDictionary​(java.lang.String key)
                                               throws NoSuchValueException
        Gets the Data Dictionary named with the specified key and assigned to the Virtual User in eggPlant Performance Studio.
        Parameters:
        key - the name of the Data Dictionary as it appears in eggPlant Performance Studio
        Returns:
        the specified Data Dictionary
        Throws:
        NoSuchValueException - the key does not exist in the dictionary
      • getDataTable

        public final DataTable getDataTable​(java.lang.String key)
                                     throws NoSuchValueException
        Gets the specified Data Table.

        This method allows you to locate the existing Data Table by name. The dictionaries it contains can then be accessed by using the appropriate methods of DataTable.

        Parameters:
        key - the name of the DataTable
        Returns:
        a reference to a named DataTable object
        Throws:
        NoSuchValueException - the data table does not exist
      • getIndex

        public final int getIndex()
        Gets the index number of this Virtual User within the Virtual User group that it belongs to.

        The first Virtual User has index 1.

        e.g.

        
         // pause for 1 second, every 10th VU
         if ((getIndex() % 10) == 0)
         {
             pause(1000);
         }
         
        Specified by:
        getIndex in interface com.facilita.fc.runtime.IMonitoredVU
        Returns:
        the index number of this Virtual User within the Virtual User group that it belongs to
      • getIndexForEngineGroup

        public final int getIndexForEngineGroup()
        For internal use only.
        Returns:
        Internal use only
      • getUniqueID

        public final int getUniqueID()
        Gets a test-wide unique identifier for this Virtual User.

        The first Virtual User has the identifier 1.

        
         // pause for 1 second, every 10th VU
         if ((getUniqueID() % 10) == 0)
         {
             pause(1000);
         }
         
        Returns:
        the unique identifier of this Virtual User
      • getUniqueID

        public final int getUniqueID​(java.lang.String groupName,
                                     int index)
                              throws BadValueException
        Gets a test-wide unique identifier for a specified Virtual User within a Virtual User group.

        The first Virtual User has identifier 1.

        e.g.

        
         // get the unique identifier for the 5th VU in the "Supervisors" Virtual User group
         int vuNum = getUniqueID("Supervisors", 5);
         
        Parameters:
        groupName - the group name
        index - the index of the Virtual User within the group
        Returns:
        the unique identifier of the Virtual User
        Throws:
        BadValueException - Invalid group name
      • getPauseFactor

        public final int getPauseFactor()
        Gets the current percentage pause factor.

        The length of time which this Virtual User will pause for when the pause() or pause(int) methods are called will be multiplied by the percentage pause factor.

        e.g. a percentage pause factor of 200 will make pauses last twice as long, and a percentage pause factor of 50 will make pauses last half as long.

        Returns:
        a percentage factor to apply to all subsequent pause() statements
      • setPauseFactor

        public final void setPauseFactor​(int pauseFactor)
                                  throws BadValueException
        Sets the current percentage pause factor.

        You can use this property to slow down or speed up a running test, by changing the length of time that this Virtual User will pause for.

        e.g.

        
         // to make all pauses twice as long (200%)
         setPauseFactor(200);
         
         // or to reduce all following pauses to 10% of their stated value
         setPauseFactor(10);
         
        Parameters:
        pauseFactor - a percentage factor to apply to all subsequent pause() statements
        Throws:
        BadValueException - Invalid pause factor
        See Also:
        pause()
      • setProgressPoint

        public final void setProgressPoint​(java.lang.String progressPoint,
                                           boolean pass)
                                    throws java.lang.Exception
        Sets a progress point in the VU event log, specifying whether the progress point passed.

        A progress point can be used to indicate that the execution of a script has reached a certain point, or that the application under test is in a certain state. The progressPoint text, and whether it passed or failed will be written to the VU event log, and will appear in Test Controller summary views during the test.

        e.g.

        
         setProgressPoint("AtLogon");
         
         String response = ....   // the response from the server
         if (response.contains("Invalid User or Password"))
         {
             setProgressPoint("logon", false);   // logon failed
         }
         else
         {
             setProgressPoint("logon", true);   // logon OK
         }
         
        Parameters:
        progressPoint - the progress point identifier, which will appear in the Progress Point column in Test Controller
        pass - true if the progress point should be interpreted as a pass
        Throws:
        java.lang.Exception - An error occurred
      • setProgressPoint

        public final void setProgressPoint​(java.lang.String progressPoint,
                                           java.lang.String info,
                                           boolean pass)
                                    throws java.lang.Exception
        Sets a progress point in the VU event log, specifying whether the progress point passed and specifying extra information which appears in the Info column.

        A progress point can be used to indicate that the execution of a script has reached a certain point, or that the application under test is in a certain state. The progressPoint text, and whether it passed or failed will be written to the VU event log, and will appear in Test Controller summary views during the test.

        e.g.

        
         setProgressPoint("AtLogon");
         
         String response = ....   // the response from the server
         if (response.contains("Invalid User or Password"))
         {
             setProgressPoint("logon", response, false);   // logon failed
         }
         else
         {
             setProgressPoint("logon", response, true);   // logon OK
         }
         
        Parameters:
        progressPoint - the progress point identifier, which will appear in the Progress Point column in Test Controller
        info - extra information which appears in the Info column
        pass - true if the progress point should be interpreted as a pass
        Throws:
        java.lang.Exception - An error occurred
      • setProgressPoint

        public final void setProgressPoint​(java.lang.String progressPoint,
                                           java.lang.String info,
                                           boolean pass,
                                           VirtualUserScript script)
                                    throws java.lang.Exception
        Sets a progress point in the VU event log, specifying whether the progress point passed and specifying extra information which appears in the Info column.

        A progress point can be used to indicate that the execution of a script has reached a certain point, or that the application under test is in a certain state. The progressPoint text, and whether it passed or failed will be written to the VU event log, and will appear in Test Controller summary views during the test.

        e.g.

        
         setProgressPoint("AtLogon");
         
         String response = ....   // the response from the server
         if (response.contains("Invalid User or Password"))
         {
             setProgressPoint("logon", response, false);   // logon failed
         }
         else
         {
             setProgressPoint("logon", response, true);   // logon OK
         }
         
        Parameters:
        progressPoint - the progress point identifier, which will appear in the Progress Point column in Test Controller
        info - extra information which appears in the Info column
        pass - true if the progress point should be interpreted as a pass
        script - The current VirtualUserScript
        Throws:
        java.lang.Exception - An error occurred
      • onSetProgressPoint

        protected void onSetProgressPoint​(java.lang.String progressPoint,
                                          java.lang.String info,
                                          boolean pass)
                                   throws java.lang.Exception
        This method is called whenever a progress point is set using the setProgressPoint(String), setProgressPoint(String, boolean) or setProgressPoint(String, String, boolean) methods.

        Override this method in your custom Virtual User if you have code which should be run whenever a progress point is set.

        Parameters:
        progressPoint - the progress point identifier, which will appear in the Progress Point column in Test Controller
        info - extra information which appears in the Info column
        pass - true if the progress point should be interpreted as a pass
        Throws:
        java.lang.Exception - An error occurred
      • getGroupSizes

        public com.facilita.fc.runtime.SimpleDataDictionary getGroupSizes()
        Gets the number of Virtual Users in each Virtual User group.

        e.g.

        
         // get the number of Virtual Users in the group "G1"
         int groupSize = getGroupSizes().getInt("G1");
         
        Returns:
        a DataDictionary in which the keys are group names and the values are the group sizes
      • getGroupSize

        public final int getGroupSize​(java.lang.String groupName)
                               throws NoSuchValueException,
                                      BadValueException
        Gets the number of Virtual Users in the specified Virtual User group.

        e.g.

        
         // get the number of Virtual Users in the group "G1"
         int groupSize = getGroupSize("G1");
         
        Parameters:
        groupName - a Virtual User group
        Returns:
        the size of the Virtual User group
        Throws:
        NoSuchValueException - Invalid group name
        BadValueException - Group name is null
      • clearProgressPoint

        public final void clearProgressPoint()
        Clears the current progress point set for this Virtual User.

        This has the effect of clearing the Progress Point column in Test Controller for this Virtual User.

      • setProgressPoint

        public final void setProgressPoint​(java.lang.String progressPoint)
                                    throws java.lang.Exception
        Sets a progress point in the VU event log.

        A progress point can be used to indicate that the execution of a script has reached a certain point, or that the application under test is in a certain state. The progressPoint text will be written to the VU event log, and will appear in Test Controller summary views during the test.

        e.g.

        
         setProgressPoint("AtLogon");
         
        Parameters:
        progressPoint - the progress point identifier, which will appear in the Progress Point column in Test Controller
        Throws:
        java.lang.Exception - An error occurred
      • getProgressPoint

        public final java.lang.String getProgressPoint()
        Gets the text of the most recent progress point that was set.
        Returns:
        the text of the most recent progress point that was set
      • createMonitorSnapshot

        public com.facilita.fc.runtime.VUSnapshot createMonitorSnapshot()
        Specified by:
        createMonitorSnapshot in interface com.facilita.fc.runtime.IMonitoredVU
      • setup

        protected void setup​(com.facilita.fc.runtime.EventLog eventLog,
                             com.facilita.util.Time time,
                             com.facilita.fc.runtime.CompoundDataDictionary dataDictionary,
                             int index,
                             java.lang.String vuName,
                             com.facilita.fc.runtime.SimpleDataDictionary groupSizes,
                             com.facilita.fc.runtime.VUGroup group,
                             com.facilita.fc.runtime.AlertManager alertManager)
                      throws NoSuchValueException,
                             BadValueException,
                             NotAllowedException
        For internal use only.
        Parameters:
        eventLog - internal use only
        time - internal use only
        dataDictionary - internal use only
        index - internal use only
        vuName - internal use only
        groupSizes - internal use only
        group - internal use only
        alertManager - internal use only
        Throws:
        NoSuchValueException - internal use only
        BadValueException - internal use only
        NotAllowedException - internal use only
      • exitVU

        public void exitVU()
                    throws ContextTerminationException
        Stops execution of this Virtual User.

        The script processing for this Virtual User is immediately ended (i.e. all further statements in this script are not executed, and the execution of all further scripts is also stopped). An information message is written to the VU event log to indicate that exitVU() has been called, and the final end entry in the log is written.

        This method raises a ContextTerminationException and under normal conditions you should not write any code to catch this exception, as this would interfere with the mechanism of the eggPlant Performance engine.

        Throws:
        ContextTerminationException - This Virtual User has been terminated
      • exitVU

        public void exitVU​(boolean pass)
                    throws ContextTerminationException
        Stops execution of this Virtual User, specifying whether the script completed successfully.

        The script processing for this Virtual User is immediately ended (i.e. all further statements in this script are not executed, and the execution of all further scripts is also stopped). An information message is written to the VU event log to indicate that exitVU() has been called, and the final end entry in the log is annotated with Pass or Fail in the ID column depending on the value of pass. The Virtual User will also be counted in the In Error column in Test Controller if pass is false.

        This method raises a ContextTerminationException and under normal conditions you should not write any code to catch this exception, as this would interfere with the mechanism of the eggPlant Performance engine.

        Parameters:
        pass - true if the script should be considered to have completed successfully
        Throws:
        ContextTerminationException - This Virtual User has been terminated
      • exitVU

        public void exitVU​(java.lang.String msg,
                           boolean pass)
                    throws ContextTerminationException
        Stops execution of this Virtual User, specifying whether the script completed successfully and a message to display at the end of the event log.

        The script processing for this Virtual User is immediately ended (i.e. all further statements in this script are not executed, and the execution of all further scripts is also stopped). An information message is written to the VU event log to indicate that exitVU() has been called, and the final end entry in the log is annotated with Pass or Fail in the ID column depending on the value of pass. The Virtual User will also be counted in the In Error column in Test Controller if pass is false.

        This method raises a ContextTerminationException and under normal conditions you should not write any code to catch this exception, as this would interfere with the mechanism of the eggPlant Performance engine.

        Parameters:
        msg - an information message which appears in the Info column of the end entry
        pass - true if the script should be considered to have completed successfully
        Throws:
        ContextTerminationException - This Virtual User has been terminated
      • onExitVU

        protected void onExitVU​(java.lang.String msg,
                                boolean pass)
        This method is called whenever the Virtual User stops execution as a result of the exitVU(), exitVU(boolean) or exitVU(String, boolean) methods.

        Override this method in your custom Virtual User if you have code which should be run whenever the Virtual User stops execution.

        Parameters:
        msg - an information message which appears in the Info column of the end entry
        pass - true if the script should be considered to have completed successfully
      • getCurrentTransaction

        public java.lang.String getCurrentTransaction()
        Gets the name of the transaction that is currently in progress.

        This is the name of the most recent transaction to be started by a call to startTransaction(String). If no transaction is currently in progress, then an empty String will be returned.

        Returns:
        the name of the transaction that is currently in progress
      • startTransaction

        public final void startTransaction​(java.lang.String id)
                                    throws java.lang.Exception
        Writes a start transaction event to the VU event log.

        The time in milliseconds since the start of the test run is recorded when this method is called. When endTransaction(String) is called with the same id, an end transaction event is written to the VU event log. eggPlant Performance uses the time difference between the events to calculate the transaction time for the transaction named with the specified id.

        Test Controller and Analyzer use the transaction times to calculate statistics such as average transaction time for each different id. These statistics give an indication of the performance of the System Under Test, as they show how long it takes for Virtual Users to perform the actions.

        Parameters:
        id - the transaction identifier
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        endTransaction(String), suspendTransaction(String), resumeTransaction(String)
      • startTransaction

        public final void startTransaction​(java.lang.String id,
                                           java.lang.String tag)
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • startTransaction

        public final void startTransaction​(java.lang.String id,
                                           java.lang.String tag,
                                           VirtualUserScript script)
                                    throws java.lang.Exception
        Writes a start transaction event to the VU event log, specifying a tag which appears in the Info column.

        The time in milliseconds since the start of the test run is recorded when this method is called. When endTransaction(String) is called with the same id, an end transaction event is written to the VU event log. eggPlant Performance uses the time difference between the events to calculate the transaction time for the transaction named with the specified id.

        Test Controller and Analyzer use the transaction times to calculate statistics such as average transaction time for each different id. These statistics give an indication of the performance of the System Under Test, as they show how long it takes for Virtual Users to perform the actions.

        Parameters:
        id - the transaction identifier
        tag - extra information which appears in the Info column
        script - the current VirtualUserScript
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        endTransaction(String, boolean, String), suspendTransaction(String), resumeTransaction(String)
      • getTransactionElapsedTime

        public int getTransactionElapsedTime​(java.lang.String id)
                                      throws ContextTerminationException
        Gets the current elapsed time of the transaction with the specified id.

        e.g.

        
         startTransaction("Transaction1");
         
         // do activity
         
         if (getTransactionElapsedTime("Transaction1") > 5000)
         {
             setProgressPoint("Activity > 5 Seconds");
         }
         
         // do more activity
        
         endTransaction("Transaction1", true);
         
        Parameters:
        id - the transaction identifier
        Returns:
        the elapsed time of the transaction, in milliseconds
        Throws:
        ContextTerminationException - This Virtual User has been terminated
      • getTransactionElapsedTime

        public int getTransactionElapsedTime​(java.lang.String id,
                                             java.lang.String tag)
                                      throws ContextTerminationException
        Gets the current elapsed time of the transaction with the specified id and tag.

        e.g.

        
         startTransaction("Transaction1", "Tag1");
         
         // do activity
         
         startTransaction("Transaction1", "Tag2");
         
         if (getTransactionElapsedTime("Transaction1", "Tag1") > 5000)
         {
             setProgressPoint("Activity > 5 Seconds");
         }
         
         endTransaction("Transaction1", true, "Tag1");
         
         // do more activity
         endTransaction("Transaction1", true, "Tag2");
         
        Parameters:
        id - the transaction identifier
        tag - the transaction tag
        Returns:
        the elapsed time of the transaction, in milliseconds
        Throws:
        ContextTerminationException - This Virtual User has been terminated
      • getTransactionElapsedTime

        public int getTransactionElapsedTime​(java.lang.String id,
                                             java.lang.String tag,
                                             VirtualUserScript script)
                                      throws ContextTerminationException
        Gets the current elapsed time of the transaction with the specified id and tag.

        e.g.

        
         startTransaction("Transaction1", "Tag1");
         
         // do activity
         
         startTransaction("Transaction1", "Tag2");
         
         if (getTransactionElapsedTime("Transaction1", "Tag1") > 5000)
         {
             setProgressPoint("Activity > 5 Seconds");
         }
         
         endTransaction("Transaction1", true, "Tag1");
         
         // do more activity
         endTransaction("Transaction1", true, "Tag2");
         
        Parameters:
        id - the transaction identifier
        tag - the transaction tag
        script - the current VirtualUserScript
        Returns:
        the elapsed time of the transaction, in milliseconds
        Throws:
        ContextTerminationException - This Virtual User has been terminated
      • getTimingElapsedTime

        public int getTimingElapsedTime()
                                 throws ContextTerminationException
        Gets the elapsed time of the current active timing.

        Returns 0 (zero) if there is no current timing. A timing can be started using the startTiming(String) method.

        e.g.

        
         startTiming("Timing1");
         
         // do activity
         
         if (getTimingElapsedTime() > 5000)
         {
             setProgressPoint("Activity > 5 Seconds");
         }
         
         // do more activity
         
         endTiming("Timing1");
         
        Returns:
        the elapsed time of the timing, in milliseconds
        Throws:
        ContextTerminationException - This Virtual User has been terminated
      • getTimingElapsedTime

        public int getTimingElapsedTime​(VirtualUserScript script)
                                 throws ContextTerminationException
        Gets the elapsed time of the current active timing.

        Returns 0 (zero) if there is no current timing. A timing can be started using the startTiming(String) method.

        e.g.

        
         startTiming("Timing1");
         
         // do activity
         
         if (getTimingElapsedTime() > 5000)
         {
             setProgressPoint("Activity > 5 Seconds");
         }
         
         // do more activity
         
         endTiming("Timing1");
         
        Parameters:
        script - the current VirtualUserScript
        Returns:
        the elapsed time of the timing, in milliseconds
        Throws:
        ContextTerminationException - This Virtual User has been terminated
      • startRequest

        public void startRequest​(java.lang.String request)
                          throws java.lang.Exception
        For internal use only.
        Parameters:
        request - internal use only
        Throws:
        java.lang.Exception - An error occurred
      • startRequest

        public void startRequest​(java.lang.String request,
                                 VirtualUserScript script)
                          throws java.lang.Exception
        For internal use only.
        Parameters:
        request - internal use only
        script - internal use only
        Throws:
        java.lang.Exception - An error occurred
      • endRequest

        public void endRequest​(java.lang.String request)
                        throws java.lang.Exception
        For internal use only.
        Parameters:
        request - internal use only
        Throws:
        java.lang.Exception - An error occurred
      • endRequest

        public void endRequest​(java.lang.String request,
                               MetricCollection metrics)
                        throws java.lang.Exception
        For internal use only.
        Parameters:
        request - internal use only
        metrics - internal use only
        Throws:
        java.lang.Exception - An error occurred
      • endRequest

        public void endRequest​(java.lang.String request,
                               MetricCollection metrics,
                               VirtualUserScript script)
                        throws java.lang.Exception
        For internal use only.
        Parameters:
        request - internal use only
        metrics - internal use only
        script - internal use only
        Throws:
        java.lang.Exception - An error occurred
      • recordMetric

        public void recordMetric​(java.lang.String name,
                                 int value)
                          throws java.lang.Exception
        Records a user metric.

        This can be any numeric value which is considered relevant to the test, such as the number of search results returned by a web page, or a count of files in a directory.

        The metric value is written to the Virtual User event log. A chart showing how the metric value changes during the test will be available in Test Controller and Analyzer.

        Parameters:
        name - the metric identifier
        value - the metric value
        Throws:
        java.lang.Exception - An error occurred
      • recordMetric

        public void recordMetric​(java.lang.String name,
                                 int value,
                                 VirtualUserScript script)
                          throws java.lang.Exception
        Records a user metric.

        This can be any numeric value which is considered relevant to the test, such as the number of search results returned by a web page, or a count of files in a directory.

        The metric value is written to the Virtual User event log. A chart showing how the metric value changes during the test will be available in Test Controller and Analyzer.

        Parameters:
        name - the metric identifier
        value - the metric value
        script - the current VirtualUserScript
        Throws:
        java.lang.Exception - An error occurred
      • recordMetrics

        public void recordMetrics​(MetricCollection metrics)
                           throws java.lang.Exception
        Records multiple user metrics simultaneously.

        These can be any numeric value which is considered relevant to the test, such as the number of search results returned by a web page, or a count of files in a directory.

        Each metric value is written to the Virtual User event log. A chart showing how the metric values change during the test will be available in Test Controller and Analyzer.

        Parameters:
        metrics - the collection of metrics to record
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        recordMetric(String, int)
      • recordMetrics

        public void recordMetrics​(MetricCollection metrics,
                                  VirtualUserScript script)
                           throws java.lang.Exception
        Records multiple user metrics simultaneously.

        These can be any numeric value which is considered relevant to the test, such as the number of search results returned by a web page, or a count of files in a directory.

        Each metric value is written to the Virtual User event log. A chart showing how the metric values change during the test will be available in Test Controller and Analyzer.

        Parameters:
        metrics - the collection of metrics to record
        script - the current VirtualUserScript
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        recordMetric(String, int)
      • onStartTransaction

        protected void onStartTransaction​(java.lang.String id,
                                          java.lang.String tag)
                                   throws java.lang.Exception
        This method is called whenever a transaction is started using the startTransaction(String) or startTransaction(String, String) methods.

        Override this method in your custom Virtual User if you have code which should be run whenever a transaction is started.

        Parameters:
        id - the transaction identifier
        tag - extra information which appears in the Info column
        Throws:
        java.lang.Exception - An error occurred
      • suspendTransaction

        public final void suspendTransaction​(java.lang.String id)
                                      throws java.lang.Exception
        Suspends the timing of the specified transaction.

        Use resumeTransaction(String) to resume timing again afterwards.

        e.g.

        
         startTransaction("login");
         
         // This should be included in the transaction time
         goToLoginPage();
         
         suspendTransaction("login");
         
         // The time taken for this processing to be done will be
         // subtracted from the total "login" transaction time
         // because it isn't related to the performance of the SUT
         prepareLoginDetails();
         
         resumeTransaction("login");
         
         // This should be included in the transaction time
         performLogin();
         
         endTransaction("login");
         
        Parameters:
        id - the transaction identifier
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        resumeTransaction(String), startTransaction(String), endTransaction(String)
      • suspendTransaction

        public final void suspendTransaction​(java.lang.String id,
                                             java.lang.String tag)
                                      throws java.lang.Exception
        Suspends the timing of the specified transaction, identified by tag as well as id.

        Use resumeTransaction(String, String) to resume timing again afterwards.

        e.g.

        
         startTransaction("login", "1");
         
         // This should be included in the transaction time
         goToLoginPage();
         
         suspendTransaction("login", "1");
         
         // The time taken for this processing to be done will be
         // subtracted from the total "login" transaction time
         // because it isn't related to the performance of the SUT
         prepareLoginDetails();
         
         resumeTransaction("login", "1");
         
         // This should be included in the transaction time
         performLogin();
         
         endTransaction("login", true, "1");
         
        Parameters:
        id - the transaction identifier
        tag - the transaction tag
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        resumeTransaction(String,String), startTransaction(String, String), endTransaction(String, boolean, String)
      • suspendTransaction

        public final void suspendTransaction​(java.lang.String id,
                                             java.lang.String tag,
                                             VirtualUserScript script)
                                      throws java.lang.Exception
        Suspends the timing of the specified transaction, identified by tag as well as id.

        Use resumeTransaction(String, String) to resume timing again afterwards.

        e.g.

        
         startTransaction("login", "1");
         
         // This should be included in the transaction time
         goToLoginPage();
         
         suspendTransaction("login", "1");
         
         // The time taken for this processing to be done will be
         // subtracted from the total "login" transaction time
         // because it isn't related to the performance of the SUT
         prepareLoginDetails();
         
         resumeTransaction("login", "1");
         
         // This should be included in the transaction time
         performLogin();
         
         endTransaction("login", true, "1");
         
        Parameters:
        id - the transaction identifier
        tag - the transaction tag
        script - the current VirtualUserScript
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        resumeTransaction(String,String), startTransaction(String, String), endTransaction(String, boolean, String)
      • onSuspendTransaction

        protected void onSuspendTransaction​(java.lang.String id,
                                            java.lang.String tag)
                                     throws java.lang.Exception
        This method is called whenever a transaction is suspended using the suspendTransaction(String) or suspendTransaction(String, String) methods.

        Override this method in your custom Virtual User if you have code which should be run whenever a transaction is suspended.

        Parameters:
        id - the transaction identifier
        tag - the transaction tag
        Throws:
        java.lang.Exception - An error occurred
      • resumeTransaction

        public final void resumeTransaction​(java.lang.String id)
                                     throws java.lang.Exception
        Resumes the timing of the specified transaction.

        Use this method after a call to suspendTransaction(String).

        e.g.

        
         startTransaction("login");
         
         // This should be included in the transaction time
         goToLoginPage();
         
         suspendTransaction("login");
         
         // The time taken for this processing to be done will be
         // subtracted from the total "login" transaction time
         // because it isn't related to the performance of the SUT
         prepareLoginDetails();
         
         resumeTransaction("login");
         
         // This should be included in the transaction time
         performLogin();
         
         endTransaction("login");
         
        Parameters:
        id - the transaction identifier
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        suspendTransaction(String), startTransaction(String), endTransaction(String)
      • resumeTransaction

        public final void resumeTransaction​(java.lang.String id,
                                            java.lang.String tag)
                                     throws java.lang.Exception
        Resumes the timing of the specified transaction, identified by tag as well as id.

        Use this method after a call to suspendTransaction(String, String).

        e.g.

        
         startTransaction("login", "1");
         
         // This should be included in the transaction time
         goToLoginPage();
         
         suspendTransaction("login", "1");
         
         // The time taken for this processing to be done will be
         // subtracted from the total "login" transaction time
         // because it isn't related to the performance of the SUT
         prepareLoginDetails();
         
         resumeTransaction("login", "1");
         
         // This should be included in the transaction time
         performLogin();
         
         endTransaction("login", true, "1");
         
        Parameters:
        id - the transaction identifier
        tag - the transaction tag
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        suspendTransaction(String,String), startTransaction(String, String), endTransaction(String, boolean, String)
      • resumeTransaction

        public final void resumeTransaction​(java.lang.String id,
                                            java.lang.String tag,
                                            VirtualUserScript script)
                                     throws java.lang.Exception
        Resumes the timing of the specified transaction, identified by tag as well as id.

        Use this method after a call to suspendTransaction(String, String).

        e.g.

        
         startTransaction("login", "1");
         
         // This should be included in the transaction time
         goToLoginPage();
         
         suspendTransaction("login", "1");
         
         // The time taken for this processing to be done will be
         // subtracted from the total "login" transaction time
         // because it isn't related to the performance of the SUT
         prepareLoginDetails();
         
         resumeTransaction("login", "1");
         
         // This should be included in the transaction time
         performLogin();
         
         endTransaction("login", true, "1");
         
        Parameters:
        id - the transaction identifier
        tag - the transaction tag
        script - the current VirtualUserScript
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        suspendTransaction(String,String), startTransaction(String, String), endTransaction(String, boolean, String)
      • onResumeTransaction

        protected void onResumeTransaction​(java.lang.String id,
                                           java.lang.String tag)
                                    throws java.lang.Exception
        This method is called whenever a transaction is resumed using the resumeTransaction(String) or resumeTransaction(String, String) methods.

        Override this method in your custom Virtual User if you have code which should be run whenever a transaction is resumed.

        Parameters:
        id - the transaction identifier
        tag - the transaction tag
        Throws:
        java.lang.Exception - An error occurred
      • getLastTransaction

        public java.lang.String getLastTransaction()
        Gets the name of the most recent transaction to have ended.
        Returns:
        the name of the most recent transaction to have ended
      • endTransaction

        public final int endTransaction​(java.lang.String id)
                                 throws java.lang.Exception
        Writes an end transaction event to the VU event log.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTransaction(String) method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the transaction time for the transaction named with the specified id.

        Test Controller and Analyzer use the transaction times to calculate statistics such as average transaction time for each different id. These statistics give an indication of the performance of the System Under Test, as they show how long it takes for Virtual Users to perform the actions.

        Parameters:
        id - the transaction identifier
        Returns:
        elapsed time in milliseconds since the start of the test
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        startTransaction(String), suspendTransaction(String), resumeTransaction(String)
      • endTransaction

        public final int endTransaction​(java.lang.String id,
                                        boolean pass)
                                 throws java.lang.Exception
        Writes an end transaction event to the VU event log, specifying whether the transaction passed.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTransaction(String) method method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the transaction time for the transaction named with the specified id.

        Test Controller and Analyzer use the transaction times to calculate statistics such as average transaction time for each different id. These statistics give an indication of the performance of the System Under Test, as they show how long it takes for Virtual Users to perform the actions.

        If the transaction failed, then it will be counted separately in Test Controller and Analyzer.

        Parameters:
        id - the transaction identifier
        pass - true if the transaction should be interpreted as a pass
        Returns:
        elapsed time in milliseconds since the start of the test
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        startTransaction(String), suspendTransaction(String), resumeTransaction(String)
      • endTransaction

        public final int endTransaction​(java.lang.String id,
                                        boolean pass,
                                        java.lang.String tag)
                                 throws java.lang.Exception
        Writes an end transaction event to the VU event log, specifying whether the transaction passed, and specifying a tag which appears in the Info column.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTransaction(String) method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the transaction time for the transaction named with the specified id.

        Test Controller and Analyzer use the transaction times to calculate statistics such as average transaction time for each different id. These statistics give an indication of the performance of the System Under Test, as they show how long it takes for Virtual Users to perform the actions.

        If the transaction failed, then it will be counted separately in Test Controller and Analyzer.

        Parameters:
        id - the transaction identifier
        pass - true if the transaction should be interpreted as a pass
        tag - extra information which appears in the Info column
        Returns:
        elapsed time in milliseconds since the start of the test
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        startTransaction(String, String), suspendTransaction(String), resumeTransaction(String)
      • endTransaction

        public final int endTransaction​(java.lang.String id,
                                        boolean pass,
                                        java.lang.String tag,
                                        VirtualUserScript script)
                                 throws java.lang.Exception
        Writes an end transaction event to the VU event log, specifying whether the transaction passed, and specifying a tag which appears in the Info column.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTransaction(String) method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the transaction time for the transaction named with the specified id.

        Test Controller and Analyzer use the transaction times to calculate statistics such as average transaction time for each different id. These statistics give an indication of the performance of the System Under Test, as they show how long it takes for Virtual Users to perform the actions.

        If the transaction failed, then it will be counted separately in Test Controller and Analyzer.

        Parameters:
        id - the transaction identifier
        pass - true if the transaction should be interpreted as a pass
        tag - extra information which appears in the Info column
        script - the current VirtualUserScript
        Returns:
        elapsed time in milliseconds since the start of the test
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        startTransaction(String, String), suspendTransaction(String), resumeTransaction(String)
      • recordTransaction

        public void recordTransaction​(java.lang.String id,
                                      int startTime,
                                      int duration,
                                      boolean pass)
                               throws java.lang.Exception
        Records a transaction in the VU event log, specifying whether the transaction passed.

        The recommended way to record a transaction is by using the startTransaction(String) and endTransaction(String) methods.

        However this method is useful if you need to measure a transaction but the start time and/or the transaction name are not known at the point the transaction starts. For example, you may wish to record a different transaction name depending on the result of a particular call to the SUT.

        e.g.

        
         int startTime = getElapsedTime();
         boolean result = doSomething();
         int duration = getElapsedTime() - startTime;
         
         // Transaction name differs, depending on the result of the call
         if (result)
         {
             recordTransaction("transaction1", startTime, duration, true);
         }
         else
         {
             recordTransaction("transaction2", startTime, duration, false);
         }
         
        Parameters:
        id - the transaction identifier
        startTime - the time at which the transaction started, measured in milliseconds since the start of the test run
        duration - the duration of the transaction, in milliseconds
        pass - true if the transaction should be interpreted as a pass
        Throws:
        java.lang.Exception - An error occurred
      • recordTransaction

        public void recordTransaction​(java.lang.String id,
                                      int startTime,
                                      int duration,
                                      boolean pass,
                                      VirtualUserScript script)
                               throws java.lang.Exception
        Records a transaction in the VU event log, specifying whether the transaction passed.

        The recommended way to record a transaction is by using the startTransaction(String) and endTransaction(String) methods.

        However this method is useful if you need to measure a transaction but the start time and/or the transaction name are not known at the point the transaction starts. For example, you may wish to record a different transaction name depending on the result of a particular call to the SUT.

        e.g.

        
         int startTime = getElapsedTime();
         boolean result = doSomething();
         int duration = getElapsedTime() - startTime;
         
         // Transaction name differs, depending on the result of the call
         if (result)
         {
             recordTransaction("transaction1", startTime, duration, true);
         }
         else
         {
             recordTransaction("transaction2", startTime, duration, false);
         }
         
        Parameters:
        id - the transaction identifier
        startTime - the time at which the transaction started, measured in milliseconds since the start of the test run
        duration - the duration of the transaction, in milliseconds
        pass - true if the transaction should be interpreted as a pass
        script - The current VirtualUserScript
        Throws:
        java.lang.Exception - An error occurred
      • recordTransaction

        public void recordTransaction​(java.lang.String id,
                                      int startTime,
                                      int duration)
                               throws java.lang.Exception
        Records a transaction in the VU event log.

        The recommended way to record a transaction is by using the startTransaction(String) and endTransaction(String) methods.

        However this method is useful if you need to measure a transaction but the start time and/or the transaction name are not known at the point the transaction starts. For example, you may wish to record a different transaction name depending on the result of a particular call to the SUT.

        e.g.

        
         int startTime = getElapsedTime();
         boolean result = doSomething();
         int duration = getElapsedTime() - startTime;
         
         // Transaction name differs, depending on the result of the call
         if (result)
         {
             recordTransaction("transaction1", startTime, duration);
         }
         else
         {
             recordTransaction("transaction2", startTime, duration);
         }
         
        Parameters:
        id - the transaction identifier
        startTime - the time at which the transaction started, measured in milliseconds since the start of the test run
        duration - the duration of the transaction, in milliseconds
        Throws:
        java.lang.Exception - An error occurred
      • recordTransaction

        public void recordTransaction​(java.lang.String id,
                                      java.util.Date startTime,
                                      int duration,
                                      boolean pass)
                               throws java.lang.Exception
        Records a transaction in the VU event log, specifying whether the transaction passed.

        The recommended way to record a transaction is by using the startTransaction(String) and endTransaction(String, boolean) methods.

        However this method is useful if you need to measure a transaction but the start time and/or the transaction name are not known at the point the transaction starts. For example, you may wish to record a different transaction name depending on the result of a particular call to the SUT.

        e.g.

        
         Date startTime = new Date();
         boolean result = doSomething();
         int duration = (int)(new Date().getTime() - startTime.getTime());
         
         // Transaction name differs, depending on the result of the call
         if (result)
         {
             recordTransaction("transaction1", startTime, duration, true);
         }
         else
         {
             recordTransaction("transaction2", startTime, duration, false);
         }
         
        Parameters:
        id - the transaction identifier
        startTime - the time at which the transaction started
        duration - the duration of the transaction, in milliseconds
        pass - true if the transaction should be interpreted as a pass
        Throws:
        java.lang.Exception - An error occurred
      • recordTransaction

        public void recordTransaction​(java.lang.String id,
                                      java.util.Date startTime,
                                      int duration,
                                      boolean pass,
                                      VirtualUserScript script)
                               throws java.lang.Exception
        Records a transaction in the VU event log, specifying whether the transaction passed.

        The recommended way to record a transaction is by using the startTransaction(String) and endTransaction(String, boolean) methods.

        However this method is useful if you need to measure a transaction but the start time and/or the transaction name are not known at the point the transaction starts. For example, you may wish to record a different transaction name depending on the result of a particular call to the SUT.

        e.g.

        
         Date startTime = new Date();
         boolean result = doSomething();
         int duration = (int)(new Date().getTime() - startTime.getTime());
         
         // Transaction name differs, depending on the result of the call
         if (result)
         {
             recordTransaction("transaction1", startTime, duration, true);
         }
         else
         {
             recordTransaction("transaction2", startTime, duration, false);
         }
         
        Parameters:
        id - the transaction identifier
        startTime - the time at which the transaction started
        duration - the duration of the transaction, in milliseconds
        pass - true if the transaction should be interpreted as a pass
        script - The current VirtualUserScript
        Throws:
        java.lang.Exception - An error occurred
      • recordTransaction

        public void recordTransaction​(java.lang.String id,
                                      java.util.Date startTime,
                                      int duration)
                               throws java.lang.Exception
        Records a transaction in the VU event log.

        The recommended way to record a transaction is by using the startTransaction(String) and endTransaction(String) methods.

        However this method is useful if you need to measure a transaction but the start time and/or the transaction name are not known at the point the transaction starts. For example, you may wish to record a different transaction name depending on the result of a particular call to the SUT.

        e.g.

        
         Date startTime = new Date();
         boolean result = doSomething();
         int duration = (int)(new Date().getTime() - startTime.getTime());
         
         // Transaction name differs, depending on the result of the call
         if (result)
         {
             recordTransaction("transaction1", startTime, duration);
         }
         else
         {
             recordTransaction("transaction2", startTime, duration);
         }
         
        Parameters:
        id - the transaction identifier
        startTime - the time at which the transaction started
        duration - the duration of the transaction, in milliseconds
        Throws:
        java.lang.Exception - An error occurred
      • fail

        public final void fail​(java.lang.String message,
                               boolean throwException)
                        throws java.lang.Exception
        Writes a fail event to the VU event log.
        Parameters:
        message - a failure message which appears in the Info column
        throwException - true if an FCException should be thrown
        Throws:
        java.lang.Exception - An error occurred
      • verify

        public boolean verify​(boolean arg,
                              boolean throwException)
                       throws java.lang.Exception
        Verifies that a boolean expression is true.
        Parameters:
        arg - the expression to evaluate
        throwException - true if an FCException should be thrown if the expression evaluates to false
        Returns:
        true if the expression evaluates to true
        Throws:
        java.lang.Exception - An error occurred
      • verifyEQ

        public final boolean verifyEQ​(java.lang.String arg1,
                                      java.lang.String arg2,
                                      boolean throwException,
                                      boolean caseInsensitive)
                               throws java.lang.Exception
        Verifies that two String objects are equal.
        Parameters:
        arg1 - the 1st String
        arg2 - the 2nd String
        throwException - true if an FCException should be thrown if the String objects are not equal
        caseInsensitive - true if the comparison should be case-insensitive
        Returns:
        true if the String objects are equal
        Throws:
        java.lang.Exception - An error occurred
      • verifyEQ

        public final boolean verifyEQ​(int arg1,
                                      int arg2,
                                      boolean throwException)
                               throws java.lang.Exception
        Verifies that two integers are equal.
        Parameters:
        arg1 - the 1st integer
        arg2 - the 2nd integer
        throwException - true if an FCException should be thrown if the integers are not equal
        Returns:
        true if the integers are equal
        Throws:
        java.lang.Exception - An error occurred
      • verifyEQ

        public final boolean verifyEQ​(long arg1,
                                      long arg2,
                                      boolean throwException)
                               throws java.lang.Exception
        Verifies that two longs are equal.
        Parameters:
        arg1 - the 1st long
        arg2 - the 2nd long
        throwException - true if an FCException should be thrown if the longs are not equal
        Returns:
        true if the longs are equal
        Throws:
        java.lang.Exception - An error occurred
      • verifyEQ

        public final boolean verifyEQ​(double arg1,
                                      double arg2,
                                      double delta,
                                      boolean throwException)
                               throws java.lang.Exception
        Verifies that two doubles are equal.
        Parameters:
        arg1 - the 1st double
        arg2 - the 2nd double
        delta - the maximum permitted difference between the two values
        throwException - true if an FCException should be thrown if the doubles are not equal
        Returns:
        true if the doubles are equal
        Throws:
        java.lang.Exception - An error occurred
      • verifyLT

        public final boolean verifyLT​(java.lang.String arg1,
                                      java.lang.String arg2,
                                      boolean throwException,
                                      boolean caseInsensitive)
                               throws java.lang.Exception
        Verifies that one String is less than another.
        Parameters:
        arg1 - the 1st String
        arg2 - the 2nd String
        throwException - true if an FCException should be thrown if the 1st String is not less than the 2nd String
        caseInsensitive - true if the comparison should be case-insensitive
        Returns:
        true if the 1st String is less than the 2nd String
        Throws:
        java.lang.Exception - An error occurred
      • verifyLT

        public final boolean verifyLT​(int arg1,
                                      int arg2,
                                      boolean throwException)
                               throws java.lang.Exception
        Verifies that one integer is less than another.
        Parameters:
        arg1 - the 1st integer
        arg2 - the 2nd integer
        throwException - true if an FCException should be thrown if the 1st integer is not less than the 2nd integer
        Returns:
        true if the 1st integer is less than the 2nd integer
        Throws:
        java.lang.Exception - An error occurred
      • verifyLT

        public final boolean verifyLT​(long arg1,
                                      long arg2,
                                      boolean throwException)
                               throws java.lang.Exception
        Verifies that one long is less than another.
        Parameters:
        arg1 - the 1st long
        arg2 - the 2nd long
        throwException - true if an FCException should be thrown if the 1st long is not less than the 2nd long
        Returns:
        true if the 1st long is less than the 2nd long
        Throws:
        java.lang.Exception - An error occurred
      • verifyLT

        public final boolean verifyLT​(double arg1,
                                      double arg2,
                                      double delta,
                                      boolean throwException)
                               throws java.lang.Exception
        Verifies that one double is less than another.
        Parameters:
        arg1 - the 1st double
        arg2 - the 2nd double
        delta - the maximum permitted difference between the values
        throwException - true if an FCException should be thrown if the 1st double is not less than the 2nd double
        Returns:
        true if the 1st double is less than the 2nd double
        Throws:
        java.lang.Exception - An error occurred
      • verifyLE

        public final boolean verifyLE​(java.lang.String arg1,
                                      java.lang.String arg2,
                                      boolean throwException,
                                      boolean caseInsensitive)
                               throws java.lang.Exception
        Verifies that one String is less than or equal to another.
        Parameters:
        arg1 - the 1st String
        arg2 - the 2nd String
        throwException - true if an FCException should be thrown if the 1st String is not less than or equal to the 2nd String
        caseInsensitive - true if the comparison should be case-insensitive
        Returns:
        true if the 1st String is less than or equal to the 2nd String
        Throws:
        java.lang.Exception - An error occurred
      • verifyLE

        public final boolean verifyLE​(int arg1,
                                      int arg2,
                                      boolean throwException)
                               throws java.lang.Exception
        Verifies that one integer is less than or equal to another.
        Parameters:
        arg1 - the 1st integer
        arg2 - the 2nd integer
        throwException - true if an FCException should be thrown if the 1st integer is not less than or equal to the 2nd integer
        Returns:
        true if the 1st integer is less than or equal to the 2nd integer
        Throws:
        java.lang.Exception - An error occurred
      • verifyLE

        public final boolean verifyLE​(long arg1,
                                      long arg2,
                                      boolean throwException)
                               throws java.lang.Exception
        Verifies that one long is less than or equal to another.
        Parameters:
        arg1 - the 1st long
        arg2 - the 2nd long
        throwException - true if an FCException should be thrown if the 1st long is not less than or equal to the 2nd long
        Returns:
        true if the 1st long is less than or equal to the 2nd long
        Throws:
        java.lang.Exception - An error occurred
      • verifyLE

        public final boolean verifyLE​(double arg1,
                                      double arg2,
                                      double delta,
                                      boolean throwException)
                               throws java.lang.Exception
        Verifies that one double is less than or equal to another.
        Parameters:
        arg1 - the 1st double
        arg2 - the 2nd double
        delta - the maximum permitted difference between the values
        throwException - true if an FCException should be thrown if the 1st double is not less than or equal to the 2nd double
        Returns:
        true if the 1st double is less than or equal to the 2nd double
        Throws:
        java.lang.Exception - An error occurred
      • startTiming

        public final void startTiming​(java.lang.String id)
                               throws java.lang.Exception
        Writes a start timing event to the VU event log.

        The time in milliseconds since the start of the test run is recorded when this method is called. When endTiming(String) is called with the same id, an end timing event is written to the VU event log. eggPlant Performance uses the time difference between the events to calculate the timing with the specified id.

        Timings are similar to transactions but are measured and grouped separately in test results.

        Parameters:
        id - the timing identifier
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        endTiming(String), endTiming(String, boolean)
      • onStartTiming

        protected void onStartTiming​(java.lang.String timing)
                              throws java.lang.Exception
        This method is called whenever a timing is started using the startTiming(String) method.

        Override this method in your custom Virtual User if you have code which should be run whenever a timing is started.

        Parameters:
        timing - the timing identifier
        Throws:
        java.lang.Exception - An error occurred
      • endTiming

        public final void endTiming​(java.lang.String id)
                             throws java.lang.Exception
        Writes an end timing event to the VU event log.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTiming(String) method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the timing with the specified id.

        Timings are similar to transactions but are measured and grouped separately in test results.

        Parameters:
        id - the timing identifier
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        startTiming(String)
      • endTiming

        public final void endTiming​(java.lang.String id,
                                    boolean pass)
                             throws java.lang.Exception
        Writes an end timing event to the VU event log, specifying whether the timing passed.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTiming(String) method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the timing with the specified id.

        Timings are similar to transactions but are measured and grouped separately in test results.

        If the timing failed, then it will be counted separately in Test Controller and Analyzer.

        Parameters:
        id - the timing identifier
        pass - true if the timing should be interpreted as a pass
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        startTiming(String)
      • endTiming

        public final void endTiming​(java.lang.String id,
                                    boolean pass,
                                    VirtualUserScript script)
                             throws java.lang.Exception
        Writes an end timing event to the VU event log, specifying whether the timing passed.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTiming(String) method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the timing with the specified id.

        Timings are similar to transactions but are measured and grouped separately in test results.

        If the timing failed, then it will be counted separately in Test Controller and Analyzer.

        Parameters:
        id - the timing identifier
        pass - true if the timing should be interpreted as a pass
        script - The current VirtualUserScript
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        startTiming(String)
      • onEndTiming

        protected void onEndTiming​(java.lang.String timing,
                                   boolean pass)
                            throws java.lang.Exception
        This method is called whenever a timing is ended using the endTiming(String) or endTiming(String, boolean) methods.

        Override this method in your custom Virtual User if you have code which should be run whenever a timing is ended.

        Parameters:
        timing - the timing identifier
        pass - true if the timing should be interpreted as a pass
        Throws:
        java.lang.Exception - An error occurred
      • writeMessage

        public void writeMessage​(java.lang.String message)
                          throws java.lang.Exception
        Writes an information message to the VU event log.
        Parameters:
        message - an information message which appears in the Info column
        Throws:
        java.lang.Exception - An error occurred
      • writeMessage

        public void writeMessage​(java.lang.String id,
                                 java.lang.String message)
                          throws java.lang.Exception
        Writes an information message to the VU event log, specifying an identifier which appears in the ID column.
        Parameters:
        id - the message identifier, which appears in the ID column
        message - an information message which appears in the Info column
        Throws:
        java.lang.Exception - An error occurred
      • writeMessage

        public void writeMessage​(java.lang.String id,
                                 java.lang.String info,
                                 java.lang.String imagePath)
                          throws java.lang.Exception
        Writes an information message to the VU event log and also a link to an image, specifying an identifier which appears in the ID column.

        The image must be contained within the run directory (as returned by getRunPath()), and the path passed should be relative to this path.

        Parameters:
        id - the message identifier, which appears in the ID column
        info - an information message which appears in the Info column
        imagePath - the path to an image file (such as a png or bmp). The path should be a relative path.
        Throws:
        java.lang.Exception - An error occurred
      • writeMessage

        public void writeMessage​(java.lang.Exception e)
                          throws java.lang.Exception
        Write an information message to the VU event log, consisting of the exception specified.
        Parameters:
        e - The exception to write to the event log.
        Throws:
        java.lang.Exception - An error occurred
      • onWriteMessage

        protected void onWriteMessage​(java.lang.String id,
                                      java.lang.String message)
                               throws java.lang.Exception
        This method is called whenever an information message is written to the VU event log using the writeMessage(String) or writeMessage(String, String) methods.

        Override this method in your custom Virtual User if you have code which should be run whenever an information message is written to the VU event log.

        Parameters:
        id - the message identifier, which appears in the ID column
        message - an information message which appears in the Info column
        Throws:
        java.lang.Exception - An error occurred
      • pre

        protected void pre()
                    throws java.lang.Exception
        This method is called before any scripts are executed.

        Override this method in your custom Virtual User if you have code which should be run only once, before any scripts are executed.

        This method initialises logging systems. If you override this method in a custom Virtual User, then a call to super.pre() must be made and must occur before any code that may cause an exception or write to a log.

        Throws:
        java.lang.Exception - An error occurred
      • openEventLog

        public final void openEventLog()
                                throws java.lang.Exception
        For internal use only.
        Throws:
        java.lang.Exception - An error occurred
      • post

        protected void post()
                     throws java.lang.Exception
        This method is called after all scripts have finished executing.

        Override this method in your custom Virtual User if you have code which should be run only once, after all scripts have finished executing.

        This method shuts down logging systems. If you override this method in a custom Virtual User, then a call to super.post() must be made at the end of the method. All exceptions thrown during the execution of this method must be caught and handled.

        Throws:
        java.lang.Exception - An error occurred
      • startCustomVUWatcher

        public void startCustomVUWatcher()
        For internal use only.
      • stopCustomVUWatcher

        public void stopCustomVUWatcher()
        For internal use only.
      • getSandboxPath

        public java.lang.String getSandboxPath()
                                        throws NoSuchValueException,
                                               BadValueException
        Gets the path to the sandbox location.

        The sandbox is the root location on an injector machine beneath which all test run files are stored. This includes files transferred from the controller machine (project/workspace dlls and jars, data) and test run results and events written during test execution.

        Returns:
        the path to the sandbox location
        Throws:
        NoSuchValueException - Unable to find sandbox path
        BadValueException - Sandbox path is null
      • getDataPath

        public java.lang.String getDataPath()
                                     throws NoSuchValueException,
                                            BadValueException
        Gets the path to the data folder.

        This is the folder on an injector machine to which data files are transferred from the controller machine. Files in this folder are only transferred if explicitly assigned to a test or test group.

        Note that all files in the project data\Files folder are copied to all injectors - see getFilesDataPath().

        Returns:
        the path to the data folder
        Throws:
        NoSuchValueException - Unable to find data path
        BadValueException - Data path is null
      • getFilesDataPath

        public java.lang.String getFilesDataPath()
                                          throws NoSuchValueException,
                                                 BadValueException
        Gets the path of the data\Files folder.

        This is the folder on an injector machine to which all the files in the data\Files folder on the controller machine are transferred.

        Returns:
        the path of the data\Files folder
        Throws:
        NoSuchValueException - Unable to find data path
        BadValueException - Data path is null
      • getRunPath

        public java.lang.String getRunPath()
        Gets the path to the test run results.

        The run path is the disk location on an injector machine to which Virtual User event files and logs are written.

        Returns:
        the path to the test run results
      • failAction

        public void failAction​(ActionType action,
                               java.lang.String msg)
                        throws java.lang.Exception
        Takes the specified action, using the specified error msg.
        Parameters:
        action - the action to take
        msg - the error message
        Throws:
        java.lang.Exception - An error occurred
      • failTiming

        public void failTiming​(java.lang.String id)
                        throws java.lang.Exception
        Writes a fail timing event to the VU event log.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTiming(String) method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the timing with the specified id.

        This timing will be interpreted as having failed, so it will be counted separately in Test Controller and Analyzer. This is equivalent to calling endTiming(String, boolean) with a pass value of false.

        Timings are similar to transactions but are measured and grouped separately in test results.

        Parameters:
        id - the timing identifier
        Throws:
        java.lang.Exception - An error occurred
      • failTiming

        public void failTiming​(java.lang.String id,
                               VirtualUserScript script)
                        throws java.lang.Exception
        Writes a fail timing event to the VU event log.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTiming(String) method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the timing with the specified id.

        This timing will be interpreted as having failed, so it will be counted separately in Test Controller and Analyzer. This is equivalent to calling endTiming(String, boolean) with a pass value of false.

        Timings are similar to transactions but are measured and grouped separately in test results.

        Parameters:
        id - the timing identifier
        script - the current VirtualUserScript
        Throws:
        java.lang.Exception - An error occurred
      • failTransaction

        public int failTransaction​(java.lang.String id)
                            throws java.lang.Exception
        Writes a fail transaction event to the VU event log.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTransaction(String) method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the transaction time for the transaction named with the specified id.

        This transaction will be interpreted as having failed, so it will be counted separately in Test Controller and Analyzer. This is equivalent to calling endTransaction(String, boolean) with a pass value of false.

        Test Controller and Analyzer use the transaction times to calculate statistics such as average transaction time for each different id. These statistics give an indication of the performance of the System Under Test, as they show how long it takes for Virtual Users to perform the actions.

        Parameters:
        id - the transaction identifier
        Returns:
        elapsed time in milliseconds since the start of the test
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        startTransaction(String), endTransaction(String)
      • failTransaction

        public int failTransaction​(java.lang.String id,
                                   java.lang.String tag)
                            throws java.lang.Exception
        Writes a fail transaction event to the VU event log, specifying a tag which appears in the Info column.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTransaction(String, String) method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the transaction time for the transaction named with the specified id.

        This transaction will be interpreted as having failed, so it will be counted separately in Test Controller and Analyzer. This is equivalent to calling endTransaction(String, boolean, String) with a pass value of false.

        Test Controller and Analyzer use the transaction times to calculate statistics such as average transaction time for each different id. These statistics give an indication of the performance of the System Under Test, as they show how long it takes for Virtual Users to perform the actions.

        Parameters:
        id - the transaction identifier
        tag - extra information which appears in the Info column
        Returns:
        elapsed time in milliseconds since the start of the test
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        startTransaction(String, String), endTransaction(String, boolean, String)
      • failTransaction

        public int failTransaction​(java.lang.String id,
                                   java.lang.String tag,
                                   VirtualUserScript script)
                            throws java.lang.Exception
        Writes a fail transaction event to the VU event log, specifying a tag which appears in the Info column.

        The time in milliseconds since the start of the test run is recorded when this method is called. The startTransaction(String, String) method should already have been called with the same id. eggPlant Performance uses the time difference between the events to calculate the transaction time for the transaction named with the specified id.

        This transaction will be interpreted as having failed, so it will be counted separately in Test Controller and Analyzer. This is equivalent to calling endTransaction(String, boolean, String) with a pass value of false.

        Test Controller and Analyzer use the transaction times to calculate statistics such as average transaction time for each different id. These statistics give an indication of the performance of the System Under Test, as they show how long it takes for Virtual Users to perform the actions.

        Parameters:
        id - the transaction identifier
        tag - extra information which appears in the Info column
        script - the current VirtualUserScript
        Returns:
        elapsed time in milliseconds since the start of the test
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        startTransaction(String, String), endTransaction(String, boolean, String)
      • flushEventLog

        public final void flushEventLog()
                                 throws java.lang.Exception
        Flushes the event log to disk.

        Any events still held in-memory are written to the Virtual User event log on disk. This enables the event log file to be viewed before the test has completed.

        Note that writing an error event also flushes the log.

        Throws:
        java.lang.Exception - An error occurred
        See Also:
        warn(String), writeMessage(String), error(String)
      • getName

        public final java.lang.String getName()
        Description copied from interface: DataDictionary
        Gets the name of this dictionary.
        Specified by:
        getName in interface DataDictionary
        Returns:
        the name of the Data Dictionary
      • logCurrentDataValues

        public void logCurrentDataValues()
                                  throws java.lang.Exception
        Write all of the current data values to the VU event log
        Throws:
        java.lang.Exception - An error occurred
        See Also:
        writeMessage(String)
      • toString

        public final java.lang.String toString()
        Description copied from interface: DataDictionary
        Returns a String representation of the dictionary.
        Specified by:
        toString in interface DataDictionary
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String representing the key/value pairs in the dictionary
      • onStartInitialSection

        public void onStartInitialSection()
        This method is called whenever the Virtual User is about to start executing the initial sequence of scripts in its workflow.

        Override this method in your custom Virtual User if you have code which should be run whenever the Virtual User starts executing the initial sequence of scripts.

      • onStartFinalSection

        public void onStartFinalSection()
        This method is called whenever the Virtual User is about to start executing the final sequence of scripts in its workflow.

        Override this method in your custom Virtual User if you have code which should be run whenever the Virtual User starts executing the final sequence of scripts.

      • attachLogMessageSender

        public void attachLogMessageSender​(com.facilita.fc.runtime.IMessageSender messageSender)
        For internal use only.
        Parameters:
        messageSender - internal use only
      • getMap

        public java.util.Map getMap()
        Description copied from interface: DataDictionary
        Gets a Map containing all the keys/values in this dictionary.
        Specified by:
        getMap in interface DataDictionary
        Returns:
        a Map containing all the keys/values in this dictionary
      • keys

        public java.util.Iterator keys()
        Description copied from interface: DataDictionary
        Returns an Iterator that can be used to iterate over the keys in this dictionary.
        Specified by:
        keys in interface DataDictionary
        Returns:
        an Iterator that can be used to iterate over the keys in this dictionary
      • isReadOnly

        public boolean isReadOnly()
        Description copied from interface: DataDictionary
        Returns true if this dictionary is read-only.
        Specified by:
        isReadOnly in interface DataDictionary
        Returns:
        true if this dictionary is read-only
      • setName

        public void setName​(java.lang.String name)
        Description copied from interface: DataDictionary
        Sets the name of this dictionary.
        Specified by:
        setName in interface DataDictionary
        Parameters:
        name - the name of the Data Dictionary
      • hasKey

        public boolean hasKey​(java.lang.String key)
        Description copied from interface: DataDictionary
        Returns true if the specified key is contained within the dictionary.

        e.g.

        
         if (myDictionary.HasKey("newHostName"))
         {
             // do something
         }
         else
         {
             // do something else
         }
         
        Specified by:
        hasKey in interface DataDictionary
        Parameters:
        key - the key to be looked up in the dictionary
        Returns:
        true if the dictionary contains the specified key
      • getMillisecondsSinceEpoch

        public static java.lang.String getMillisecondsSinceEpoch()
      • getMillisecondsSinceEpoch

        public static java.lang.String getMillisecondsSinceEpoch​(long offset)
      • getSecondsSinceEpoch

        public static java.lang.String getSecondsSinceEpoch()
      • getSecondsSinceEpoch

        public static java.lang.String getSecondsSinceEpoch​(long offset)
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.LocalDateTime dateTime,
                                                      java.time.Duration offset,
                                                      java.time.ZoneId timezone,
                                                      java.util.Locale locale)
        Converts a LocalDateTime object to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", LocalDateTime.of(2017, 9, 15, 7, 41, 25), Duration.ofHours(1), ZoneId.of("Asia/Tokyo"), Locale.FRENCH);
         
         
        Parameters:
        format - The date and time format string
        dateTime - The LocalDateTime object to be represented as a string
        offset - An offset to apply to the DateTime object before it is formatted
        timezone - The time zone to use
        locale - The locale to use
        Returns:
        A string representation of the LocalDateTime
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format)
        Converts the current date/time to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy");
         
         
        Parameters:
        format - The date and time format string
        Returns:
        A string representation of the current date/time
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.LocalDateTime dateTime)
        Converts a LocalDateTime object to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", LocalDateTime.of(2017, 9, 15, 7, 41, 25));
         
         
        Parameters:
        format - The date and time format string
        dateTime - The LocalDateTime object to be represented as a string
        Returns:
        A string representation of the LocalDateTime
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.Duration offset)
        Converts the current date/time, offset by a specified Duration, to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", Duration.ofHours(1));
         
         
        Parameters:
        format - The date and time format string
        offset - An offset to apply to the DateTime object before it is formatted
        Returns:
        A string representation of the current date/time
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.ZoneId timezone)
        Converts the current date/time to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", ZoneId.of("Asia/Tokyo"));
         
         
        Parameters:
        format - The date and time format string
        timezone - The time zone to use
        Returns:
        A string representation of the current date/time
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.util.Locale locale)
        Converts the current date/time to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", Locale.FRENCH);
         
         
        Parameters:
        format - The date and time format string
        locale - The locale to use
        Returns:
        A string representation of the current date/time
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.LocalDateTime dateTime,
                                                      java.time.Duration offset)
        Converts a LocalDateTime object to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", LocalDateTime.of(2017, 9, 15, 7, 41, 25), Duration.ofHours(1));
         
         
        Parameters:
        format - The date and time format string
        dateTime - The LocalDateTime object to be represented as a string
        offset - An offset to apply to the DateTime object before it is formatted
        Returns:
        A string representation of the LocalDateTime
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.LocalDateTime dateTime,
                                                      java.time.ZoneId timezone)
        Converts a LocalDateTime object to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", LocalDateTime.of(2017, 9, 15, 7, 41, 25), ZoneId.of("Asia/Tokyo"));
         
         
        Parameters:
        format - The date and time format string
        dateTime - The LocalDateTime object to be represented as a string
        timezone - The time zone to use
        Returns:
        A string representation of the LocalDateTime
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.LocalDateTime dateTime,
                                                      java.util.Locale locale)
        Converts a LocalDateTime object to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", LocalDateTime.of(2017, 9, 15, 7, 41, 25), Locale.FRENCH);
         
         
        Parameters:
        format - The date and time format string
        dateTime - The LocalDateTime object to be represented as a string
        locale - The locale to use
        Returns:
        A string representation of the LocalDateTime
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.Duration offset,
                                                      java.time.ZoneId timezone)
        Converts the current date/time to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", Duration.ofHours(1), ZoneId.of("Asia/Tokyo"));
         
         
        Parameters:
        format - The date and time format string
        offset - An offset to apply to the DateTime object before it is formatted
        timezone - The time zone to use
        Returns:
        A string representation of the current date/time
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.Duration offset,
                                                      java.util.Locale locale)
        Converts the current date/time to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", Duration.ofHours(1), Locale.FRENCH);
         
         
        Parameters:
        format - The date and time format string
        offset - An offset to apply to the DateTime object before it is formatted
        locale - The locale to use
        Returns:
        A string representation of the current date/time
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.ZoneId timezone,
                                                      java.util.Locale locale)
        Converts the current date/time to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", ZoneId.of("Asia/Tokyo"), Locale.FRENCH);
         
         
        Parameters:
        format - The date and time format string
        timezone - The time zone to use
        locale - The locale to use
        Returns:
        A string representation of the LocalDateTime
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.LocalDateTime dateTime,
                                                      java.time.Duration offset,
                                                      java.time.ZoneId timezone)
        Converts a LocalDateTime object to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", LocalDateTime.of(2017, 9, 15, 7, 41, 25), Duration.ofHours(1), ZoneId.of("Asia/Tokyo"));
         
         
        Parameters:
        format - The date and time format string
        dateTime - The LocalDateTime object to be represented as a string
        offset - An offset to apply to the DateTime object before it is formatted
        timezone - The time zone to use
        Returns:
        A string representation of the LocalDateTime
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.LocalDateTime dateTime,
                                                      java.time.Duration offset,
                                                      java.util.Locale locale)
        Converts a LocalDateTime object to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", LocalDateTime.of(2017, 9, 15, 7, 41, 25), Duration.ofHours(1), Locale.FRENCH);
         
         
        Parameters:
        format - The date and time format string
        dateTime - The LocalDateTime object to be represented as a string
        offset - An offset to apply to the DateTime object before it is formatted
        locale - The locale to use
        Returns:
        A string representation of the LocalDateTime
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.LocalDateTime dateTime,
                                                      java.time.ZoneId timezone,
                                                      java.util.Locale locale)
        Converts a LocalDateTime object to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", LocalDateTime.of(2017, 9, 15, 7, 41, 25), ZoneId.of("Asia/Tokyo"), Locale.FRENCH);
         
         
        Parameters:
        format - The date and time format string
        dateTime - The LocalDateTime object to be represented as a string
        timezone - The time zone to use
        locale - The locale to use
        Returns:
        A string representation of the LocalDateTime
      • formatDateTime

        public static java.lang.String formatDateTime​(java.lang.String format,
                                                      java.time.Duration offset,
                                                      java.time.ZoneId timezone,
                                                      java.util.Locale locale)
        Converts the current date/time to its equivalent string representation using the specified format.

        The format string should be a standard date and time format string, as described here

        Example:

         
         String formattedDateTime = formatDateTime("HH:mm:ss MM/dd/yyyy", Duration.ofHours(1), ZoneId.of("Asia/Tokyo"), Locale.FRENCH);
         
         
        Parameters:
        format - The date and time format string
        offset - An offset to apply to the DateTime object before it is formatted
        timezone - The time zone to use
        locale - The locale to use
        Returns:
        A string representation of the LocalDateTime
      • getCurrentTimeInXml

        public static javax.xml.datatype.XMLGregorianCalendar getCurrentTimeInXml()
                                                                           throws javax.xml.datatype.DatatypeConfigurationException
        Throws:
        javax.xml.datatype.DatatypeConfigurationException
      • getTransactionData

        public TransactionData getTransactionData​(java.lang.String id)
                                           throws NoSuchValueException
        Get data about the specified transaction.
        Parameters:
        id - The id of the transaction
        Returns:
        data about the specified transaction.
        Throws:
        NoSuchValueException - The transaction cannot be found
      • unsetSynchronizationPoint

        public void unsetSynchronizationPoint​(java.lang.String id)
        Unset a named synchronization point.

        Any threads that are waiting for this synchronization point will not be allowed to continue until the synchronization point is set

        Parameters:
        id - the name of the synchronization point to unset
        See Also:
        setSynchronizationPoint(String), waitForSynchronizationPoint(String, long)
      • waitForSynchronizationPoint

        public void waitForSynchronizationPoint​(java.lang.String id,
                                                long timeoutMilliseconds)
                                         throws com.facilita.exception.TimeoutException
        Wait for a named synchronization point to be set.

        This method will block until either the named synchronization point is set, or the timeout period has elapsed. If the timeout period elapses before the synchronization point is set then an exception will be thrown.

        Parameters:
        id - the name of the synchronization point to wait for
        timeoutMilliseconds - the maximum time in milliseconds to wait before throwing an exception
        Throws:
        com.facilita.exception.TimeoutException - thrown if the synchronization point has not been set before the timeout period elapses.
        See Also:
        setSynchronizationPoint(String), unsetSynchronizationPoint(String)
      • waitFor

        public <T> T waitFor​(java.lang.String key,
                             long timeout)
                      throws com.facilita.exception.TimeoutException,
                             NoSuchValueException,
                             BadValueException
        Returns a reference to an object stored in the data dictionary. If the object is not yet in the data dictionary, then this method will wait for up to the timeout for the object to be added. For example, a foreground script may need to wait for a background script to put an object into the data dictionary before continuing.
        Type Parameters:
        T - The type of the object to retreive from the data dictionary.
        Parameters:
        key - The key to be looked up in the dictionary.
        timeout - The maximum amount of time (milliseconds) to wait for the object to be added to the dictionary.
        Returns:
        An object value held in the dictionary.
        Throws:
        com.facilita.exception.TimeoutException - The object was not put into the dictionary in time
        NoSuchValueException - the key does not exist in the dictionary
        BadValueException - the key was null
      • waitForString

        public java.lang.String waitForString​(java.lang.String key,
                                              long timeout)
                                       throws com.facilita.exception.TimeoutException,
                                              NoSuchValueException,
                                              BadValueException
        Returns a reference to a String stored in the data dictionary. If the String is not yet in the data dictionary, then this method will wait for up to the timeout for the String to be added. For example, a foreground script may need to wait for a background script to put a String into the data dictionary before continuing.
        Parameters:
        key - The key to be looked up in the dictionary.
        timeout - The maximum amount of time (milliseconds) to wait for the String to be added to the dictionary.
        Returns:
        A String value held in the dictionary.
        Throws:
        com.facilita.exception.TimeoutException - The String was not put into the dictionary in time
        NoSuchValueException - the key does not exist in the dictionary
        BadValueException - the key was null
      • waitForInt

        public int waitForInt​(java.lang.String key,
                              long timeout)
                       throws com.facilita.exception.TimeoutException,
                              NoSuchValueException,
                              BadValueException
        Returns an int stored in the data dictionary. If the int is not yet in the data dictionary, then this method will wait for up to the timeout for the int to be added. For example, a foreground script may need to wait for a background script to put an int into the data dictionary before continuing.
        Parameters:
        key - The key to be looked up in the dictionary.
        timeout - The maximum amount of time (milliseconds) to wait for the int to be added to the dictionary.
        Returns:
        A int value held in the dictionary.
        Throws:
        com.facilita.exception.TimeoutException - The int was not put into the dictionary in time
        NoSuchValueException - the key does not exist in the dictionary
        BadValueException - the key was null
      • waitForBoolean

        public boolean waitForBoolean​(java.lang.String key,
                                      long timeout)
                               throws com.facilita.exception.TimeoutException,
                                      NoSuchValueException,
                                      BadValueException
        Returns a boolean stored in the data dictionary. If the boolean is not yet in the data dictionary, then this method will wait for up to the timeout for the boolean to be added. For example, a foreground script may need to wait for a background script to put a boolean into the data dictionary before continuing.
        Parameters:
        key - The key to be looked up in the dictionary.
        timeout - The maximum amount of time (milliseconds) to wait for the boolean to be added to the dictionary.
        Returns:
        A boolean value held in the dictionary.
        Throws:
        com.facilita.exception.TimeoutException - The boolean was not put into the dictionary in time
        NoSuchValueException - the key does not exist in the dictionary
        BadValueException - the key was null
      • waitForDouble

        public double waitForDouble​(java.lang.String key,
                                    long timeout)
                             throws com.facilita.exception.TimeoutException,
                                    NoSuchValueException,
                                    BadValueException
        Returns a double stored in the data dictionary. If the double is not yet in the data dictionary, then this method will wait for up to the timeout for the double to be added. For example, a foreground script may need to wait for a background script to put a double into the data dictionary before continuing.
        Parameters:
        key - The key to be looked up in the dictionary.
        timeout - The maximum amount of time (milliseconds) to wait for the double to be added to the dictionary.
        Returns:
        A double value held in the dictionary.
        Throws:
        com.facilita.exception.TimeoutException - The double was not put into the dictionary in time
        NoSuchValueException - the key does not exist in the dictionary
        BadValueException - the key was null
      • waitForFloat

        public float waitForFloat​(java.lang.String key,
                                  long timeout)
                           throws com.facilita.exception.TimeoutException,
                                  NoSuchValueException,
                                  BadValueException
        Returns a float stored in the data dictionary. If the float is not yet in the data dictionary, then this method will wait for up to the timeout for the float to be added. For example, a foreground script may need to wait for a background script to put a float into the data dictionary before continuing.
        Parameters:
        key - The key to be looked up in the dictionary.
        timeout - The maximum amount of time (milliseconds) to wait for the float to be added to the dictionary.
        Returns:
        A float value held in the dictionary.
        Throws:
        com.facilita.exception.TimeoutException - The float was not put into the dictionary in time
        NoSuchValueException - the key does not exist in the dictionary
        BadValueException - the key was null
      • waitForList

        public java.util.List waitForList​(java.lang.String key,
                                          long timeout)
                                   throws com.facilita.exception.TimeoutException,
                                          NoSuchValueException,
                                          BadValueException
        Returns a reference to a List stored in the data dictionary. If the List is not yet in the data dictionary, then this method will wait for up to the timeout for the List to be added. For example, a foreground script may need to wait for a background script to put a List into the data dictionary before continuing.
        Parameters:
        key - The key to be looked up in the dictionary.
        timeout - The maximum amount of time (milliseconds) to wait for the List to be added to the dictionary.
        Returns:
        A List value held in the dictionary.
        Throws:
        com.facilita.exception.TimeoutException - The List was not put into the dictionary in time
        NoSuchValueException - the key does not exist in the dictionary
        BadValueException - the key was null
      • waitForLong

        public long waitForLong​(java.lang.String key,
                                long timeout)
                         throws com.facilita.exception.TimeoutException,
                                NoSuchValueException,
                                BadValueException
        Returns a long stored in the data dictionary. If the long is not yet in the data dictionary, then this method will wait for up to the timeout for the long to be added. For example, a foreground script may need to wait for a background script to put a long into the data dictionary before continuing.
        Parameters:
        key - The key to be looked up in the dictionary.
        timeout - The maximum amount of time (milliseconds) to wait for the long to be added to the dictionary.
        Returns:
        A long value held in the dictionary.
        Throws:
        com.facilita.exception.TimeoutException - The long was not put into the dictionary in time
        NoSuchValueException - the key does not exist in the dictionary
        BadValueException - the key was null
      • selectRandomEntryFromList

        public <T> T selectRandomEntryFromList​(java.lang.String key)
                                        throws NoSuchValueException,
                                               BadValueException
        Selects a random entry from a list stored in this Virtual User's data dictionary.
        Type Parameters:
        T - The type of object that is stored in the list.
        Parameters:
        key - The key to be looked up in the dictionary.
        Returns:
        A randomly selected entry from the list.
        Throws:
        NoSuchValueException - the key does not exist in the dictionary
        BadValueException - the key was null
      • setDebugMode

        public void setDebugMode​(boolean debugMode)
      • isDebugMode

        public boolean isDebugMode()
      • getJmeterTestPlanName

        public java.lang.String getJmeterTestPlanName()
        Specified by:
        getJmeterTestPlanName in interface com.facilita.fc.runtime.IMonitoredVU