RADE |
Java Unit Test Manager |
Java Test Objects and the mkodt CommandPrinciples of use |
Technical Article |
AbstractThis article explains the basic principles of java test objects. You will find here everything to understand the test file tree and to create and to run your java test objects. |
This article is intended to help you understand how to create and to run java test objects using the mkodt command. If you want to have more information and examples of java test objects, see the use cases documentation.
[Top]
The mkodt command runs java 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
Descriptive mode
To be explained
[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_JRE |
Read/write | References the Java RunTime Environment used to launch the ODT. |
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_SLASH |
Read only | References the / on Unix and the \ on Windows |
ADL_ODT_SEPARATOR |
Read only | References the : (colon) on Unix and the ; (semi-colon) on 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. |
ADL_ODT_JRE |
References the JRE (Java RunTime Environment) where the ODT is going to be replayed: ADL_ODT_JRE can be set to:
If this variable is not set before launching mkodt, it will be set by default to:
|
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:
xxx.mkodt_result: contains result of the ODT replay. The file format is:
FrameworkName -f ODTName 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 ODT[Top]
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 USER=xxx
This instruction is used to specify the user (xxx) when the ODT will be replayed.
SetOdtParam Replay_xxxx=NO (where xxx is an OS name: AIX, SunOS, HP-UX, Unix, Windows_NT, aix_a, solaris_a, hpux_b or 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 Replay_xxxx=NO (where xxx is a JRE name: msjre_a, ibmjre_a, sgijre_a or hpjre_a)
This instruction indicates that the current test object must not be run on the given Java RunTime Environment () - 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 (see also the ADL_ODT_JRE environment variable).
SetOdtParam TYPE=JAVABATCH
This instruction type the ODT as a java ODT. It will create the minimum java environment updating the PATH and the CLASSPATH. This line must be present in every java ODTs.
SetOdtParam TYPE=xxx
This instruction type the ODT, that is to say that this ODT can be selected in a Release by setting the environment variable ReplayExcluType.
Example:
If the ODT is:
SetOdtParam TYPE=MonTYPE 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:
in a product Release P1: set ReplayExckudType=TYPE1!TYPE2 (on NT) or export ReplayExcluType=TYPE1&TYPE2 on UNIX.
This Release P1 is not going to replay ODT that contain:
SetOdtParam TYPE=TYPE1
Or / And:
SetOdtParam TYPE=TYPE2
This command is used to find a directory or a file in the workspace concatenation ( ADL_ODT_CONCATENATION).
This command will be used to add files (.zip, ,jar, ...) to the CLASSPATH environment variable already set.
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 logicnameThe purpose of this command is to gain time on the ODT replay.
This command must be used to launch your apllet or java application with in arguments all the arguments you would give to java or jview.
This command will launch the java you choosed (by setiing the ADL_ODT_JRE).
Forbidden | Authorized |
---|---|
#!/bin/ksh | # |
No export of 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 […] |
[Top]
[1] | mkodt Options and Variables |
[Top] |
Version: 1 [March 2001] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.