Configuring Python, Perl, Windows or Linux scripts

To run Python, Perl, Windows or Linux scripts in a standalone mode, you must configure your scripts by using the java runtime that is delivered with HCL OneTest Embedded.

A java runtime named ScriptReport-1.0.jar is available in the lib/java folder when you install HCL OneTest Embedded. It is used by default to ensure that test script results are displayed directly in your test suite, and in your workspace after a manual refresh when the script is executed in a standalone mode. You must use some of the runtime commands in your .py, .pl, .sh or .bat files to customize your reports.

Note: Using runtime commands in scripts requires advanced user level.

initreport

initreport <logfile>

This command is used in a script when all result files are created by the script.

It initializes necessary resources needed to create a log file.

This log file will contain the list of all intermediate files that are needed to create a result file.

<logfile> parameter is the name of this log file.

By convention, the extension is .xtp.

This log file will be generated if this command is used in a script that is executed in a standalone mode.

If this command used in a script that is executed from a test suite, the name of the test suite is taken into account, and the parameter is ignored.

addreport

addreport <logfile> -path=<ressource path> [-kind=<ressource kind>]

<ressource path> : Resource to be added to the report. The resource path can be a relative path that points to the script location, or an absolute path.

<ressource kind>: Kind of resource (optional)

This command registers a resource to be added to a logfile.

If you add a folder as a resource, this folder will be the used as relative resource path.

For very advanced users: If you have a resource with an unusual extension, you can enter your own <resource kind> option.

The following table gives the list of file extensions that are recognized in HCL OneTest Embedded for Eclipse IDE and the corresponding <ressource kind> options that must be entered in the script file.
File extension <resource kind> option Resource added to the log file
.ccf CCF ccf file
.crc CRC crc file for MISRA report
.crc.json CRJ crj file
.crx.html CRX MISRA code review report in html format
.dcp DCP dcp file

.dcp.json

DCJ dcj file
.dcx.html DCX dcx file in html format for data coupling report
<executable without any extension> EXE
.exe EXE exe file
.fdc FDC fdc file for coverage report
<folder> DIR new reference for further relative path
.html HTM .html user file in html format
.log LOG log file
.met MET met file for metrics report

.o

OBJ object file
.obj
.req REQ req file
.rio RIO rio file
.rtx RTX rtx file for charts report
.tdf TDF tdf file for trace report
.tgj.json TGJ tgj file
.tgx.html TGX tgx file for control coupling report in html format
.tio TIO tio file
.tpf TPF tpf file for memory profiling report
.tqf TQF tqf file
.tqf.html TQX tqx file for performance profiling report in html format
.tqf.json TQJ tqj file
.tsf TSF tsf file for trace
.tzf TZF tzf file

.tzf.json

TZJ tzj file

.tzx.html

TZX tzx file for stack profiling report
.xob XOB xob file
.xrd XRD xrd file for test report
.xtp XTP xtp file

genresult

genresult <logfile> [-path=<path>] [-name=<basename>]

<logfile> : Log file containing reports

<path> : Location where the result is generated (optional, the default value is <logfile folder>).

This command generates a result file from a logfile.

By default, it is the same location as the log file, with the same base name.

You can change this default behavior with optional parameters.

This command is supposed to be the last one, any resource added after this one will be ignored.

getconfig

getconfig <key> [<env key> <default value>]
Note: This command should be used by very advanced users only.

This command returns a key from the config file if it is executed from a test suite.

The command returns "<not found>" if the key is not found or executed in a standalone mode.

If the key is "<not found>", it returns an environment variable <env key>.

If the environment variable <env key> is not found, the command returns the <default value>.

This command is used to retrieve preferences from HCL OneTest Embedded for Eclipse IDE, when you call your script from a test suite.

If it is executed in a standalone mode, you can enter an environment variable as optional parameter or a default value if there is no environment variable.

For example, you can retrieve “confrule” file when you use Code Rule Checker.

You can retrieve the multiple keys that are existing in a generated file named “envTestRTcc.pl” that is located in the %home% folder.

You can find examples in the ExamplesEclipse folder under the product installation files. The folder contains a set of sources and three scripts (perl, bat and python). Theses scripts perform Code Rule Checker on sources and produce reports. They all use relative locations for sources and results so that they can be executed in a standalone mode or from a test suite, by using a the runtime commands.