Published on :
Macro CREATION_INTERNE

Expected Error Assertion (FUTS Framework)

This code is also available in: Deutsch Español Français
This macro checks the state of a global variable `FUTS_EXPECTED_ERROR`. It is generally called after a code sequence supposed to cause an error. If the global variable is not empty (meaning an error was expected but does not seem to have been caught or handled), the macro triggers an event (via `%generate_event`) to report the test failure with the message 'Did not get expected error'. It also increments the global test counter.
Data Analysis

Type : CREATION_INTERNE


Use of global macro variables (&FUTS_EXPECTED_ERROR, &futs_tst_cnt) to manage test status and counting.

1 Code Block
MACRO DEFINITION
Explanation :
Macro definition. It increments the test counter, checks if an error was expected via the global variable, and if so (test failure condition), calls the `%generate_event` macro to report the anomaly.
Copied!
1%macro assert_error_occurred(
2 MESSAGE=Did not get expected error &FUTS_EXPECTED_ERROR,
3 TYPE=,
4 LEVEL=,
5 ATTACHDATA=,
6 ATTACHFILE=,
7 METRIC=,
8 PROPERTIES=,
9 ON_EVENT=,
10 DESCRIPTION=, ABORT= );
11 
12%global FUTS_EXPECTED_ERROR;
13 
14%let futs_tst_cnt = %eval(&futs_tst_cnt.+1);
15 
16%IF &FUTS_EXPECTED_ERROR ne %str() %THEN
17 %generate_event(TYPE=&TYPE, LEVEL=&LEVEL,
18 MESSAGE=&MESSAGE,
19 ATTACHDATA=&ATTACHDATA, ATTACHFILE=&ATTACHFILE,
20 METRIC=&METRIC,
21 PROPERTIES=&PROPERTIES,
22 ON_EVENT=&ON_EVENT,
23 DESCRIPTION=&DESCRIPTION, ABORT=&ABORT);
24 
25%mend assert_error_occurred;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright (c) 2015 John Jacobs. All rights reserved.