C Syntax Extensions
Automated Testing
·
Service and Family parameters: These are not imported and require manual
updating with the Tester Configuration function.
C Syntax Extensions
For a large number of calls to a stub, use the following syntax for a more compact
description:
<call i> .. <call j> =>
You can describe each call to a stub by adding the specific cases before the preceding
instruction, for example:
<call i> =>
or
<call i> .. <call j> =>
The call count starts at 1 as the following example shows:
TEST 2
FAMILY nominal
COMMENT Reading of 100 identical lines
ELEMENT
VAR file1, init = "file1", ev = init
VAR file2, init = "file2", ev = init
VAR s, init == , ev = 1
STUB open_file 1=>("file1")3
STUB create_file 1=>("file2")4
STUB read_file 1..100(3,"line")1, 101=>(3,"")0
STUB write_file 1..100=>(4,"line")1
STUB close_file 1=>(3)1,2=>(4)1
#s = copy_file(file1,file2);
END ELEMENT
END TEST
Several Calls to a Stub
If a stub is called several times during a test, either of the following are possible:
·
Describe the different calls in the same STUB instruction, as described
previously.
·
Use several STUB instructions to describe the different calls. (This allows a
better understanding of the test script when the STUB calls are not consecutive.)
The following example rewrites the test to use this syntax for the call to the STUB
close_file:
STUB close_file (3)1
STUB close_file (4)1
No Testing of the Number of Calls of a Stub
If you don't want to test the number of calls to a stub, you can use the keyword
others in place of the call number to describe the behavior of the stub for the calls to
the stub not yet described.
159