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?
- EnergizerBunny11 years agoContributor
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_F11 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 :-((
- HKosova11 years ago
Alumni
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.
- ringraham11 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.