company logo

Accssing data in TestBrowser database

In order to access TestBrowser data in the TestBrowser database, one may run OShell, which provides a tool similar to command shell. Another way is using OSI scripts or combining OSI with OShell.

The example below shows how to create a final test protocol and a summary listing all successfully executed test intends. Since test intends are often not defined for single test cases, but for the test suite containing the test cases, the example tries to read intend from test case and if not existing from parent test suite.

// combined access

// enable OSI debugger

//set OSI_DEBUG=YES

set DSC_Language=English

// change database to data source TBDat (OShell.ini)

  cd TBDat

  

// activate user defined osi functions from OSILibrary path (OShell.ini)

  osi do

  dictionary.loadOSILibraries;

  end

// change collection of test runs

  cc TestRun

// change access key and locate instance

  co sk_Name

  loc "LocalV13.0"

// change to collection of test runs (RunEntry) for this TestRun

  cc run_entries

// run embedded osi function for listing successful executes test runs

osi begin

VARIABLES           // required for variable definitions, only, may be omitted

  string     line;

  string     intend;

  int        total = 0;

  int        successful = 0;

  int        err = 0;

PROCESS             // required only in connection with VARIABLES section

  while ( next() )

    switch ( success ) { // 1: success;  0: error;  -1: not executed

  case 1 : line = displayname + '\t';

           if ( test_suite.tryGet(0) ) {

             intend = test_suite.ReadData("suite"); // file suite contains intension description for testcase

if ( intend == "" ) // inhrits intend from parent test suite

   if ( test_suite.par.tryGet(0) )

     intend = test_suite.par.ReadData("suite");

     line += intend;

   }

           Message(line);      // use File::writeLine for writing data to file

   ++successful;

   break;

  case 0 : ++err;

           break;

}

Message("Testrun contains " + (string)count() + " tests.");

Message("Successful: " + (string)successful);

Message("Failed    : " + (string)err);

end