Manfred_F's avatar
Manfred_F
Regular Contributor
9 years ago
Status:
Implemented

provide "break on error" option

If a script causes an error, TC will either terminate the test run or just go on, depending on the "stop on error" option.

In both cases, trying to find the cause of the error is very time consuming: You have to re-run the test and set a breakpoint there.

 

I'd propose a "break on error" option, which behaves as if I had set a breakpoint in the errorneous line.

TC shall execute the line, monitor the error, and give me the chance to work with the debugger: evaluate expressions, re-run statements and so on

  • I have my TC setup with a 'Pause on Error' set to true so if an error does occur, it pauses the program exactly when the error occurred, then I can check my variables and the screen's status, and if need be, do a step by step from then on or correct the values on my screen in order to re-continue the testing. This works fine unless the error caused is not fixable at that point due to something not done properly before the error occurred.

     

    A better solution would be that when an error occurs and the 'Pause on Error' is activated, then if you are able to go back a few steps, possibly even change the script (which currently you can't in Pause mode) and/or change the screens data as well (this option may not be reversible), and continue testing from that previous spot. That will be much better as you can re-adjust your code 'on the fly' and continue the testing process without the need to re-start the whole test again.

     

    For now, a 'Pause on Error' should do the trick for you.

  • Manfred_F's avatar
    Manfred_F
    Regular Contributor

    'Pause on Error' sounds good, this would really help. Where can I find this nice option in V11.20?

  • Manfred_F's avatar
    Manfred_F
    Regular Contributor

    Ok, found it. It is in options, engines, general, debug, "pause test execution on posting an error".

     

    If I had known this before, it would have saved me MUCH time and nerves.

  • Manfred_F's avatar
    Manfred_F
    Regular Contributor

    Well, I was complimenting a bit too quick.

     

    The option works, if my scripts (script extension) post an error using Log.Error(). Then the run pauses in the next line, OK.

     

    If You use error message event handling, it will not help You. I use it to suppress certain technical or known functinoal errors.

    When some other error occurs during the test run (which is what the request is basically aiming at), the test run stops inside my error event handling routine. This does not help at all.

     

    Even worse, for some kinds of errors suppressed in the error message handler, the test run stops in some infrastructure routine, making this completely useless: The infrastructure class provides my script extensions with access to TC internal libraries as Options, Dll, Win32Api. So when an error occurs in a script extension and is suppressed in the message handler, the run stops when the script extension calls the standard script with this class.

     

    The approach could work perfectly, if it would be possible to prevent the pausing for specific code regions.

    Right now, it does not help.

     

     

  • Hello,

     

    TestComplete has a special method that allows pausing script execution at a desired point - Runner.Pause. Documentation on this method can be found in the Pause Method help topic. This method can be called in the test code itself as well as in the OnLogError event handler code.

     

    So, generally the requested functionality exists in TestComplete.

  • Manfred_F's avatar
    Manfred_F
    Regular Contributor

    OK.

    How would I configure the System to automatically call Runner.Pause in case a runtime error occurs?

    As an example, take a typo in a script: a variable Name is misspelled.

     

    What do I have to do to have Runner.Pause called instead of showing up the error Dialog?