RADE

C++ Unit Test Manager

Test Objects and the mkodt Command

Principles of use
Technical Article

Abstract

This article explains the basic principles of test objects. You will find here everything to understand the test file tree and to create and to run your test objects. 


What You Will Learn with This Article

This article is intended to help you understand how to create and to run test objects using the mkodt command. If you want to have more information and examples of test objects, see the use cases documentation.

[Top]

The mkodt Command

The mkodt command runs test objects which are delivered in test frameworks. This command gives the choice (by using different options) of running one test object or all test objects found in a given framework or in a workspace. The command is available with mkmk commands. To access to this command, you have to run the mkmk_profile or the adl_profile.

[Top]

Test File Tree

The CAA file tree is composed by framework. To each code framework correspond a test framework which contains a FunctionTests directory; In this directory, you must find everything you need to run test objects.

[Top]

Options Available with mkodt

Use the concepts of "workspace" and "project"

mkodt -D | -s <name> | -a [-tXC]

mkodt -W <Workspace> | -d <path> -F <Framework> | -FWList <fileFWList>  | -s <shell > | -l <File1> | -L <File2> | -a [-StXC] -NOMaxTime -NoPert -ExcludFW <fileFWExcluded> -PriorityFW <fileFWPriority> -o <Output> -p <PATH1:PATH2...> -r <RTPATH1:RTPATH2...> -UpdateInit -EnoviaEnv <Site> -html -xml

[Top]

Environment Variables Evaluated by mkodt

Variable Use Meaning
WSROOT Read only References the workspace directory containing the test objects to be run.
ADL_ODT_TMP Read only References a temporary directory, for instance /tmp on Unix and C:\TEMP on Windows.
ADL_ODT_IN Read only References a directory where all data needed as input for a program are stored.
ADL_ODT_OUT Read/write References an output directory where any output data can be stored
ADL_ODT_REF Read only References a directory where reference data are stored. Reference data are data used to compare what a program produces with what should be
produced....
ADL_ODT_NULL Read only References a special file which can be used to redirect outputs from a program (/dev/null with Unix or NUL with Windows.)
ADL_ODT_CONCATENATION Read/write References a concatenation which is used by the WhichDir command

[Top]

Environment Variables Evaluated by the User

Variable Meaning
ADL_ODT_CONCATENATION References a concatenation which is used by the WhichDir command
ADL_ODT_OUT References an output directory in which
any output data can be stored. This directory can be evaluated before running mkodt.
ODT_PERTINENCE To suspend the pertinence measure, use : ( = -NoPert option)
ODT_PERTINENCE=No
(before running mkodt)
MKMK_LST_RTV To give a runtime path concatenation, set the MKMK_LST_RTV variable before running mkodt ( = -r option)
PATH_TEST To add a concatenation to the PATH (and LIBPATH or LD_LIBRARY_PATH or SHLIB_PATH) before running the ODT.
ODT_MAX_TIME Set this variable to change the max_time value.
ODT_MAX_TIME_COEF Set this variable to change the max_time value : max_time=max_time*ODT_MAX_COEFF/100
MKODT_SUPENV (VPM) Set this variable to use environment extension; This variable must contain a shell-script path that will be run before the ODT shell-script. If this variable is not set, mkodt looks for mkodt_supenv_($ADL_FR_CATIA) file in the PATH.
OPTION_FOR_SETCATENV Set this variable to add options to setcatenv (set the CATIA environment)

[Top]

Test Results: mkodt Output

The mkodt command generates two output files in the Output/$OS directory. These files are:

  1. xxx.traces: contains traces generated by the shell script.
    Example
    : The shell script test1.sh runs two executable which contain two cout:
    SetOdtParam max_time=2
    Mod
    Mod2
    exit$?

    test1.traces generated by mkodt:

  2. xxx.mkodt_result: contains result of the ODT replay. The file format is:
    FrameworkName -f ODTName OS ReturnCode date ? ODTType Pertinence Elapsed_time max_time

    where:

    Example:

    The file test1.mkodt_result generated by mkodt:

[Top]

Test Shell Script Creation

First of all, the mkodt command replays the ODTs without any Settings. But, if the license is managed by a license server, mkodt cannot silently request the nodelock licences. So, the licences to request must be specified.

To access to the license, the shell script must export the environment variable ODT_REQUESTED_PRODUCT. This variable will contain the list of needed configurations and products licenses. Each license must be separated by a semi-colon:

export ODT_REQUESTED_PRODUCT="_CFG1.slt+;PRD1.prd;...."

Examples

Note that ODT_REQUESTED_PRODUCT variable is only supported for mkodt command.

Available commands in a test shell script

SetOdtParam

A shell can include the SetOdtParam instruction to control some aspects of its execution.

WhichDir

This command is used to find a directory or a file in the workspace concatenation (ADL_ODT_CONCATENATION). 

ODTInit

This command can be used in ODTs that contain an initialization step; indeed, some ODTs could use the same data, for example, the same Part. In a replay, this command will factorize the initialization step….

To use this command, you have to create a shell-script, named ODTInit_logicname.sh in the ADL_ODT_IN directory of the test framework; This shell will create the output data that will be used in the others ODTs. To use the output of the ODTInit_logicname.sh file, you have to start the ODT shell-script with:

ODTInit logicname

The purpose of this command is to gain time on the ODT replay.

What's Forbidden in a Test Shell Script

Forbidden Authorized
#!/bin/ksh #
Don't export PATH, LIBPATH and ADL_ODT_xxx -
Don't use the rm and mv commands -
Don't use "/" in the PATH Use $ADL_ODT_SLASH
Don't use ":" in the PATH Use $ADL_ODT_SEPARATOR
Don't run process in background (process& ) -
No file Path: /u/lego/CXR3/BSF/… Use ADL_ODT_xxx variables
Don't use /tmp Use ADL_ODT_TMP
Don't use /dev/null Use ADL_ODT_NULL
- Test the return code of your modules
return xx exit xx
../../InputData (relative Path) Use ADL_ODT_xxx variables
/dir/WS/OS/code/bin/LOAD LOAD
No double bracket [[…]] Use […]
From CXR15 level (Using CATSTART):

Don't use in the same shell-script export AND chcatenv commands to modify your CNEXT environment variable.

Use ONLY the export command.

[Top]


References

[1] mkodt Options and Variables
[Top]

History

Version: 1 [May 2000] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.