Apache JMeter
2.0.1.20050615

org.apache.jmeter.assertions
Class DurationAssertion

java.lang.Object
  extended byorg.apache.jmeter.testelement.AbstractTestElement
      extended byorg.apache.jmeter.assertions.DurationAssertion
All Implemented Interfaces:
Assertion, Cloneable, Serializable, TestElement

public class DurationAssertion
extends AbstractTestElement
implements Serializable, Assertion

Checks if an Sample is sampled within a specified time-frame. If the duration is larger than the timeframe the Assertion is considered a failure.

Version:
$Revision: 1.5 $, $Date: 2004/02/13 01:27:26 $
Author:
Wolfram Rittmeyer
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
DurationAssertion()
           
 
Method Summary
 long getAllowedDuration()
          Returns the duration to be asserted.
 AssertionResult getResult(SampleResult response)
          Returns the result of the Assertion.
 void setAllowedDuration(long duration)
          Set the duration that shall be asserted.
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addProperty, addTestElement, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getThreadContext, getThreadName, isRunningVersion, isTemporary, logProperties, mergeIn, nextIsNull, propertyIterator, recoverRunningVersion, removeProperty, setName, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, threadFinished, threadStarted, traverse, traverseCollection, traverseMap, traverseProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DurationAssertion

public DurationAssertion()
Method Detail

getResult

public AssertionResult getResult(SampleResult response)
Returns the result of the Assertion. Here it checks wether the Sample took to long to be considered successful. If so an AssertionResult containing a FailureMessage will be returned. Otherwise the returned AssertionResult will reflect the success of the Sample.

Specified by:
getResult in interface Assertion
Parameters:
response - the SampleResult containing information about the Sample (duration, success, etc)
Returns:
the AssertionResult containing the information about whether the assertion passed or failed.

getAllowedDuration

public long getAllowedDuration()
Returns the duration to be asserted. A duration of 0 indicates this assertion is to be ignored.


setAllowedDuration

public void setAllowedDuration(long duration)
                        throws IllegalArgumentException
Set the duration that shall be asserted.

Parameters:
duration - a period of time in milliseconds. Is not allowed to be negative. Use Double.MAX_VALUE to indicate illegal or empty inputs. This will result to not checking the assertion.
Throws:
IllegalArgumentException - if duration is negative.

Apache JMeter
2.0.1.20050615

Copyright © 1998-2005 Apache Software Foundation. All Rights Reserved.