Forum Discussion

kzoe's avatar
kzoe
New Contributor
8 years ago

Error handling with data-driven script tests

Hi community,

 

I’m new to TestComplete and having some difficulties in implementing our desired error handling. All of our test cases are scripted using Jscript with data-driven approach (CSV files). When an error occurs, the test case execution of the current data row should stop and continue with the next row.

 

So, the execution of one single test case currently looks like this:

 

var ddtDriver = DDT.CSVDriver(GetTestData(fileName));
  
while(!ddtDriver.EOF()) {
  Before();
  try {
    Testcase();
  } catch (e) {
    // ...
  }  
  After();
  ddtDriver.Next();
}
DDT.CloseDriver(ddtDriver.Name);

 

It seems like we cannot catch an exception which is thrown in another module, so this function does not work as intended.

 

Using an OnLogError event with Runner.Stop(true) also does not work as desired since we don’t use keyword-driven test items.

 

I've run out of ideas on how to solve this seemingly trivial problem. Any ideas are appreciated.

 

Thx

K.

1 Reply

  • mgroen2's avatar
    mgroen2
    Super Contributor

    Maybe you can create a Keyword driven tests, which calls the script, and then use the OnLogError event?

     

    Another possible usefull idea: create a feature request for your scenario.