Testing with PTU test scripts

You can add and execute component testing .ptu test scripts in HCL OneTest™ Embedded for Eclipse IDE.

About this task

You need to import the PTU file in a project to be able to execute the test script.

Procedure

  1. To import a PTU file, select File > Import and choose General > File System to select the files. You can import these files in any folder at any file structure level.
  2. To execute the test, right-click on a PTU file and choose Run as > PTU test file. As a result, a test report and runtime analysis reports will be generated.
  3. Alternatively, or if the menu PTU test file is not available, you can select Run Configurations and PTU Test file in the dialog box that opens . Then, right-click and select New to create a new launch configuration. Then proceed as follows:
    1. Set a name to your launch configuration.
    2. In the Unit Test Script tab, select your PTU file in Select Application panel.
    3. Select your configuration in the Configurations panel and click Run. The reports are available into the Test Result folder.
    4. To open the reports, select the report file corresponding to your last execution, right-click and select Open With > Test Report.
  4. As the test may need additional files and additional options, they have to be specified into the PTU file itself, as follows:
    1. Directives can be specified with specific lines starting with --%f and --%o located on top of the file, before the HEADER keyword setting.
    2. %o set into the test script is used to provide specific build options. Options format must follow the attolcc options format.
    3. %f allows to specify the list of additional source files to be taken into account into the build.
    4. Relative paths are to be set to specify the test scripts location.
    5. Set the PATH environment variable as follows to make the test scripts portable.
    1. ${workspace_loc:/myproject/src/sub.c}
    2. $workspace_loc:/myproject/src/sub.c
    3. $(project_loc)/src/sub.c
      Note that the build automatically creates the 3 following environment variables:
      • 'workspace_loc' corresponding to the workspace location
      • 'project_loc' corresponding to the project location
      • 'tstscript_loc' corresponding to the test script location
Feedback