Environment Override
Test RealTime - User Guide
Environment Override
To provide more flexibility in using environments, you can override the initialization
and test specifications in an ENVIRONMENT block for one or more variables, one or
more array elements, or one or more fields of a structured variable by using either of
the following:
·
A new environment
·
The instructions VAR, ARRAY, or STR in the ELEMENT block
The ENVIRONMENT concept greatly improves test robustness. You can use this
approach to group default initialization and test specifications with all the variables
that are global to a module under test, allowing you to check that unexpected global
variables in tests on a service are indeed not modified.
The following steps are used to handle environments:
·
VAR, ARRAY and STR instructions are stored between ENVIRONMENT and
END ENVIRONMENT instructions.
·
When the Test Compiler comes across the instruction USE, it determines the
scope of the environment that has been stored.
·
At every END ELEMENT instruction, the Test Compiler browses through all
visible environments beginning with the most recently declared one. The test
compiler then checks every environment variable to see if it has been fully or
partially tested. If it has only been partially tested, the test compiler generates
the necessary tests to complete the testing of the variable.
This process means that:
·
Tests linked to environments are always carried out last.
·
The higher the environment's precedence, the earlier the tests it contains will be
carried out.
Example
The following example illustrates an override of an array element in two tests:
TEST 1
FAMILY nominal
ELEMENT
VAR histo[0], init = 0, ev = SIZE_IMAGE*SIZE_IMAGE
#status = compute_histo(x1,y1,x2,y2,histo);
END ELEMENT
END TEST
TEST 2
FAMILY nominal
ELEMENT
ARRAY image, init = {others => {others => 100}}, ev = init
ARRAY histo[100], init = 0, ev = SIZE_IMAGE*SIZE_IMAGE
#status = compute_histo(x1,y1,x2,y2,histo);
END ELEMENT
154