Class SizeAssertion

All Implemented Interfaces:
Serializable, Cloneable, Assertion, Searchable, org.apache.jmeter.testelement.TestElement

public class SizeAssertion extends AbstractScopedAssertion implements Serializable, Assertion
Checks if the results of a Sample matches a particular size.
See Also:
  • Field Details

  • Constructor Details

    • SizeAssertion

      public SizeAssertion()
  • Method Details

    • 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
      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.
    • getAllowedSize

      public String getAllowedSize()
      Returns the size in bytes to be asserted.
      Returns:
      The allowed size
    • setCompOper

      public void setCompOper(int operator)
      Set the operator used for the assertion. Has to be one of
      EQUAL
      1
      NOTEQUAL
      2
      GREATERTHAN
      3
      LESSTHAN
      4
      GREATERTHANEQUAL
      5
      LESSTHANEQUAL
      6
      Parameters:
      operator - The operator to be used in the assertion
    • getCompOper

      public int getCompOper()
      Returns the operator to be asserted.
      EQUAL
      1
      NOTEQUAL
      2
      GREATERTHAN
      3
      LESSTHAN
      4
      GREATERTHANEQUAL
      5
      LESSTHANEQUAL
      6
      Returns:
      The operator used for the assertion
    • setAllowedSize

      public void setAllowedSize(String size)
      Set the size that shall be asserted.
      Parameters:
      size - a number of bytes.
    • setAllowedSize

      public void setAllowedSize(long size)
      Set the size that should be used in the assertion
      Parameters:
      size - The number of bytes
    • setTestFieldNetworkSize

      public void setTestFieldNetworkSize()
    • setTestFieldResponseHeaders

      public void setTestFieldResponseHeaders()
    • setTestFieldResponseBody

      public void setTestFieldResponseBody()
    • setTestFieldResponseCode

      public void setTestFieldResponseCode()
    • setTestFieldResponseMessage

      public void setTestFieldResponseMessage()
    • getTestField

      public String getTestField()
    • isTestFieldNetworkSize

      public boolean isTestFieldNetworkSize()
    • isTestFieldResponseHeaders

      public boolean isTestFieldResponseHeaders()
    • isTestFieldResponseBody

      public boolean isTestFieldResponseBody()
    • isTestFieldResponseCode

      public boolean isTestFieldResponseCode()
    • isTestFieldResponseMessage

      public boolean isTestFieldResponseMessage()