I have a method that is looping through previously passed tests in a test set and retreiving the last run information and placing that information into an array. I keep having the issue when I am setting my Run object to the TSTest.LastRun object. I keep getting a not set to an instance of an object error. Cant find the issue. I have verified that there are runs on that certain TSTest object. Code...
Public Shared Function retrievePreviousResults(hpqc As TDConnection, listOfPassedTests As ArrayList) As ArrayList
Dim stepFactory As StepFactory
Dim runStepsList As List
Dim designDelimeter As String = ":::"
Dim previousTestsArrayList As New ArrayList
For Each tsTest As TSTest In listOfPassedTests
Dim testID As String = tsTest.TestId
Dim testName As String = tsTest.Name
Dim run As Run = tsTest.LastRun 'ISSUE IS HERE. Run object always is null after this statement'
stepFactory = run.StepFactory
runStepsList = stepFactory.NewList("")
Dim totalSteps As Integer = runStepsList.Count
Dim acutalLastStep As [Step] = runStepsList.Item(totalSteps)
Dim actualLastRunStep As String = acutalLastStep.Field("ST_ACTUAL")
Dim stringBuilder As New System.Text.StringBuilder
stringBuilder.Append(testID)
stringBuilder.Append(designDelimeter)
stringBuilder.Append(testName)
stringBuilder.Append(designDelimeter)
stringBuilder.Append(actualLastRunStep)
Dim finalStepInformation As String = stringBuilder.ToString()
previousTestsArrayList.Add(finalStepInformation)
Next
Return previousTestsArrayList
End Function