Forum Discussion
None of the original TestComplete scripting languages provide a strong error handling capability. This is not the fault of TestComplete, but a limitation of the script languages.
The latest version of TestComplete 11.1 now provides Python scripting. It appears that Python supports the try..catch method.
Unfortunatly all of our existing test scripts are in VBscript. We might try a new project in Python.
We used to use TestPartner as a test tool until MicroFocus retired it.. It used VBA and had a very strong global on error handler.
The ability to apply VBA or VB would be an enormous advantage, not only concerning error handling.
VB/A is typesafe and gives You an error message for undeclared variables or typos BEFORE running the code. Using vbs in TC, I find my typos at runtime instead, which is minutes or even hours later :-((
- HKosova9 years agoSmartBear Alumni (Retired)
Manfred_F wrote:Using vbs in TC, I find my typos at runtime instead, which is minutes or even hours later :-((
Manfred_F: I believe adding Option Explicit at the top of each VBScript unit will flag typos in variable names and require that you Dim all variables.
- Manfred_F9 years agoRegular Contributor
Hi Helen,
thank You for Your msg.
I'm already using Option Explicit in each module.
It gives me a runtime error as soon as an undeclared element is addressed DURING execution, that's fine.
The shortfall is: it may take TC an hour of until the test run gets to that location, and then the run fails.
I'd need a "compile-time" errror message, or at least a runtime error when starting the test run.
I've also tried the "check syntax" function from the context menu of a module, but it doesn't react on unknown elements. Just try it: enter "a=b" into a vb function and check => no result, even with Option explicit.
Kind Regards,
Manfred
- Colin_McCrae9 years agoCommunity Hero
C# Script does indeed support try/catch. I'm using it right now.
With the limitation that try/catch does not work with object errors (such as "Object does not exist") which is rather annoying. So I have my own "helper" functions to validate objects before I try and use them.
When using VBScript, I just turn off ALL the error handling and do it all via my own code.
Related Content
Recent Discussions
- 5 hours agoMW_Didata