Forum Discussion

JackSparrow's avatar
JackSparrow
Frequent Contributor
8 years ago

Test Complete getting crashed due to DB Error

Hi All ,

 

My test complete used to crash rarely but now a days it started frequently , so while I was trying to find the root cause I understood that if there is a db error(like the column name is wrong or query is wrong or index etc) in one execution then the test complete getting crashed.

 

In next execution, the same db execution gets executed and if I execute immediately again test complete gets crashed , every 2 nd execution test complete will crash.

 

Sometimes if I restart my machine twice it gets solved .

 

Is there any other way to stop this , if I use try catch exception[python] does it stops getting crashed.

 

The Code[Python] which am using is

  AConnection = ADO.CreateADOConnection()
  # Specify the connection string
  AConnection.ConnectionString = "Provider=MSDASQL;" + "DRIVER=Ingres; " + "Data Source=LMK2 penelope;" + "SERVERTYPE=INGRES;" + "Database=itvtestauto;"
  # Suppress the login dialog box
  AConnection.LoginPrompt = False
  AConnection.Open()
  # Execute a simple query
  RecSet  =  AConnection.Execute_('select short_name,demo_code from demo')
  RecSet.MoveFirst();
  data_container = []
  r= []
  while not RecSet.EOF:  
    rows = RecSet.Fields.Item["short_name"].Value
    data_container.append(rows)
    RecSet.MoveNext()  
  AConnection.Close()
  Log.Message(str(data_container))
  dbcount = len(data_container)
  Log.Message("The Database Count of the List is  :"+str(dbcount))

 

  • Sounds like an issue to raise with the support staff directly.

    https://support.smartbear.com/message/?prod=TestComplete

     

    Something else you might want to try is, after you're finished with your ADO objects, try setting the variables to "null" to just clear them out of memory.  TestComplete does have some of the garbage collection going on in it but it's not 100% reliable. Null your objects and see if you still get the crash.

  • JackSparrow's avatar
    JackSparrow
    Frequent Contributor

    Hi all,

     

    I used try catch exception [Python] still its gets crashed every second execution

     

      AConnection = ADO.CreateADOConnection()
      AConnection.ConnectionString = "Provider=MSDASQL;" + "DRIVER=Ingres; " + "Data Source=LMK2 penelope;" + "SERVERTYPE=INGRES;" + "Database=itvtestauto;"
      AConnection.LoginPrompt = False
      try:
        AConnection.Open()
      except AConnection.Errors as excp:
        Log.Error("DB exception"+ str(excp))
        AConnection.Close()
      try:
          AConnection.Open()
          RecSet  =  AConnection.Execute_('select short_name,demo_code from demo')
          RecSet.MoveFirst();
          data_container = []
          r= []
          while not RecSet.EOF:  
            rows = RecSet.Fields.Item["short_name"].Value
            data_container.append(rows)
            RecSet.MoveNext()  
      except AConnection.Errors as e:
            Log.Error("DB exception"+ str(e))
            AConnection.Close()
      else:       
          AConnection.Close()
          Log.Message(str(data_container))
          dbcount = len(data_container)
          Log.Message("The Database Count of the Demography List is  :"+str(dbcount))
    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Sounds like an issue to raise with the support staff directly.

      https://support.smartbear.com/message/?prod=TestComplete

       

      Something else you might want to try is, after you're finished with your ADO objects, try setting the variables to "null" to just clear them out of memory.  TestComplete does have some of the garbage collection going on in it but it's not 100% reliable. Null your objects and see if you still get the crash.

      • JackSparrow's avatar
        JackSparrow
        Frequent Contributor

        tristaanogre

         

         

        I think assigning the object to Null have helped now its working .Since I have made the mistake intentionally to check does the test complete will crash or not  and executed 70 times and  the test complete did not get crashed :)