Creating a component test for C in Eclipse

Test RealTime for Eclipse CDT

You can create a new component test for C in your Eclipse workspace with the Component Testing for C wizard. You use the generated test script template to elaborate your own test cases. You can later add runtime analysis to the test.

Once the test has been generated, you can complete your Component Testing test scripts in the component test editor. Refer to the Test RealTime Reference Manual for information about the actual language semantics.

Before creating a test, you must have a project in your workbench containing all the relevant files for the application under test.

To create a component test in Eclipse:

  1. In the Eclipse workbench, select File > New > Other > Test > Test Realtime Component Test and click Next.

  2. Select Component Testing for C to generate an automated test for C source code and select a Target Deployment Port. Click Next.

  3. On the Components Under Test page, use the Add and Remove buttons to build a list of source files and header files to add to your test. Among this list, select the specific source files that you want to test.

If you want to determine which files require the largest testing effort, select Compute Static Metrics to run the analysis of static testability metrics. You can click Refresh to recalculate these metrics.

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.

Click Next to continue.

  1. On the Test Script Generation Settings page, specify the test generation options. The General settings specify how the wizard creates the test node.

    1. Test Name: Enter a name for the test node.

    2. Test Mode: Disables or enables the test boundaries.

      • Typical Mode: No test boundaries are specified. This is the default setting.

      • Expert Mode: This mode allowing you to manually drive generation of the test harness. This provides more flexibility in sophisticated software architectures.

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. Select Inherit settings from a Test RealTime configuration in a C/C++ Eclipse project to inherit the configuration settings from an existing Test RealTime configuration. Click Browse to specify the project and the configuration from which you want to inherit the settings.

Note   Linking to a configuration allows you to inherit the settings from that configuration. Any changes you make to the linked configuration will be cascaded down to the configuration of the test, unless you override them in the test.

  1. Select Enable test for compare mode with a secondary configuration to configure the test to run in compare mode. This creates a secondary configuration, which by default is a copy of the main configuration. If you want to copy the settings from another configuration, click Browse to specify the project and configuration from which you want to copy the settings.

Note   Compare configuration settings are copied once and not inherited. If you change the copied configuration, the changes are not inherited by the compare configuration.

Click Next to continue.

  1. On the Test name and location page, select where you want to create you test and type the name of the test. Click Finish.

After generating the test, you are asked whether you want to switch to the Eclipse test perspective. Select Yes to view and edit the generated tests.

Related Topics

Creating a component test for C++Manually creating a component testAutomatically updating a .ptu test script