CL_ABAP_UNIT_ASSERT - ABAP Unit: Assertions (see Longtext)

General Data in Customer Master   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.

Functionality

The class CL_ABAP_UNIT_ASSERT contains the following static methods for the verification of test expectations within ABAP Unit test methods:

  • ASSERT_EQUALS
    Ensure the equality of two data objects. Please note that the arguments are passed by reference. Regarding the comparison of references to object instances please refer to interface IF_AUNIT_OBJECT.
  • ASSERT_EQUALS_FLOAT
    Ensure the equality of two decimal floats with a relative tolerance.
  • ASSERT_DIFFERS
    Ensure the value of two data objects not to be equal.
  • ASSERT_BOUND
    Ensure whether the reference of a reference variable is valid.
  • ASSERT_NOT_BOUND
    Ensure whether the reference of a reference variable is invalid.
  • ASSERT_INITIAL
    Ensure that a data object has its initial value.
  • ASSERT_NOT_INITIAL
    Ensure that a data object does not have its initial value.
  • ASSERT_SUBRC
    Requests specific value of SY-SUBRC.
  • ASSERT_TABLE_CONTAINS
    Ensure that a internal table contains a certain line.
  • ASSERT_TEXT_MATCHES
    Ensure that a text matches to a regular expression.
  • ASSERT_THAT
    Ensure that the actual value adheres to a given Constraint
  • FAIL
    Terminate the test with an unconditional error.
  • ABORT
    Cancel the test due to a missing prerequisite.

All the methods have the optional importing parameters MSG, LEVEL, and QUIT, which always have the same meaning:

  • MSG (Type: CSEQUENCE)
    Contains a more detailed description of the error (if applicable)
  • LEVEL (Type: AUNIT_LEVEL)
    Indicates the severity of the error; the following values are possible:
  • TOLERABLE - Minor error (may be tolerable)

  • CRITICAL - Critical error (default value)

  • FATAL - Fatal error

  • QUIT (Type: AUNIT_FLOWCTRL)
    Determines the flow control in the case of an error. The following values can be passed:
  • NO - No termination in the case of an error; processing of the current method continues after the relevant method is called

  • METHOD - The currently processed test method is terminated (default value)

  • CLASS - The currently processed test class is terminated

  • PROGRAM - The test of the currently processed main program is terminated: The current test class is terminated and all other test classes in the program are ignored.

All the assert methods have the following mandatory importing parameter:

  • ACT (Type: Any)
    The object to be verified

The comparing method ASSERT_EQUALS additionally requires a parameter for the expectation:

  • EXP (Type: Any)
    The identically expected object
  • TOL (Type: f)
    Allows you to compare floating point numbers for the passed tolerance

Further information

Knowledge Warehouse


rdisp/max_wprun_time - Maximum work process run time   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.


Length: 4384 Date: 20120526 Time: 083435     triton ( 85 ms )