Running a Component Test for C

Running a component test is as simple as it was to build and execute the UMTS base station used in the runtime analysis exercises.

To execute the test:

  1. From the File menu, select Save Project.

  2. From the Window menu, select Close All

  3. On the Project Browser tab, select the UmtsCode component testing node (the parent node of the UmtsCode2.ptu and UmtsCode.c nodes) and then press the Build toolbar button.

  4. The test is executed as part of the build process - you will know the test has finished executing when the green execution light on the lower-right of the UI stops flashing.

You may have forgotten that the runtime analysis tools are still selected in the Build options; the file under test - UmtsCode.c - was instrumented for the memory profiling, performance profiling, code coverage analysis and runtime tracing features of Test RealTime, which explains why the Runtime Trace viewer appears during the run. Notice how this feature tracked all of the calls made to functions in UmtsCode.c. Each call is a test in the component testing test script that just executed.

  1. In the Project Browser tab on the right-hand side of the screen, double-click the UmtsCode component testing node in order to open the test report and all of the runtime analysis reports.

What is the result of your tests? Did you improve coverage on the while statement? That is the subject of the next exercise.