Forum Discussion

Rajdeephere's avatar
Rajdeephere
New Contributor
11 years ago

Issue with GeneralEvents_OnStopTest

Hi All,

 

I am using below piece of code for saving the test result in HTML format  but at the end of the run it is thwoing VB error. 

 


Sub main()
Call TestedApps.RunAll
call Runner.CallMethod("Login_Call.Login")
call GeneralEvents_OnStopTest(Sender)
Call TestedApps.CloseAll
End sub

 

 

Sub GeneralEvents_OnStopTest(Sender)
If Project.TestItems.Current.Name = "ProjectTestItem1" Then     ---> here i am getting VB error
Call Log.SaveResultsAs("C:\Results", lsHTML)
Log.Message "Hello"
End If
End Sub

 

Attached is the snapshot  of property defined at project level.

 

ProjectProperty.GIF

 

Please suggest.!

 

Regards

 

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    Sub main()
    Call TestedApps.RunAll
    call Runner.CallMethod("Login_Call.Login")
    'Not sure why you are calling this? It should fire at the end of your script.
    'call GeneralEvents_OnStopTest(Sender)
    Call TestedApps.CloseAll
    End sub

     

    Seems to work for me in testing, but I don't see why you are manually calling the GeneralEvents_OnStopTest.

    • Rajdeephere's avatar
      Rajdeephere
      New Contributor

      Hi ,

       

      Thank you for the review.

       

      I have one query, how the  main function will recognize "GeneralEvents_OnStop" method which i kept in "CommonFunction Script"

       

      Sorry i am new to TestComplete. So i dont know how to use "GeneralEvents_OnStop"

       

      Thanks