org.apache.jmeter.assertions

Class SizeAssertion

Implemented Interfaces:
Serializable, Assertion, Cloneable, Serializable, TestElement

public class SizeAssertion
extends AbstractScopedAssertion
implements Serializable, Assertion

Checks if the results of a Sample matches a particular size.

Field Summary

static int
EQUAL
static int
GREATERTHAN
static int
GREATERTHANEQUAL
static int
LESSTHAN
static int
LESSTHANEQUAL
static int
NOTEQUAL

Fields inherited from interface org.apache.jmeter.testelement.TestElement

COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS

Method Summary

long
getAllowedSize()
Returns the size in bytes to be asserted.
int
getCompOper()
Returns the operator to be asserted.
AssertionResult
getResult(SampleResult response)
Returns the result of the Assertion.
void
setAllowedSize(long size)
Set the size that shall be asserted.
void
setCompOper(int operator)
set the Operator

Methods inherited from class org.apache.jmeter.testelement.AbstractScopedAssertion

fetchScope, isScopeAll, isScopeChildren, isScopeParent, setScopeAll, setScopeChildren, setScopeParent

Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

addProperty, addTestElement, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty

Field Details

EQUAL

public static final int EQUAL
Field Value:
1

GREATERTHAN

public static final int GREATERTHAN
Field Value:
3

GREATERTHANEQUAL

public static final int GREATERTHANEQUAL
Field Value:
5

LESSTHAN

public static final int LESSTHAN
Field Value:
4

LESSTHANEQUAL

public static final int LESSTHANEQUAL
Field Value:
6

NOTEQUAL

public static final int NOTEQUAL
Field Value:
2

Method Details

getAllowedSize

public long getAllowedSize()
Returns the size in bytes to be asserted.

getCompOper

public int getCompOper()
Returns the operator to be asserted. EQUAL = 1, NOTEQUAL = 2 GREATERTHAN = 3,LESSTHAN = 4,GREATERTHANEQUAL = 5,LESSTHANEQUAL = 6

getResult

public AssertionResult getResult(SampleResult response)
Returns the result of the Assertion. Here it checks the Sample responseData length.
Specified by:
getResult in interface Assertion

setAllowedSize

public void setAllowedSize(long size)
            throws IllegalArgumentException
Set the size that shall be asserted.
Parameters:
size - - a number of bytes. Is not allowed to be negative. Use Long.MAX_VALUE to indicate illegal or empty inputs. This will result in not checking the assertion.

setCompOper

public void setCompOper(int operator)
set the Operator

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