If I place the teardown at the test case level then the code works fine, but if I try to move it to a global teardown at the suite level I get an error. "Object variable or With block variable not set"
Code: Select all
Public Sub CheckForFailuresThenSnapshot()
'HowTO: GeT ranorex error counts converted from C example
Ranorex.Core.Reporting.TestReport.SaveReport()
Dim SuiteACT As Object = Ranorex.Core.Reporting.TestReport.CurrentTestContainerActivity
Dim blocked As Integer = SuiteACT.TotalBlockedCount
Dim TC_blocked As Integer =CInt( SuiteACT.TotalBlockedTestCaseCount)
Dim ErrorCT As Integer =CInt( SuiteACT.TotalErrorCount)
Dim Failed As Integer = CInt(SuiteACT.TotalFailedCount)
Dim TC_Failed As Integer = (SuiteACT.TotalFailedTestCaseCount)
Dim SuccessCT As Integer = CInt(SuiteACT.TotalSuccessCount)
Dim TC_SuccessCT As Integer = CInt(SuiteACT.TotalSuccessTestCaseCount)
Dim msg As String ="Blocked:" & blocked.ToString() & " TC_Blocked:" & TC_blocked.ToString() & " ErrorCT:" & ErrorCT.ToString()
Msg &= " Failed:" & Failed.ToString() & " TC_Failed:" & TC_Failed.ToString() & " SuccessCT:" & SuccessCT.ToString()
msg &= " TC_SuccessCT:" & TC_SuccessCT.ToString()
Report.Info("User",msg)
If ErrorCT >0 Or TC_Failed >0 Or Failed >0 Then
Try ' do snapshot of OM DOM
Report.Snapshot(ReportLevel.Info, "User", "", repo.DellOpenManage.Self, new RecordItemIndex(2)) ' OM DOM
Catch ex As Exception
Report.Log(ReportLevel.Warn, "Module", "(Optional Action) " & ex.Message, New RecordItemIndex(2))
End Try
End If
End Sub
Code: Select all
Dim blocked As Integer = SuiteACT.TotalBlockedCount
Could someone please offer some pointers on this?