Forum Discussion

KJM_VSA's avatar
KJM_VSA
New Contributor
8 years ago

Resume test runner script after keyword test fails

For testing our website, we have designed our test cases such that they are a series of keyword tests, where every page has a corresponding keyword test. We using Excel-based DDT to read in form entry values, which are then bound to the Keyword test values, and the keyword tests are run in sequence. The sequence of keyword tests is controlled by a Test Runner JavaScript script, as such:

        eval("KeywordTests." + test + ".Run()");

The issue that arises is that when an error occurs during test execution, such as an object cannot be found, I would like for there to be the option to stop the keyword test completely and move onto the next test.

 

As far as my research into this has gone, it doesn't seem possible. Currently I am able to trap the program flow in an OnLogError event handler. From here I have tried to use the Runner.Stop() method, which seems to stop the entire test run instead of just the keyword test; as well, I have tried to surround the eval statement with a try/catch block, but it looks like Test Complete intercepts the error before it can make its way back up the call stack.

I am hoping to find an alternative solution here. I'm not sure if any of these are feasible, but would it be possible to:

 

  • Return execution flow from a keyword test called from a script, back to the script, after an error; or
  • Dynamically add Test Items to the Project object to have more fine-grained control from the test runner script; or
  • Some other idea that I haven't thought of.

The last ditch solution to this would be to write something like a bash script and call Test Execute for each of the tests, but I am hoping for a more elegant solution.