Creating a component test

The Component Testing Wizard helps you create a new Component Testing test node in your project for C, C++, Ada and Java.

For each script type, the wizard analyzes the source code under test to extract unit information and will produce a corresponding test script template using the following test script types:

You use the generated test script template to elaborate your own test cases.

You can later add to this test node any of the runtime analysis features included in OneTest Embedded  .

There are two methods of creating a test node with the Component Testing wizard:

Once the test node has been generated, you can complete your Component Testing test scripts in the Text Editor. Refer to the OneTest Embedded Reference section of the help for information about the actual language semantics.

To run the Component Testing Wizard from the Start Page:

  1. Use the Start Page or the File menu to open or create a project. Ensure that the correct Configuration is selected in the Configuration box.

The selected programming language impacts the type of Component Testing test node to be created.
On the
Start Page, select Activities and choose the Component Testing activity.

  1. On the Application Files page, use the Add and Remove buttons to build a list of source files and header files (for C and C++) to add to your project.

The Configuration Settings button allows you to override the default configuration settings.
Select
Compute Static Metrics to run the analysis of static testability metrics.

Click Next> to continue.

Note   If the static metrics analysis takes too much time, you can clear the Compute Static Metrics option. In this case, the calculation and display of static metrics in any further steps are disabled.

Note   With Component Testing for Ada, it is not possible to submit only an Ada procedure file. Instead, you must include the single procedure in a package.

  1. The Components Under Test page allows you to select the units or files for the selected source files.

In order to help you choose which components you want to test, this page displays the metrics for each file or unit (packages, classes or functions depending on the language).
Select
File Selection to choose files under test or Unit Selection to choose the source code units that require testing. The selection mode toggles the static metrics displayed between file metrics or unit metrics.

Note   If the Unit Selection view seems incomplete, cancel the wizard, from the Project menu, select Refresh File Information and restart the wizard. See Refreshing the Asset Browser.

Click Metrics Diagram to select the units under test from a graph representation.
Click
Next> to continue or Generate to skip any further configuration and to use default settings.

  1. The Test Script Generation Settings page allows you to specify the test node generation options. The General settings specify how the wizard creates the test node.

The Components Under Test settings specify advanced settings for each component of the test node. These settings depend on the language and Configuration.
Click Next> to continue.

  1. Review the Summary. This page provides a summary of the selected options and the files that are to be generated by the wizard.

Click Next> to create the test node based on this information.

  1. The Test Generation Result page displays progression of the test node creation process. Click Settings to set the Configuration Settings. You can always modify the test node Configuration Settings later if necessary, from the Project Explorer.

Note   If you apply new settings after the test generation, the wizard reruns the test generation. This allows you to fine-tune any settings that may cause the test generation to fail.

Once a test node has been successfully generated, click Finish to quit the Component Testing Wizard and update the project.

To run the Component Testing Wizard from the Asset Browser:

  1. Use the Start Page or the File menu to open or create a project.

  2. Ensure that the correct Configuration is selected in the Configuration box. The selected programming language impacts the type of Component Testing test node to be created.  

  3. In the Project Explorer, select the Asset Browser tab.

  4. Right click an object, package or source file under test. From the popup menu, select Test.

  1. The Test Script Generation Settings allows you to specify the test node generation options. The General settings specify how the wizard creates the test node.

The Components Under Test settings specify advanced settings for the component of the test node. These settings depend on the language and Configuration.

Click Next> to continue.

  1. Review the Summary. This page provides a summary of the selected options and the files that are to be generated by the wizard.

Click Next> to create the test node based on this information.

  1. The Test Generation Result page displays progression of the test node creation process. Click Settings to set the Configuration Settings. You can always modify the test node Configuration Settings later if necessary, from the Project Explorer.

Note   If you apply new settings after the test generation, the wizard reruns the test generation. This allows you to fine-tune any settings that may cause the test generation to fail.

Once a test node has been successfully generated, click Finish to quit the Component Testing Wizard and update the project.

Related Topics

Component Testing for C and AdaComponent Testing for C++Component Testing for Java