Products Downloads


French version


 


VADELIA





(B) (C)





Caution: this order is used only in the context of a Java client generated VADELIA Batch unit test program.


User paragraph

Public test procedure


Syntax

ASSERT   ExpectedValue  TestedValue Message

or

ASSERT *FAILURE Message


ExpectedValue: Constant | IdVar | IdArray | ReservedWord

TestedValue: Constant | IdVar | IdArray | ReservedWord

Message: Alphanumeric constant | Alphanumeric IdVar | nothing


Description

This order is used in a unit test program and verifies that the TestedValue is equal to the ExpectedValue.

If this is not the case, the test will fail. Execution of the test procedure will be stopped and an error message will be displayed in the test report. If a Message (optional parameter) is specified, its text will be included in the report error message.


ExpectedValue and TestedValue must have the same definition (same type and length) and if they are arrays, they must be of the same size.

if the ExpectedValue is a constant, its type must be compatible with the type of the TestedValue variable.

The variables or arrays used must be a simple Adelia type (ALPHA, NUM_BIN_2, NUM_BIN_4, NUM_BIN_8, NUM_E, NUM_P, DATE, TIME, TIMESTAMP), except for the IMAGE type which is not allowed.

The following reserved words are allowed in ExpectedValue: *INVALID_OP, *NOT_FOUND, *NORMAL, *BLANK *HIVAL *LOVAL *NULL, *TRUE, *FALSE. As long as ExpectedValue matches one of these reserved words, an array is not allowed in TestedValue.

The following reserved words are allowed in TestedValue: *RETURN_CODE, *LOCKED, *SQLCODE, *SQLSTATE, *FOUND, *SQLROWCOUNT.


The execution of the order with the *FAILURE parameter systematically fails the test, stops execution of the procedure, and will display an error message in the test report.

If a Message (optional parameter) is specified, its text will be included in the report error message.


For example

RES = 128

ASSERT 128 RES 'number 1'

       --> The test was successful

RES_ALPHA = 'test failed'

ASSERT 'my test' RES_ALPHA 'test number 2'

       --> The test will fail

IF MyVariable < 100

       WMESSAGE = 'the value '// &ALPHA_NUM(MyVariable) /// 'is too small'_    

       ASSERT *FAILURE WMESSAGE

END


ASSERTION  *NORMAL *SQLCODE 'The SQL query failed'


ASSERTION  *HIVAL RES


ASSERTION  0 *RETURN_CODE 'The operation ended in failure.'



↑ Top of page

  • Aucune étiquette