Customizing a component test for Ada

A customized component test script has been created for you. This test will be used to test the functions within CodeCoverage.ads and CodeCoverage.adb in particular, the function SIMPLECONDITION, which contains a conditional loop.

Normally, it is up to you to rewrite the test script based on the skeleton provided by the Component Test wizard and the specifications of your code. For this tutorial, let's just replace the generated test script with a completely functional one.

To customize the test:

  1. Select the menu item Window->Close All

  2. Select the Project Browser tab on the right-hand side of the screen, select the CodeCoverage.ptu node (child of the MyAdaTest component testing node), and then select the menu item Edit->Delete.

  3. Right-click the MyAdaTest component testing node and select Add Child->Files...

  4. In the Files of Type dropdown box, select the C and Ada Test Scripts option, then browse to the Test RealTime installation folder and Open the file \examples\TestSuiteAda\CodeCoverage2.ptu

  5. After this new test script is analyzed by OneTest Embedded, your screen should appear as follows:

 

 

  1. Double-click the node CodeCoverage2.ptu, and maximize the test script window.

  2. Bring the SIMPLECONDITION test blocks for CodeCoverage2.ptu into view using the Asset Browser tab. (The Asset Browser tab continues to reference the original test script - CodeCoverage.ptu - because it still exists on your machine - it is simply no longer referenced by any tests.)

  3. As you can see, two Test blocks are now part of the SIMPLECONDITION service block. In TEST 1 the initial value of X has been set to -1 and the expected value for Ret_SIMPLECONDITION has been set to -1. In the second Test block, the initial value of X has been set to 1 and the expected value for Ret_SIMPLECONDITION has again been set to -1.