Micro Focus QTP (UFT) Forums
Is Reporter ignoring the status of steps? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Is Reporter ignoring the status of steps? (/Thread-Is-Reporter-ignoring-the-status-of-steps)



Is Reporter ignoring the status of steps? - dlaureano - 12-04-2012

I've tried to use the Reporter.ReportEvent mic Fail to write the status of step only If Step has failed. If no error occurs "MicDone" should be use or simply continue with the next step.

My problem is that the Script is not recognizing the If Statement and is writing the Reporter.ReportEvent mic Fail even if the Result of the Status is Passed.

Any of your excellent help will be appreciated. Thanks in advance.

Here is my code:
Code:
For x = 1 to datatable.LocalSheet.GetRowCount
             datatable.SetCurrentRow x
    Browser("QNXT 4.62.00.061").Page("QNXT 4.62.00.061").Link("Benefit Plans").Click
        Browser("QNXT - Benefit Plan Module").Page("QNXT - Benefit Plan Module").Frame("Frame").WebList("ddlMainProgram").Select datatable("DT_ProgramCategory", "Action1")

   If Reporter.RunStatus = micFail and x = datatable.Value ("DT_ID") Then
   Reporter.ReportEvent micFail, "Custom Step", "Program Category Failed in step # " & x
   Else
Reporter.ReportEvent micDone, "Passed", "Passed"
   End If

             Browser("QNXT - Benefit Plan Module").Page("QNXT - Benefit Plan Module").Frame("Frame").WebList("ddlProgram").Select datatable("DT_Program", "Action1")

Wait 1

             Browser("QNXT - Benefit Plan Module").Page("QNXT - Benefit Plan Module").Frame("Frame").WebList("ddlBenefitPlan").Select datatable("DT_BenefitPlan", "Action1")



RE: Is Reporter ignoring the status of steps? - harishshenoy - 12-04-2012

Hi ,

Try using the below ,

if Reporter.RunStatus = "micFail" then

OR
if Reporter.RunStatus = 1 then ''// here 1 means micfail


Thanks,
Harish Shenoy


RE: Is Reporter ignoring the status of steps? - dlaureano - 12-06-2012

Thanks for your help. It partially works.

Since the test is inside a For Next Loop the Reporter.RunStatus = 1 works until one step fail. If one step fail the other records failed too.

Is there any way to reset the Reporter.RunStatus after each loop? or maybe a workaround to avoid all records fail after the first error.

Thanks,
Danny Laureano


RE: Is Reporter ignoring the status of steps? - Jay - 06-05-2014

the best way to use err.number <> 0. in case of any error err.number value would be anything other then 0.

Once you are at the end of the loop you can use err.clear to set it default.