net.grinder.script
Interface Statistics.StatisticsForTest

Enclosing interface:
Statistics

public static interface Statistics.StatisticsForTest

Query and update methods for the statistics relating to a particular call of a test.

See Also:
Statistics.getForLastTest(), Statistics.getForCurrentTest()

Method Summary
 void addDouble(java.lang.String statisticName, double value)
          Add value to the double statistic statisticName.
 void addLong(java.lang.String statisticName, long value)
          Add value to the long statistic statisticName.
 double getDouble(java.lang.String statisticName)
          Return the value of the double statistic statisticName.
 long getLong(java.lang.String statisticName)
          Return the value of long statistic statisticName.
 boolean getSuccess()
          Convenience method that returns whether the test was a success (errors is zero) or not.
 Test getTest()
          Return the Test that the statistics are for.
 long getTime()
          Returns the elapsed time for the test.
 void setDouble(java.lang.String statisticName, double value)
          Sets the double statistic statisticName to the specified value.
 void setLong(java.lang.String statisticName, long value)
          Sets the long statistic statisticName to the specified value.
 void setSuccess(boolean success)
          Convenience method that sets whether the last test should be considered a success or not.
 

Method Detail

getTest

Test getTest()
Return the Test that the statistics are for.

Returns:
The test.

setLong

void setLong(java.lang.String statisticName,
             long value)
             throws InvalidContextException,
                    NoSuchStatisticException
Sets the long statistic statisticName to the specified value.

Parameters:
statisticName - The statistic name. See Statistics for a list of valid names.
value - The value.
Throws:
InvalidContextException - If called when the statistics have already been sent for the last test performed by this thread - see Statistics.setDelayReports(boolean).
NoSuchStatisticException - If statisticName does not refer to a known basic long statistic.

setDouble

void setDouble(java.lang.String statisticName,
               double value)
               throws InvalidContextException,
                      NoSuchStatisticException
Sets the double statistic statisticName to the specified value.

Parameters:
statisticName - The statistic name. See Statistics for a list of valid names.
value - The value.
Throws:
InvalidContextException - If called when the statistics have already been sent for the last test performed by this thread - see Statistics.setDelayReports(boolean).
NoSuchStatisticException - If statisticName does not refer to a known basic double statistic.

addLong

void addLong(java.lang.String statisticName,
             long value)
             throws InvalidContextException,
                    NoSuchStatisticException
Add value to the long statistic statisticName.

Parameters:
statisticName - The statistic name. See Statistics for a list of valid names.
value - The value.
Throws:
InvalidContextException - If called when the statistics have already been sent for the last test performed by this thread - see Statistics.setDelayReports(boolean).
NoSuchStatisticException - If statisticName does not refer to a known basic long statistic.

addDouble

void addDouble(java.lang.String statisticName,
               double value)
               throws InvalidContextException,
                      NoSuchStatisticException
Add value to the double statistic statisticName.

Parameters:
statisticName - The statistic name. See Statistics for a list of valid names.
value - The value.
Throws:
InvalidContextException - If called when the statistics have already been sent for the last test performed by this thread - see Statistics.setDelayReports(boolean).
NoSuchStatisticException - If statisticName does not refer to a known basic double statistic.

getLong

long getLong(java.lang.String statisticName)
             throws NoSuchStatisticException
Return the value of long statistic statisticName.

Parameters:
statisticName - The statistic name. See Statistics for a list of valid names.
Returns:
The value.
Throws:
NoSuchStatisticException - If statisticName does not refer to a known basic long statistic.

getDouble

double getDouble(java.lang.String statisticName)
                 throws NoSuchStatisticException
Return the value of the double statistic statisticName.

Parameters:
statisticName - The statistic name. See Statistics for a list of valid names.
Returns:
The value.
Throws:
NoSuchStatisticException - If statisticName does not refer to a known basic double statistic.

setSuccess

void setSuccess(boolean success)
                throws InvalidContextException
Convenience method that sets whether the last test should be considered a success or not.

Parameters:
success - If true errors is set to 0, otherwise errors is set to 1.
Throws:
InvalidContextException - If called when the statistics have already been sent for the last test performed by this thread - see Statistics.setDelayReports(boolean).

getSuccess

boolean getSuccess()
Convenience method that returns whether the test was a success (errors is zero) or not.

Returns:
Whether the test was a success.

getTime

long getTime()
Returns the elapsed time for the test.

If this StatisticsForTest was obtained with Statistics.getForCurrentTest(), the result will be the elapsed time since the test in progress was started. If it was obtained with Statistics.getForLastTest(), the result will be the time taken by the last test.

getTime() always returns the time taken by the test, even if the test was an error and the time will not be added to timedTests.

Returns:
The elapsed time for the test.