RADE

Java Unit Test Manager

Using mkodt

Creating and running test objects
Technical Article

Abstract

This article shows how to create and run java test objects, and how to use the commands and their options.


Using SetOdtParam

SetOdtParam enables you to select the operating systems with which you want the test object to be replayed, and to set the maximum replay time

[Top]

Selecting the |JAVABATCH type

To declare an ODT as a java ODT, the script must contain:

SetOdtParam TYPE=JAVABATCH

With this line the java environment will be set automatically, using the environment variable ADL_ODT_JRE. The CLASSPATH and the PATH wii be updated using this ADL_ODT_JRE variable.

Examples:

SetOdtParam TYPE=JAVABATCH
JavaReplay Appli
exit $?

This line must appear in each script of java ODTs.

Selecting the Operating System to Replay a Test Object

By default, a test object is replayed with any operating systems available on your site. If you don't want to replay a test object with a given operating system, use:

SetOdtParam Replay_xxx=NO

where xxx can have the following values: AIX, SunOS, HP-UX, Unix, Windows_NT, aix_a, solaris_a, hpux_b, and intel_a.

Examples:

Selecting the Java RunTime Environment (JRE) to replay a Test Object

By default, a test object is replayed with any JRE available on the OS. Here are the possible value of the JRE (The ADL_ODT_JRE environment variable ) for each OS:

Solaris and Windows sunjre_a
AIX ibmjre_a
HP_UX hpjre_a
Windows (Microsoft JRE) msjre_a

On Windows, the default value of the JRE is sunjre_a.

If you don't want to replay a test object with a JRE, use:

SetOdtParam Replay_xxx=NO

where xxx can have the following values: sunjre_a, sgijre_a, ibmjre_a, hpjre_a, msjre_a.

Examples:

Modifying the Maximum Replay Time of a Test Object

The default replay time of a test object is five minutes. To modify this replay time, add to the test object script:

SetodtParam max_time=xx

where xx is the maximum replay time you want to set. It can't exceed 60 minutes.

Example:

The following example shows a test object with a maximum replay time of ten minutes that will be replayed with Windows only.
SetOdtParam max_time=10
SetOdtParam Replay_Unix=NO
JavaReplay MyAppli
exit $?

[Top]

Using WhichDir

This command can be used in shell script to find a directory or a file in the workspace concatenation using the ADL_ODT_CONCATENATION variable. It will be used to add .zip, .jar.... files in the CLASSPATH environment variable.

Example: This test object that doesn't replay with Windows is going to find in the workspace concatenation the file $OS/docs/java/GW0Start.jar and will add this file in the CLASSPATH:

SetOdtParam TYPE=JAVABATCH
SetOdtParam Replay_Windows_NT=NO 
export CLASSPATH=$CLASSPATH${ADL_ODT_SEPARATOR}$(WhichDir $OS/docs/java/GW0Start.jar)

JavaReplay MyAppli
exit $?

[Top]

Using ODTInit

The ODTInit command is used to factorize steps of ODTs; Indeed, sometimes, ODTs could generate and use the same resources... But each ODT will create his own resources during a replay.

To use this command, the developer  must create a shell script named ODTInit_logicname.sh in the ADL_ODT_IN directory. This shell will generate resources that will be used on this ODT.

Using JavaReplay

The JavaReplay command is used to launch the given application or applet with the a given JRE .

Example

Normally, to test a java Application, you have to launch, after having updated the PATH and the CLASSPATH variables:

java MyAppli

or 

jview MyAppli

 

With mkodt java, you do not have to set PATH and CLASSPATH, except to add specific .jar in your CLASSSPATH; To launch your java application, you just have to type your ODT as a JAVABATCH ODT and to use the JavaReplay command:

SetOdtParam TYPE=JAVABATCH
export CLASSPATH=$CLASSPATH${ADL_ODT_SEPARATOR}$(WhichDir $OS/docs/java/GW0Start.jar)

JavaReplay MyAppli
exit $?

This ODT will be replayed on every JRE. The default JRE for each OS are:

Solaris and Windows sunjre_a
AIX ibmjre_a
HP_UX hpjre_a
Windows (Microsoft JRE) msjre_a

If you wish to replay your ODT on the Microsoft's JRE (on Windows), you must launch:

set ADL_ODT_JRE=msjre_a

mkodt -s monODT

This will set the ADL_ODT_JRE to msjre_a, and, with the SetOdtParam TYPE=JAVABATCH and the javaReplay command used in the script, the replay on this JRE will be done automatically without having to se more variables.

[Top]

Using mkodt Options

Using Basic Options

These standard options are used to replay ODTs in a local workspace or in an official workspace:

Command Line ODTs Replayed
mkodt -W MONWS -F MONFW -a ( option -W available on UNIX only) Replay all ODTs of $HOME/MONWS/MONFW
mkodt -d /u/lego/CXR4/BSF -a -S -o /u/users/toto/output Replay all Switch ODTs of CXR4 and generate Output in /u/users/toto/output directory
mkodt -s DRW*Rec Replay all ODTs DRW*Rec of the current workspace.

[Top]

Using Concatenation Options (-p and -r)

Command Line ODTs Replayed
mkodt -d \\renoir\CXR4\BSF -a -S -o E:\users\toto\output -p e:\steplib\CXR4\LocalWS

$ADL_ODT_CONCATENATION= e:\steplib\CXR4\LocalWS

Runtime Concatenation = e:\steplib\CXR4\LocalWS

mkodt -d \\renoir\CXR4\BSF -a -S -o E:\users\toto\output -r e:\steplib\CXR4\LocalWS

$ADL_ODT_CONCATENATION=\\renoir\CXR4\BSF

Runtime Concatenation = e:\steplib\CXR4\LocalWS

mkodt -d \\renoir\CXR4\BSF -a -S -o E:\users\toto\output -r e:\steplib\CXR4\LocalWS -p \\renoir\CXR4rel\BSF

$ADL_ODT_CONCATENATION=\\renoir\CXR4rel\BSF

Runtime Concatenation = e:\steplib\CXR4\LocalWS

[Top]

Using -NOMaxTime Option

This option suspend the supervision of max_time ODT:

Example:

For the following example:
SetOdtParam TYPE=JAVABATCH
SetOdtParam  max_time=1
JavaReplay Appli
exit $?

[Top]

[Top]

[Top]

Changing the Output Directory

To change the output directory, there are two possibilities:

  1. use the -o mkodt's options:

    Created directories:

  2. set the ADL_ODT_OUT variable before running mkodt:

    Created directories:

    If ADL_ODT_OUT is not set or if users don't use the -o option, the output directory is: WSROOT/FW.tst/FunctionTests/Output/$OS. If the workspace is read-only, the output will be saved in ADL_ODT_TMP.

    Example:

    In this example, we replayed ODTs DRW*Rec* in frameworks Drafting*.tst in the CXR4rel level; mkodt found 524 ODTs; Furthermore, there is no option -o in the command line and the ADL_ODT_OUT is not set, so the mkodt ouput's will be sqved in ADL_ODT_TMP\MKODT_save_297. The command had been interrupted by user (^C).

[Top]

[Top]

Using Other Options: -q, -X, -l, -L

These options are used to modify the output of the mkodt command (-q, -X) or to give a list of ODT to replay (-L, -l):

Command Line ODTs Replayed
mkodt -d E:\users\toto\MONWS -a -S -q -o E:\users\toto\output  (intel_a) Replay all Switch ODTs of MONWS in quiet mode.
mkodt -d /u/users/toto\MONWS -s CCPCutRec -X -o E:\users\toto\output  The ODT CCPCutRec will be replayed and its output will be redirected on output screen in real time.

mkodt -d /u/users/toto\MONWS -L /u/users/toto\MONWS/ FileListODT -X -o E:\users\toto\output

or

mkodt -d /u/users/toto\MONWS -L FileListODT -X -o E:\users\toto\output 

The file FileListODT contain the ODT list to replay; This file has the following format:

FW1 TypeODT ODTName1

FW2 TypeODT ODTName2

……

mkodt -d /u/users/toto\MONWS -l FileListFWODT -X -o E:\users\toto\output 

The file FileListFWODT contain the ODT list to replay; This file has the following format:

ODTName1

ODTName2

...

[Top]


History

Version: 1 [March 2001] Document created
[Top]

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