Class Lib


  • public class Lib
    extends java.lang.Object
    A library with methods which can be called from JavaScript and supports also the All Purpose Interface.
    • Constructor Summary

      Constructors 
      Constructor Description
      Lib​(com.dkfqs.measuringagent.javascript.JavaScriptRhinoTestJobExecutorContext testJobExecutorContext, com.dkfqs.measuringagent.javascript.executor.RhinoExecutorThread rhinoExecutorThread, com.dkfqs.measuringagent.javascript.executor.ExecutorConsoleLog executorConsoleLog, int simulatedUserNumber)
      Create a new instance - per simulated user.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAverageDeltaAndCurrentValue​(long statisticId, long currentValue)
      All Purpose Interface: Add one delta value to the average and set the current value for a 'average-and-current-value' statistic.
      void addAverageDeltaAndCurrentValue​(long statisticId, long sumValuesDelta, long numValuesDelta, long currentValue)
      All Purpose Interface: Add delta values to the average and set the current value for a 'average-and-current-value' statistic.
      void addAverageDeltaAndCurrentValue​(long statisticId, long sumValuesDelta, long numValuesDelta, long currentValue, long currentValueTimestamp)
      All Purpose Interface: Add delta values to the average and set the current value for a 'average-and-current-value' statistic.
      void addCounterLong​(long statisticId, long value)
      All Purpose Interface: Increment the counter of a declared 'cumulative-counter-long' statistic.
      void addEfficiencyRatioDelta​(long statisticId, long efficiencyDeltaValue, long inefficiencyDeltaValue)
      All Purpose Interface: Add efficiency ratio delta values to a 'efficiency-ratio-percent' statistic.
      void addError​(long statisticId, java.lang.String errorSubject, java.lang.String errorSeverity, java.lang.String errorType, java.lang.String errorLog, java.lang.String errorContext)
      All Purpose Interface: Add an error to the test result.
      void addSampleError​(long statisticId, java.lang.String errorSubject, java.lang.String errorSeverity, java.lang.String errorType, java.lang.String errorLog, java.lang.String errorContext)
      All Purpose Interface: Add an error to a declared statistic (for sample-event-time-chart statistics only, when measuring of a data sample did fail).
      void addSampleValue​(long statisticId, long value)
      All Purpose Interface: Add a measured long value to a statistic.
      void addTestResultAnnotationExecEvent​(int negativeEventId, java.lang.String eventText)
      All Purpose Interface: Add an annotation event to the test result.
      void addThroughputDelta​(long statisticId, double deltaValue)
      All Purpose Interface: Add a measured delta value to a throughput statistic.
      void appendLineToOutputFile​(java.lang.String fileName, java.lang.String line)
      Append a line to an output file.
      void declareAverageAndCurrentValueStatistic​(long statisticId, java.lang.String statisticTitle, java.lang.String unitText)
      All Purpose Interface: Declare a new 'average and current value' statistic.
      long declareAverageAndCurrentValueStatistic​(java.lang.String statisticTitle, java.lang.String unitText)
      All Purpose Interface: Declare a new 'average and current value' statistic.
      void declareCumulativeCounterLongStatistic​(long statisticId, java.lang.String statisticTitle, java.lang.String unitText)
      All Purpose Interface: Declare a new 'cumulative counter long' statistic.
      long declareCumulativeCounterLongStatistic​(java.lang.String statisticTitle, java.lang.String unitText)
      All Purpose Interface: Declare a new 'cumulative counter long' statistic.
      void declareEfficiencyRatioPercentStatistic​(long statisticId, java.lang.String statisticTitle, java.lang.String unitText)
      All Purpose Interface: Declare a new 'efficiency ratio percent' statistic.
      long declareEfficiencyRatioPercentStatistic​(java.lang.String statisticTitle, java.lang.String unitText)
      All Purpose Interface: Declare a new 'efficiency ratio percent' statistic.
      void declareSampleEventTimeChartStatistic​(long statisticId, java.lang.String statisticTitle, java.lang.String yAxisTitle, java.lang.String unitText)
      All Purpose Interface: Declare a new 'sample event time chart' statistic.
      void declareSampleEventTimeChartStatistic​(long statisticId, java.lang.String statisticTitle, java.lang.String yAxisTitle, java.lang.String unitText, boolean isPartOfMeasureSessionTime)
      All Purpose Interface: Declare a new 'sample event time chart' statistic.
      void declareSampleEventTimeChartStatistic​(long statisticId, java.lang.String statisticTitle, java.lang.String yAxisTitle, java.lang.String unitText, boolean addToSummaryStatistic, java.lang.String backgroundColor)
      All Purpose Interface: Declare a new 'sample event time chart' statistic.
      void declareSampleEventTimeChartStatistic​(long statisticId, java.lang.String statisticTitle, java.lang.String yAxisTitle, java.lang.String unitText, boolean addToSummaryStatistic, java.lang.String backgroundColor, boolean isPartOfMeasureSessionTime)
      All Purpose Interface: Declare a new 'sample event time chart' statistic.
      long declareSampleEventTimeChartStatistic​(java.lang.String statisticTitle, java.lang.String yAxisTitle, java.lang.String unitText)
      All Purpose Interface: Declare a new 'sample event time chart' statistic.
      long declareSampleEventTimeChartStatistic​(java.lang.String statisticTitle, java.lang.String yAxisTitle, java.lang.String unitText, boolean isPartOfMeasureSessionTime)
      All Purpose Interface: Declare a new 'sample event time chart' statistic.
      void declareStatistic​(long statisticId, java.lang.String statisticType, java.lang.String statisticTitle, java.lang.String statisticSubtitle, java.lang.String yAxisTitle, java.lang.String unitText, int sortPosition, boolean addToSummaryStatistic, java.lang.String backgroundColor)
      All Purpose Interface: Declare a new statistic (field isPartOfMeasureSessionTime = false).
      void declareStatistic​(long statisticId, java.lang.String statisticType, java.lang.String statisticTitle, java.lang.String statisticSubtitle, java.lang.String yAxisTitle, java.lang.String unitText, int sortPosition, boolean addToSummaryStatistic, java.lang.String backgroundColor, boolean isPartOfMeasureSessionTime)
      All Purpose Interface: Declare a new statistic.
      void declareThroughputTimeChartStatistic​(long statisticId, java.lang.String statisticTitle, java.lang.String yAxisTitle, java.lang.String unitText)
      All Purpose Interface: Declare a new 'throughput time chart' statistic.
      long declareThroughputTimeChartStatistic​(java.lang.String statisticTitle, java.lang.String yAxisTitle, java.lang.String unitText)
      All Purpose Interface: Declare a new 'throughput time chart' statistic.
      int getCurrentTestDuration()
      Get the current test duration in seconds.
      java.util.List<java.lang.String> getInputFileNamesList()
      Get a unsorted list of all input file names.
      java.lang.String[] getInputFileNextLineTokens​(java.lang.String fileName)
      Get the next line from an input file and split it into tokens - This method is thread safe.
      boolean isTestJobStopTriggered()
      All Purpose Interface: Get if the a stop of the test job is triggered.
      java.lang.String readFileFromTestDirectoryB64​(java.lang.String fileName)
      Read a file from the test sub directory of the test job and convert the file content to base64 format.
      java.lang.String readFileToStringFromTestDirectory​(java.lang.String fileName)
      Read a file to string from the test sub directory of the test job.
      void registerExecuteEnd()
      All Purpose Interface: Register that a simulated user has ended the test.
      void registerExecuteResume()
      All Purpose Interface: Register that a simulated user resume the execution of the test.
      void registerExecuteStart()
      All Purpose Interface: Register that a simulated user has started the test.
      void registerExecuteSuspend()
      All Purpose Interface: Register that a simulated user suspend the execution of the test.
      void registerLoopFailed()
      All Purpose Interface: Register that a session loop has failed.
      void registerLoopPassed​(long loopTime)
      All Purpose Interface: Register that a session loop has passed.
      long registerLoopStart()
      All Purpose Interface: Register the start of a session loop.
      void registerSampleStart​(long statisticId)
      All Purpose Interface: Register that the measuring of a long value sample has started
      void sharedUserMapClear()
      Clear the shared user map.
      java.lang.String sharedUserMapGet​(java.lang.String key)
      Get from the shared user map the value of a specific key.
      boolean sharedUserMapHas​(java.lang.String key)
      Get if the shared user map contains a specific key.
      JsonArray sharedUserMapKeys()
      Get a JSON array as string of all keys of the shared user map.
      void sharedUserMapRemove​(java.lang.String key)
      Remove a key with its value from the shared user map.
      void sharedUserMapSet​(java.lang.String key, java.lang.String value)
      Add or update an entry in the shared user map with a specified key and a value.
      void sleep​(long millis)
      Causes the currently executing thread to sleep for the specified number of milliseconds.
      void waitSuspendResumeTestJob()
      All Purpose Interface: Check if the test job is suspended and wait until the testjob is resumed, or if the max test duration is reached.
      void writeAndClearConsoleLog()
      Write the JavaScript console log of this simulated user to the JavaScriptRhinoTestJobExecutor main log, and clear the JavaScript console log.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • STATISTIC_TYPE_SAMPLE_EVENT_TIME_CHART

        public static final java.lang.String STATISTIC_TYPE_SAMPLE_EVENT_TIME_CHART
        A chart with samples of event timestamp and (measured) long value..
        See Also:
        Constant Field Values
      • STATISTIC_TYPE_THROUGHPUT_TIME_CHART

        public static final java.lang.String STATISTIC_TYPE_THROUGHPUT_TIME_CHART
        A chart of a throughput per second.
        See Also:
        Constant Field Values
      • STATISTIC_TYPE_CUMULATIVE_COUNTER_LONG

        public static final java.lang.String STATISTIC_TYPE_CUMULATIVE_COUNTER_LONG
        A cumulative long counter statistic.
        See Also:
        Constant Field Values
      • STATISTIC_TYPE_EFFICIENCY_RATIO_PERCENT

        public static final java.lang.String STATISTIC_TYPE_EFFICIENCY_RATIO_PERCENT
        An efficiency ratio percent value statistic.
        See Also:
        Constant Field Values
      • STATISTIC_TYPE_AVERAGE_AND_CURRENT_VALUE

        public static final java.lang.String STATISTIC_TYPE_AVERAGE_AND_CURRENT_VALUE
        An average and current value statistic.
        See Also:
        Constant Field Values
      • ERROR_SEVERITY_WARNING

        public static final java.lang.String ERROR_SEVERITY_WARNING
        Error severity 'warning': After the error has occurred then the simulated user continues with the execution of the current session loop. Error color = yellow.
        See Also:
        Constant Field Values
      • ERROR_SEVERITY_ERROR

        public static final java.lang.String ERROR_SEVERITY_ERROR
        Error severity 'error': After the error has occurred then the simulated aborts the execution of the current session loop and starts the execution of the next session loop. Error color = red.
        See Also:
        Constant Field Values
      • ERROR_SEVERITY_FATAL

        public static final java.lang.String ERROR_SEVERITY_FATAL
        Error severity 'fatal': After the error has occurred then the simulated user aborts any further execution of the test, which means that the test has ended for this simulated user. Error color = black.
        See Also:
        Constant Field Values
      • stopTestjobFile

        public final java.io.File stopTestjobFile
        All Purpose Interface: used to check if the testjob must be stopped.
      • suspendTestjobFile

        public final java.io.File suspendTestjobFile
        All Purpose Interface: used to check if the testjob must be suspended.
    • Constructor Detail

      • Lib

        public Lib​(com.dkfqs.measuringagent.javascript.JavaScriptRhinoTestJobExecutorContext testJobExecutorContext,
                   com.dkfqs.measuringagent.javascript.executor.RhinoExecutorThread rhinoExecutorThread,
                   com.dkfqs.measuringagent.javascript.executor.ExecutorConsoleLog executorConsoleLog,
                   int simulatedUserNumber)
            throws java.io.FileNotFoundException
        Create a new instance - per simulated user.
        Parameters:
        testJobExecutorContext - the test job executor context
        rhinoExecutorThread - the Rhino executor thread of this simulated user
        executorConsoleLog - the console log
        simulatedUserNumber - the simulated user number (1..n)
        Throws:
        java.io.FileNotFoundException - if the statistic output file of the simulated user cannot be created or opened
    • Method Detail

      • sleep

        public void sleep​(long millis)
                   throws JavaScriptRhinoTestException,
                          java.lang.InterruptedException
        Causes the currently executing thread to sleep for the specified number of milliseconds.
        Parameters:
        millis - the number of milliseconds
        Throws:
        JavaScriptRhinoTestException - if millis is > (3600L * 1000L * 2L) = 2 hours, or if millis is less than zero
        java.lang.InterruptedException - if the sleep was interrupted
      • sharedUserMapSet

        public void sharedUserMapSet​(java.lang.String key,
                                     java.lang.String value)
        Add or update an entry in the shared user map with a specified key and a value. This method is thread-save.
        Parameters:
        key - the key
        value - the value
      • sharedUserMapHas

        public boolean sharedUserMapHas​(java.lang.String key)
        Get if the shared user map contains a specific key. This method is thread-save.
        Parameters:
        key - the key
        Returns:
        true if the shared user map contains the specific key
      • sharedUserMapGet

        public java.lang.String sharedUserMapGet​(java.lang.String key)
        Get from the shared user map the value of a specific key. This method is thread-save.
        Parameters:
        key - the key
        Returns:
        the value of the specific key, or null if the key not exists in the map
      • sharedUserMapRemove

        public void sharedUserMapRemove​(java.lang.String key)
        Remove a key with its value from the shared user map. Nothing happens if the key not exists in the map. This method is thread-save.
        Parameters:
        key - the key
      • sharedUserMapClear

        public void sharedUserMapClear()
        Clear the shared user map. This method is thread-save.
      • sharedUserMapKeys

        public JsonArray sharedUserMapKeys()
        Get a JSON array as string of all keys of the shared user map. This method is thread-save.
        Returns:
        a JSON array as string of all keys of the shared user map
      • readFileToStringFromTestDirectory

        public java.lang.String readFileToStringFromTestDirectory​(java.lang.String fileName)
                                                           throws JavaScriptRhinoTestException
        Read a file to string from the test sub directory of the test job.
        Parameters:
        fileName - the file name
        Returns:
        the content of the whole file as string
        Throws:
        JavaScriptRhinoTestException - if reading the file fails
      • readFileFromTestDirectoryB64

        public java.lang.String readFileFromTestDirectoryB64​(java.lang.String fileName)
                                                      throws JavaScriptRhinoTestException
        Read a file from the test sub directory of the test job and convert the file content to base64 format.
        Parameters:
        fileName - the file name
        Returns:
        the content of the file in base64 format
        Throws:
        JavaScriptRhinoTestException - if reading the file fails
      • appendLineToOutputFile

        public void appendLineToOutputFile​(java.lang.String fileName,
                                           java.lang.String line)
                                    throws JavaScriptRhinoTestException
        Append a line to an output file. The file is created if it does not exist. This method is thread-safe.
        Parameters:
        fileName - the file name
        line - the line to write
        Throws:
        JavaScriptRhinoTestException - if writing the file fails
      • getInputFileNamesList

        public java.util.List<java.lang.String> getInputFileNamesList()
        Get a unsorted list of all input file names.
        Returns:
        a unsorted list of all input file names
      • getInputFileNextLineTokens

        public java.lang.String[] getInputFileNextLineTokens​(java.lang.String fileName)
                                                      throws JavaScriptRhinoTestException
        Get the next line from an input file and split it into tokens - This method is thread safe.
        Parameters:
        fileName - the file name of the input file
        Returns:
        the tokens of the line, or null if ('cyclic read' is disabled AND 'end of file' is reached)
        Throws:
        JavaScriptRhinoTestException - if the input file is undefined
      • getCurrentTestDuration

        public int getCurrentTestDuration()
        Get the current test duration in seconds.
        Returns:
        the current test duration in seconds, or -1 if the test was not started
      • isTestJobStopTriggered

        public boolean isTestJobStopTriggered()
        All Purpose Interface: Get if the a stop of the test job is triggered.
        Returns:
        true if the a stop of the test job is triggered
      • waitSuspendResumeTestJob

        public void waitSuspendResumeTestJob()
                                      throws java.lang.InterruptedException
        All Purpose Interface: Check if the test job is suspended and wait until the testjob is resumed, or if the max test duration is reached.
        Throws:
        java.lang.InterruptedException - if the current thread is interrupted
      • registerExecuteStart

        public void registerExecuteStart()
        All Purpose Interface: Register that a simulated user has started the test.
      • registerExecuteSuspend

        public void registerExecuteSuspend()
        All Purpose Interface: Register that a simulated user suspend the execution of the test.
      • registerExecuteResume

        public void registerExecuteResume()
        All Purpose Interface: Register that a simulated user resume the execution of the test.
      • registerExecuteEnd

        public void registerExecuteEnd()
        All Purpose Interface: Register that a simulated user has ended the test.
      • registerLoopStart

        public long registerLoopStart()
        All Purpose Interface: Register the start of a session loop.
        Returns:
        the unix time when the loop is started.
        See Also:
        registerLoopPassed(long), registerLoopFailed()
      • registerLoopPassed

        public void registerLoopPassed​(long loopTime)
        All Purpose Interface: Register that a session loop has passed.
        Parameters:
        loopTime - The time it takes to execute the loop in milliseconds
      • registerLoopFailed

        public void registerLoopFailed()
        All Purpose Interface: Register that a session loop has failed.
      • declareSampleEventTimeChartStatistic

        public long declareSampleEventTimeChartStatistic​(java.lang.String statisticTitle,
                                                         java.lang.String yAxisTitle,
                                                         java.lang.String unitText)
        All Purpose Interface: Declare a new 'sample event time chart' statistic.
        Parameters:
        statisticTitle - the title shown in the UI
        yAxisTitle - the Y-axis title of the diagram shown in the UI, or an empty string = not shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        Returns:
        a new statistic id
        See Also:
        STATISTIC_TYPE_SAMPLE_EVENT_TIME_CHART
      • declareSampleEventTimeChartStatistic

        public long declareSampleEventTimeChartStatistic​(java.lang.String statisticTitle,
                                                         java.lang.String yAxisTitle,
                                                         java.lang.String unitText,
                                                         boolean isPartOfMeasureSessionTime)
        All Purpose Interface: Declare a new 'sample event time chart' statistic.
        Parameters:
        statisticTitle - the title shown in the UI
        yAxisTitle - the Y-axis title of the diagram shown in the UI, or an empty string = not shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        isPartOfMeasureSessionTime - if true then the statistic is part of the measured session time
        Returns:
        a new statistic id
        Since:
        Measuring Agent V4.5.17 and Portal Server V4.8.66
        See Also:
        STATISTIC_TYPE_SAMPLE_EVENT_TIME_CHART
      • declareSampleEventTimeChartStatistic

        public void declareSampleEventTimeChartStatistic​(long statisticId,
                                                         java.lang.String statisticTitle,
                                                         java.lang.String yAxisTitle,
                                                         java.lang.String unitText)
        All Purpose Interface: Declare a new 'sample event time chart' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        statisticTitle - the title shown in the UI
        yAxisTitle - the Y-axis title of the diagram shown in the UI, or an empty string = not shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        See Also:
        STATISTIC_TYPE_SAMPLE_EVENT_TIME_CHART
      • declareSampleEventTimeChartStatistic

        public void declareSampleEventTimeChartStatistic​(long statisticId,
                                                         java.lang.String statisticTitle,
                                                         java.lang.String yAxisTitle,
                                                         java.lang.String unitText,
                                                         boolean isPartOfMeasureSessionTime)
        All Purpose Interface: Declare a new 'sample event time chart' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        statisticTitle - the title shown in the UI
        yAxisTitle - the Y-axis title of the diagram shown in the UI, or an empty string = not shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        isPartOfMeasureSessionTime - if true then the statistic is part of the measured session time
        Since:
        Measuring Agent V4.5.17 and Portal Server V4.8.66
        See Also:
        STATISTIC_TYPE_SAMPLE_EVENT_TIME_CHART
      • declareSampleEventTimeChartStatistic

        public void declareSampleEventTimeChartStatistic​(long statisticId,
                                                         java.lang.String statisticTitle,
                                                         java.lang.String yAxisTitle,
                                                         java.lang.String unitText,
                                                         boolean addToSummaryStatistic,
                                                         java.lang.String backgroundColor)
        All Purpose Interface: Declare a new 'sample event time chart' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        statisticTitle - the title shown in the UI
        yAxisTitle - the Y-axis title of the diagram shown in the UI, or an empty string = not shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        addToSummaryStatistic - if true = add the number of passed/failed/pending samples to the summary statistic
        backgroundColor - the background color either as #hex-triplet or as bootstrap class, or an empty string = no special background color
        See Also:
        STATISTIC_TYPE_SAMPLE_EVENT_TIME_CHART
      • declareSampleEventTimeChartStatistic

        public void declareSampleEventTimeChartStatistic​(long statisticId,
                                                         java.lang.String statisticTitle,
                                                         java.lang.String yAxisTitle,
                                                         java.lang.String unitText,
                                                         boolean addToSummaryStatistic,
                                                         java.lang.String backgroundColor,
                                                         boolean isPartOfMeasureSessionTime)
        All Purpose Interface: Declare a new 'sample event time chart' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        statisticTitle - the title shown in the UI
        yAxisTitle - the Y-axis title of the diagram shown in the UI, or an empty string = not shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        addToSummaryStatistic - if true = add the number of passed/failed/pending samples to the summary statistic
        backgroundColor - the background color either as #hex-triplet or as bootstrap class, or an empty string = no special background color
        isPartOfMeasureSessionTime - if true then the statistic is part of the measured session time
        Since:
        Measuring Agent V4.5.17 and Portal Server V4.8.66
        See Also:
        STATISTIC_TYPE_SAMPLE_EVENT_TIME_CHART
      • declareCumulativeCounterLongStatistic

        public long declareCumulativeCounterLongStatistic​(java.lang.String statisticTitle,
                                                          java.lang.String unitText)
        All Purpose Interface: Declare a new 'cumulative counter long' statistic.
        Parameters:
        statisticTitle - the title shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        Returns:
        an new statistic id
        See Also:
        STATISTIC_TYPE_CUMULATIVE_COUNTER_LONG
      • declareCumulativeCounterLongStatistic

        public void declareCumulativeCounterLongStatistic​(long statisticId,
                                                          java.lang.String statisticTitle,
                                                          java.lang.String unitText)
        All Purpose Interface: Declare a new 'cumulative counter long' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        statisticTitle - the title shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        See Also:
        STATISTIC_TYPE_CUMULATIVE_COUNTER_LONG
      • declareThroughputTimeChartStatistic

        public long declareThroughputTimeChartStatistic​(java.lang.String statisticTitle,
                                                        java.lang.String yAxisTitle,
                                                        java.lang.String unitText)
        All Purpose Interface: Declare a new 'throughput time chart' statistic.
        Parameters:
        statisticTitle - the title shown in the UI
        yAxisTitle - the Y-axis title of the diagram shown in the UI, or an empty string = not shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        Returns:
        an new statistic id
        See Also:
        STATISTIC_TYPE_THROUGHPUT_TIME_CHART
      • declareThroughputTimeChartStatistic

        public void declareThroughputTimeChartStatistic​(long statisticId,
                                                        java.lang.String statisticTitle,
                                                        java.lang.String yAxisTitle,
                                                        java.lang.String unitText)
        All Purpose Interface: Declare a new 'throughput time chart' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        statisticTitle - the title shown in the UI
        yAxisTitle - the Y-axis title of the diagram shown in the UI, or an empty string = not shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        See Also:
        STATISTIC_TYPE_THROUGHPUT_TIME_CHART
      • declareAverageAndCurrentValueStatistic

        public long declareAverageAndCurrentValueStatistic​(java.lang.String statisticTitle,
                                                           java.lang.String unitText)
        All Purpose Interface: Declare a new 'average and current value' statistic.
        Parameters:
        statisticTitle - the title shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        Returns:
        an new statistic id
        See Also:
        STATISTIC_TYPE_AVERAGE_AND_CURRENT_VALUE
      • declareAverageAndCurrentValueStatistic

        public void declareAverageAndCurrentValueStatistic​(long statisticId,
                                                           java.lang.String statisticTitle,
                                                           java.lang.String unitText)
        All Purpose Interface: Declare a new 'average and current value' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        statisticTitle - the title shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        See Also:
        STATISTIC_TYPE_AVERAGE_AND_CURRENT_VALUE
      • declareEfficiencyRatioPercentStatistic

        public long declareEfficiencyRatioPercentStatistic​(java.lang.String statisticTitle,
                                                           java.lang.String unitText)
        All Purpose Interface: Declare a new 'efficiency ratio percent' statistic.
        Parameters:
        statisticTitle - the title shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        Returns:
        an new statistic id
        See Also:
        STATISTIC_TYPE_EFFICIENCY_RATIO_PERCENT
      • declareEfficiencyRatioPercentStatistic

        public void declareEfficiencyRatioPercentStatistic​(long statisticId,
                                                           java.lang.String statisticTitle,
                                                           java.lang.String unitText)
        All Purpose Interface: Declare a new 'efficiency ratio percent' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        statisticTitle - the title shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        See Also:
        STATISTIC_TYPE_EFFICIENCY_RATIO_PERCENT
      • declareStatistic

        public void declareStatistic​(long statisticId,
                                     java.lang.String statisticType,
                                     java.lang.String statisticTitle,
                                     java.lang.String statisticSubtitle,
                                     java.lang.String yAxisTitle,
                                     java.lang.String unitText,
                                     int sortPosition,
                                     boolean addToSummaryStatistic,
                                     java.lang.String backgroundColor)
        All Purpose Interface: Declare a new statistic (field isPartOfMeasureSessionTime = false).
        Parameters:
        statisticId - the unique ID of the statistic
        statisticType - the type of the statistic
        statisticTitle - the title shown in the UI
        statisticSubtitle - the subtitle shown in the UI, or an empty string = not shown in the UI
        yAxisTitle - the Y-axis title of the diagram shown in the UI, or an empty string = not shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        sortPosition - the UI sort position (sorting order: from small to large positions)
        addToSummaryStatistic - if true = add the number of passed/failed/pending samples to the summary statistic
        backgroundColor - the background color either as #hex-triplet or as bootstrap class, or an empty string = no special background color
        See Also:
        STATISTIC_TYPE_SAMPLE_EVENT_TIME_CHART, STATISTIC_TYPE_THROUGHPUT_TIME_CHART, STATISTIC_TYPE_CUMULATIVE_COUNTER_LONG, STATISTIC_TYPE_EFFICIENCY_RATIO_PERCENT, STATISTIC_TYPE_AVERAGE_AND_CURRENT_VALUE
      • declareStatistic

        public void declareStatistic​(long statisticId,
                                     java.lang.String statisticType,
                                     java.lang.String statisticTitle,
                                     java.lang.String statisticSubtitle,
                                     java.lang.String yAxisTitle,
                                     java.lang.String unitText,
                                     int sortPosition,
                                     boolean addToSummaryStatistic,
                                     java.lang.String backgroundColor,
                                     boolean isPartOfMeasureSessionTime)
        All Purpose Interface: Declare a new statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        statisticType - the type of the statistic
        statisticTitle - the title shown in the UI
        statisticSubtitle - the subtitle shown in the UI, or an empty string = not shown in the UI
        yAxisTitle - the Y-axis title of the diagram shown in the UI, or an empty string = not shown in the UI
        unitText - the text for the measured unit shown in the UI, or an empty string = not shown in the UI
        sortPosition - the UI sort position (sorting order: from small to large positions)
        addToSummaryStatistic - if true = add the number of passed/failed/pending samples to the summary statistic
        backgroundColor - the background color either as #hex-triplet or as bootstrap class, or an empty string = no special background color
        isPartOfMeasureSessionTime - if true then the statistic is part of the measured session time
        Since:
        Measuring Agent V4.5.17 and Portal Server V4.8.66
        See Also:
        STATISTIC_TYPE_SAMPLE_EVENT_TIME_CHART, STATISTIC_TYPE_THROUGHPUT_TIME_CHART, STATISTIC_TYPE_CUMULATIVE_COUNTER_LONG, STATISTIC_TYPE_EFFICIENCY_RATIO_PERCENT, STATISTIC_TYPE_AVERAGE_AND_CURRENT_VALUE
      • addSampleError

        public void addSampleError​(long statisticId,
                                   java.lang.String errorSubject,
                                   java.lang.String errorSeverity,
                                   java.lang.String errorType,
                                   java.lang.String errorLog,
                                   java.lang.String errorContext)
        All Purpose Interface: Add an error to a declared statistic (for sample-event-time-chart statistics only, when measuring of a data sample did fail).
        Parameters:
        statisticId - the unique ID of the statistic
        errorSubject - the subject of the error. Note that multiple errors which contains the same subject can be grouped.
        errorSeverity - the error severity: 'warning' or 'error' or 'fatal'
        errorType - the (optional) type of the error which reflects why the error did occur. Note that multiple errors which contains the same error type can be grouped.
        errorLog - the (optional) error log
        errorContext - the (optional) error context that describes the circumstances under which the error occurred. It's recommended to pass a JSON object as string.
        See Also:
        ERROR_SEVERITY_WARNING, ERROR_SEVERITY_ERROR, ERROR_SEVERITY_FATAL, registerSampleStart(long), STATISTIC_TYPE_SAMPLE_EVENT_TIME_CHART
      • addCounterLong

        public void addCounterLong​(long statisticId,
                                   long value)
        All Purpose Interface: Increment the counter of a declared 'cumulative-counter-long' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        value - the value by which the counter is incremented
        See Also:
        STATISTIC_TYPE_CUMULATIVE_COUNTER_LONG
      • addThroughputDelta

        public void addThroughputDelta​(long statisticId,
                                       double deltaValue)
        All Purpose Interface: Add a measured delta value to a throughput statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        deltaValue - the measured delta value
        See Also:
        STATISTIC_TYPE_THROUGHPUT_TIME_CHART
      • addEfficiencyRatioDelta

        public void addEfficiencyRatioDelta​(long statisticId,
                                            long efficiencyDeltaValue,
                                            long inefficiencyDeltaValue)
        All Purpose Interface: Add efficiency ratio delta values to a 'efficiency-ratio-percent' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        efficiencyDeltaValue - the efficiency delta value to add
        inefficiencyDeltaValue - the inefficiency delta value to add
        See Also:
        STATISTIC_TYPE_EFFICIENCY_RATIO_PERCENT
      • addAverageDeltaAndCurrentValue

        public void addAverageDeltaAndCurrentValue​(long statisticId,
                                                   long currentValue)
        All Purpose Interface: Add one delta value to the average and set the current value for a 'average-and-current-value' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        currentValue - the current value, or -1 if no such data is available
        See Also:
        STATISTIC_TYPE_AVERAGE_AND_CURRENT_VALUE
      • addAverageDeltaAndCurrentValue

        public void addAverageDeltaAndCurrentValue​(long statisticId,
                                                   long sumValuesDelta,
                                                   long numValuesDelta,
                                                   long currentValue)
        All Purpose Interface: Add delta values to the average and set the current value for a 'average-and-current-value' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        sumValuesDelta - the sum of delta values to add to the average
        numValuesDelta - the number of delta values to add to the average
        currentValue - the current value, or -1 if no such data is available
        See Also:
        STATISTIC_TYPE_AVERAGE_AND_CURRENT_VALUE
      • addAverageDeltaAndCurrentValue

        public void addAverageDeltaAndCurrentValue​(long statisticId,
                                                   long sumValuesDelta,
                                                   long numValuesDelta,
                                                   long currentValue,
                                                   long currentValueTimestamp)
        All Purpose Interface: Add delta values to the average and set the current value for a 'average-and-current-value' statistic.
        Parameters:
        statisticId - the unique ID of the statistic
        sumValuesDelta - the sum of delta values to add to the average
        numValuesDelta - the number of delta values to add to the average
        currentValue - the current value, or -1 if no such data is available
        currentValueTimestamp - the Unix-like timestamp of the current value, or -1 if no such data is available
        See Also:
        STATISTIC_TYPE_AVERAGE_AND_CURRENT_VALUE
      • addError

        public void addError​(long statisticId,
                             java.lang.String errorSubject,
                             java.lang.String errorSeverity,
                             java.lang.String errorType,
                             java.lang.String errorLog,
                             java.lang.String errorContext)
        All Purpose Interface: Add an error to the test result. Note: do not call this method for sample-event-time-chart statistics, call instead in such a case addSampleError.
        Parameters:
        statisticId - the unique ID of the statistic, or -1 if this error is not bound to any statistic
        errorSubject - the subject of the error. Note that multiple errors which contains the same subject can be grouped.
        errorSeverity - the error severity: 'warning' or 'error' or 'fatal'
        errorType - the (optional) type of the error which reflects why the error did occur. Note that multiple errors which contains the same error type can be grouped.
        errorLog - the (optional) error log
        errorContext - the (optional) error context that describes the circumstances under which the error occurred. It's recommended to pass a JSON object as string.
        See Also:
        ERROR_SEVERITY_WARNING, ERROR_SEVERITY_ERROR, ERROR_SEVERITY_FATAL, addSampleError(long, String, String, String, String, String)
      • addTestResultAnnotationExecEvent

        public void addTestResultAnnotationExecEvent​(int negativeEventId,
                                                     java.lang.String eventText)
                                              throws JavaScriptRhinoTestException
        All Purpose Interface: Add an annotation event to the test result.
        Parameters:
        negativeEventId - the (negative) event id, valid range: -1 .. -999999
        eventText - the event text
        Throws:
        JavaScriptRhinoTestException - if the (negative) event id is out of range
      • writeAndClearConsoleLog

        public void writeAndClearConsoleLog()
        Write the JavaScript console log of this simulated user to the JavaScriptRhinoTestJobExecutor main log, and clear the JavaScript console log.
        See Also:
        JavaScriptRhinoTestJobExecutor