RADE |
C++ Unit Test Manager |
Test Objects and the mkodt CommandPrinciples of use |
Technical Article |
AbstractThis 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. |
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 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]
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.
Directory | Description |
---|---|
TestCases | ODT shell-scripts |
SwitchTestCases | Switch ODT shell-scripts |
InputData | Input of shell-scripts. Every necessary files to run ODTs |
OutputRef | Reference output of ODTs |
Output/$OS | Output generated by mkodt on each operating system |
[Top]
Use the concepts of "workspace" and "project"
Help mode
mkodt -h
Contextual mode
mkodt -D | -s <name> | -a [-tXC]
Descriptive mode
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]
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]
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) (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]
The mkodt command generates two output files in the Output/$OS directory. These files are:
SetOdtParam max_time=2 Mod Mod2 exit$? |
test1.traces generated by mkodt:
FrameworkName -f ODTName OS ReturnCode date ? ODTType Pertinence Elapsed_time max_time
where:
ODTType = S
if the ODT is a Switch ODT, otherwise ODTType
= .
Pertinence = 0
if the ODT is not pertinent, otherwise ODT
is pertinentmax_time = .
if the max_time value is not modified in the
ODTExample:
The file test1.mkodt_result generated by mkodt:
[Top]
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
export ODT_REQUESTED_PRODUCT="_MD2.slt+"
export ODT_REQUESTED_PRODUCT="_MD2.slt+;GPS.prd"
export ODT_REQUESTED_PRODUCT="_MD2.slt+GPS"
Note that ODT_REQUESTED_PRODUCT variable is only supported for mkodt command.
Available commands in a test shell script
A shell can include the SetOdtParam instruction to control some aspects of its execution.
SetOdtParam max_time=xx
max_time is the maximum time allowed for test to be completed. The default value of max_time is 5 minutes. max_time can not exceed 60 minutes. If a test exceeds this max_time, the corresponding process is killed and the ODT exit with a return code 99.
SetOdtParam Replay_xxxx=NO
xxxx can be AIX, SunOS, HP-UX, Unix, Windows_NT, aix_a, solaris_a, hpux_b, intel_a. This instruction indicates that the current test object must not be run on the given operating system - this property is useful when all test objects are run automatically and not by hand. More than one such instruction can be written in a shell.
SetOdtParam USER=xxx
This instruction is used to specify the user (xxx) when the ODT will be replayed.
SetOdtParam TYPE=xxx
This instruction assigns a type to the ODT. Subsequently, with the release, it is possible to set the environment variable ReplayExcludType to the type that has been assigned to the ODT and thus exclude the replay of this ODT for that release.
Example 1: If the ODT is:
export ODT_REQUESTED_PRODUCT="_AL2.slt+;_ME2.slt+" SetOdtParam TYPE=MonTYPE LOAD exit $ |
If in the Release, ReplayExcludType is set to MonTYPE, this ODT will not be replayed.
This instruction is used in Product Release to select ODTs to replay.
Example 2: In a product Release P1: set
ReplayExcludType=TYPE1!TYPE2
(on Windows) or export
ReplayExcludType=TYPE1&TYPE2
on UNIX.
This Release P1 is not going to replay ODTs that contain:
SetOdtParam TYPE=TYPE1
and/or:
SetOdtParam TYPE=TYPE2
This command is used to find a directory or a file in the workspace
concatenation (ADL_ODT_CONCATENATION
).
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.
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]
[1] | mkodt Options and Variables |
[Top] |
Version: 1 [May 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.