Forum Discussion
While both answers could possibly work, I was hoping for something in code that would allow one to catch an error, such as:
try{
...
}
catch (Exception e)
{
... (ignore error)
}
Most languages have such a construct to catch ANY exception. Is there no such thing in TestCompletes scripting language?
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.
- Manfred_F9 years agoRegular Contributor
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
- ringraham9 years agoContributor
Hmm, not sure about the comment about the limitation of the scripting language. I was using the C# script format which, I thought, was supposed to be based on javascript. I know for sure that javascript has try/catch/finally baked in. I'll freely admit that I now nothing about VB/VBA.
Related Content
Recent Discussions
- 6 hours agoMW_Didata