Forum Discussion
AlexeyK
Alumni
14 years agoGuillaume,
You can give the last item some unique name and, within the OnStopTest event handler, check whether the event is triggered for the last item or not. You can use code like this --
Sub GeneralEvents_OnStopTest(Sender)
' Get the current test item
Set CurrentItem = Project.TestItems.Current
' Get the last test item
IndexOfLastTestItem = Project.TestItems.ItemCount - 1
Set LastItem = Project.TestItems.TestItem(IndexOfLastTestItem)
' Check names
If CurrentItem.Name = LastItem.Name Then
' The test item is the last one
' Clean up...
Else
' The test item is not the last one
' Don't clean up...
End If
End Sub