1
votes

I am running DB queries in the UFT framework. During the execution, if the data is deleted in the backend tables, then UFT will throw the error message box as like below. I want to skip the error and continue and report the error description in the xml result sheet.

Error Message:

Run Error: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record

I am trying to add by recovery scenario by calling error function and proceed to next step. My error function is as like below:

Function RecoveryFunction1(Object, Method, Arguments, retVal)
If err.number<>"" then
   error1=err.description
   Reporter.reportevent micwarning,"Error ocurred:","","Error Details: "&error1&"
End If
End Function

I have added the above function in the function library and associated the recovery scenario in the test settings. But still error message is throwing up.

Please help me to handle the error message during run time instead of writing for each and every function 'on error resume next' statement.

1
Have you tried putting the suspect code under On Error Resume Next? - Pankaj Jaju
No.. I dont want this add in each and every function ..that's the reason, i have not tried the code.. I want this to work with the framework which is using right now.. I tried this with recovery scenario but not working.. - Vidya Hiremath
You can't use RS to hide code issues ... RS are used when the error happens in the application. Do you expect each function to fail because of DB issues? - Pankaj Jaju
No.. If records are not there in the table then run time error will be there. Now I have checked by adding one line of code to check whether the data is there or not. This is working for me. - Vidya Hiremath
But what I am expecting as like Test Setting --> On error resume next step.. If i do this, during run time , If any error happens my test run won't stop. It will continue but report won't show the step as failed and it won't report the error in the result report sheet. I am expecting this I can handle through recovery sccenario - Vidya Hiremath

1 Answers

0
votes

You need to change the way you request the view of the database so that later modifications or deletions will not affect your query.

Take a look at the docs for the ADO Recordset. It specifies different cursor types, some of which will allow you to keep a static view of the data as it was when you ran the query, while others give live views. I'm not sure which one is best for your specific use case, so you should experiment and see which one works for you.

Failing that, you can try a move heavy-handed approach which is to begin a database transaction before you do your select, which should isolate your data processing from any external changes. However, that may be undesirable if your process takes a long time, as it may lock out other processes until you end your transaction and yield the locks on the rows you're looking at. Again, it depends on your specific database environment and the systems that interact with it.