Generating a Separate Test Harness

Component Testing for Ada

Because of restrictions of the Ada language, Component Testing cannot generate a test harness which is a separate of more than one package.

You can however generate the main test harness as a separate of one of the packages and declare additional procedures as separates of other packages. This is done in the header of the .ptu test script, as in the following example:

Header Code_Under_Test, 1.0, 1.0

      #separate (Second_Package);

      #procedure Something is


      # -- here internal variables of Second_Package are

      # -- visible; private types can be accessed etc.

      # null;

      #end Something;

      #with Second_Package;

      -- this is to gain visibility on the package

      -- from within the test harness

Begin First_Package, Test_Entry_Point

-- this causes OneTest Embedded to generate a procedure

-- "Test_Entry_Point" as a separate of "First_Package" as

-- "main" procedure of the Test Harness

-- etc.


If the test script requires access to items from Second_Package, it can call the corresponding procedure from within an ELEMENT block of this .ptu test script.


      -- some VAR instructions here


      #-- here is the call to the tested procedure

End Element

Related Topics

Declaring Global Variables for Testing