Forum Discussion

varaprashad45's avatar
varaprashad45
Occasional Contributor
11 years ago

Test complete sometimes crashing when “Refresh” method is called on the parent object

Test complete sometimes crashing when “Refresh” method is called on the parent object to get the properties of immediate Childs at runtime. Please go through the sample code cited below. In the below highlighted line of code the for Find method where silver light application is getting crashed.



Please let us know how to handle this application crash issue:

Tools and S/w versions:

Testcomplete version :9.31

Silverlight version : 5.1.20513.0






Sample Code to search a button and to perform click operation on it:


Function SlvButtonClicker(ByVal sProperty, ByVal sValue, ByVal sField)' <@as> Boolean



Dim arrProperty,arrValue,iChildDepth

Dim bFound



iChildDepth = 40   ' *HardCoded - Child Search Depth

bFound = false



If IsNull(sValue) or sValue=""  or IsNull(sField) or sField="" then



  log.Error("Invalid parameters..")

  SlvButtonClicker = False

  Exit Function

 

End if



arrProperty = Split(sProperty, "|" )                  'To identify an object

arrValue =  Split(sValue, "|" )



If Ubound(arrProperty) = Ubound(arrValue) Then

  oProcess.Refresh

  Set oObject = oProcess.Find(arrProperty, arrValue, iChildDepth, False)

  If oObject.exists Then

    log.Message(sField &": object found")

    bFound = True

  Else

     bFound = False

  End If

 

  If bFound Then

    If oObject.enabled  Then

      Log.Message(sField &": is enabled..") 

    

      oObject.Click

      SlvButtonClicker =  true                          

    Else

     

      SlvButtonClicker = false

    End If

   

  End If



End If



End Function




6 Replies

  • varaprashad45's avatar
    varaprashad45
    Occasional Contributor


    Hi Tanya,



    Thanks for your reply.



    As you suggested, i tried to execute script using DbgServices and launch tested applicaition to trace the exceptions and to obtain call stack data with the below piece of code. i am getting the "First chance exception" error log.



    Please refer the attached screen shot for the log i got when executed the below code and kindly help how to resolve this error mentioned above to proceed further and to find out the reason for application crash.





    Sub Main

      Set launchTestedApplication = DbgServices.LaunchTestedApplication

     

      DbgServices.Options.EnableEvents = True

     

      DbgServices.Options.ActiveExceptions = True

      Log.Message("Exceptions are being traced.")

     

     

      ''''To login into application with valid credintials

      call ApplicationLoginUser("vbulus1","Setup2000")





    End Sub

    Function ApplicationLoginUser(ByVal sUserName, ByVal sPassword)

      Dim oApp,oUserName,oPassword,oLogin,oLogout

      Dim arrProp,arrUNVal,arrPwdVal,arrLBVal,arrLOVal

      Dim iChildDpt,bFound



      iChildDpt= 20

      arrProp = Split("Name|Visible","|")



      arrUNVal=Split("UIAObject(""UserId"")|True","|")

      arrPwdVal=Split("UIAObject(""Password_2"")|True","|")

      arrLBVal=Split("UIAObject(""Login_2"")|True","|")

      arrLOVal = Split("UIAObject(""Log_out"")|True","|")

      Set oApp = oProcess

      Set oUserName = oApp.Find(arrProp,arrUNVal,iChildDpt,False)

      Set oPassword= oApp.Find(arrProp,arrPwdVal,iChildDpt,False)

      Set oLogin = oApp.Find(arrProp,arrLBVal,iChildDpt,False)

      delay(2000) 

      IF oUserName.Exists Then

        oUserName.SetValue sUserName

        oPassword.SetValue sPassword

        Delay(3000)

        If oLogin.Exists THen

          oLogin.Click

          Delay(15000)

          oApp.Refresh

          Set oLogout = oApp.Find(arrProp,arrLOVal,iChildDpt,False)

          IF oLogout.Exists Then

            bFound = True

            arrPUVal = Split("UIAObject(""Popup"")|True","|")

             Set oPopup =  oApp.Find(arrProp,arrPUVal,iChildDpt,False)

        

             If oPopUP.Exists Then

              If oPopup.Child(0).ObjectIdentifier = "BusyChildWindow" Then

                While oPopUP.Child(0).Exists

                  Delay(1000)

                  oApp.Refresh

                wEnd

               

              End If    

             End IF

              Set oPopup =  oApp.Find(arrProp,arrPUVal,iChildDpt,False)

              If oPopUP.Exists Then

                Log.Warning("Unable to Load Work Flow module")

                arrOkVal = Split("UIAObject(""Ok"")|True","|")

               

                Set oOK = oPopup.Find(arrProp,arrOkVal,iChildDpt,False)

                If oOK.Exists THen

                  oOK.Click

                End If

             End If  

          Else

            bFound = False

          End if

        Else

          Log.Error("Login Button Not found")

          bFound = False

        End if

      Else

         Log.Error("Login Page Not found")

         bFound = False

      End if

      ApplicationLoginUser = bFound

      Set oApp = Nothing

      Set oUserName = Nothing

      Set oPassword= Nothing

      Set oLogin = Nothing

      Set oLogout = Nothing

    End Function



    Thanks & Regards,

    Vara Prasad


    • MulgraveTester's avatar
      MulgraveTester
      Frequent Contributor

      varaprashad45,

       

      Did you ever solve this? I have the same issue with my application. After closing a form I do a sys.refresh and the test application crashes.

       

      If I pause the script after closing the form the test application remains stable. It is definately the sys.refresh that is causing the application to close.

      If I remove sys.refresh the next action causes the application to close because most actions include a refresh option that is on by default.

       

      My application "closes" and the TestComplete log shows "process crashed". Because this is like a close, rather than a real crash, there is nothing in the windows logs. Did your application close or crash?

       

      Do you use name mapping or do you have project variables that reference objects that have been destroyed?

       

      An update on your situation may help me fix my similar issue.

       

      Thanks.