cancel
Showing results for 
Search instead for 
Did you mean: 

Return to end of the function on any error during execution of script

New Contributor

Return to end of the function on any error during execution of script

We have one function for calling all the functions to be executed where all functions to be executed are called via Excel.

 

As it is only one test item, one log is generated at the end. Do we have an option to split the logs for each row in excel?

 

And also, during the script execution, if the object is not found run time error occurs and error is posted in log file causing the execution to stop. And, if the entire block is enclosed in try-catch block, on run-time error the control is not passed to catch block.

 

How can we handle such situations and continue the script execution?

3 REPLIES 3
Community Leader

Re: Return to end of the function on any error during execution of script

->>>>
"We have one function for calling all the functions to be executed where all functions to be executed are called via Excel"

 

I know that in some cases it is necessary to call functions from excel file but from experience I know that it would be better for you to switch to calling test functions by "Test Items" explorer. This really solves a lot of problems automatically.

 

->>>>
"As it is only one test item, one log is generated at the end. Do we have an option to split the logs for each row in excel?"

 

I have an idea about that:

 

In the "OnStartTest" event, use the name of the function called from excel and then make a folder out of it using

 

Log.CreateFolder

 

and pack all the logs into this folder using "OnLog*" events.

Maybe it'll help somehow, let me know.

 

->>>>
"And also, during the script execution, if the object is not found run time error occurs and error is posted in log file causing the execution to stop. And, if the entire block is enclosed in try-catch block, on run-time error the control is not passed to catch block."

 

try{

} catch(e) {
}

This may not work here because it relates to the "syntax error" control of e.g. JavaScript.

 

The error that is not "syntax error" but "internal Testcomplete error". You can handle it with the event e.g. "OnLogError".

 

In TestComplete you can set the variable "On error" to Continue Error but this is done by the project explorer.

 

You can do this by adding one function in the explorer -> in this function you will use the function containing the call

 

aqObject.CallMethod;

 

and with this you will get the names of the functions to run. This requires a little more work, but if you need help, let me know.

Community Hero

Re: Return to end of the function on any error during execution of script

Hi,

 

> Do we have an option to split the logs for each row in excel?

Try the aqTestCase's .Begin()/.End() methods and see if this is what you are looking for.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Community Manager

Re: Return to end of the function on any error during execution of script

Thanks for your suggestions, Wamboo, AlexKaras!

 

@Sindu, was the issue resolved? Please share the solution you decided to use.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors