background image
<< Test Program Entry Point | Ada_Task directory >>
<< Test Program Entry Point | Ada_Task directory >>

Testing Ada Tasks

Automated Testing
Component Testing will then automatically generate a call to the ATTOL_TEST
procedure in the main procedure of the test program. The test will be executed
during the execution of the main program.
Limitations
Consider the following limitations:
·
The unit under test must be of type
package
.
·
The root body of ATTOL_TEST (procedure ATTOL_TEST is separate) cannot
appear inside a generic package.
Testing Pointer Variables while Preserving the Pointed Value
To initialize a variable as a pointer while keeping the ability to test the value of the
pointed element, use the FORMAT string_ptr statement in your .ptu test script.
This allows you to initialize your variable as a pointer and still perform string
comparisons using str_comp.
Example:
TEST 1

FAMILY nominal
ELEMENT
FORMAT pointer_name = string_ptr
-- Then your variable pointer_name will be first initialized as a
pointer
....
VAR pointer_name, INIT="l11c01pA00", ev=init
-- It is initialized as pointing at the string "l11c01pA00",
--and then string comparisons are done with the expected values
using str_comp.
Testing Ada Tasks
As a general matter, Test RealTime Component Testing for Ada was designed for
synchronous programming. However, it is possible to achieve component testing
even in an asynchronous environment.
The important detail is that any task which might be producing Runtime Analysis
information (especially by calling stubbed procedures or functions) must be
terminated when control reaches the END ELEMENT instruction in the .ptu test
script.
If the code under test does not provide select statements or entry points in order to
request the termination of the task, an abort call to the task might be necessary. For
tasks who terminate after a certain time (not entering a infinite loop), the tester might
check the task's state and sleep until termination of the task. In the .ptu test script,
this might read as follows:
#while not TaskX'Terminated loop
# delay 1;
#end loop;
119