Introduction to tsscmd

prevnext

Sample Command Line Test Script


The following example illustrates how to use tsscmd statements inside a Perl script. The example opens a datapool and displays some of its attributes. If the datapool fails to open, the script calls ErrorDetail for information. If you create a datapool (click Tools > Manage > Datapools) matching the name entered in the script's first line, you can run the script from TestManager (click File > Run Test Script > Command Line). Or you can add it to a suite containing test scripts of other types and run the suite. If you follow the procedure explained in Setting Up TestManager for tsscmd, you can write, edit and view this test script from the TestManager File menu, as well as run it.

$dpid= `tsscmd datapoolopen -access private contacts`;
chomp ($dpid);
$? = $? >> 8;
if ($? == 0) {	 	 	  # datapool is open
    print "Datapool opened: here are some of its attributes\n";
    print "Datapool ID for this run is $dpid\n";
    $ncol= `tsscmd datapoolcolumncount $dpid`;
    print "datapool has $ncol columns\n";
    for ($i=1; $i le $ncol; $++i) {
	 	 $cname= `tsscmd datapoolcolumnname $dpid $i`;
	 	 print "Column $i is named $cname\n";
    }
    $nrows = `tsscmd datapoolrowcount $dpid`;
    print "datapool has $nrows rows\n";
    `tsscmd datapoolclose $dpid`;
  }
else	 {	 	 	 	 # datapool open failed
    print "datapool failed to open with status code $?\n";
    print `tsscmd errordetail`;
}

prevnext


The Command Line Interface to Rational Test Script Services Rational Software Corporation
Copyright (c) 2003, Rational Software Corporation http://www.rational.com
support@rational.com
info@rational.com