Forum Discussion

Jovani_smo's avatar
Jovani_smo
Occasional Contributor
2 years ago

Command refresh in PostgreSQL with TestExecute

I have a script where I use the refresh command to update data in PostgreSQL after doing an update and it works correctly in TestExecute 14. However, when running this script with TestExecute in version 15, it returns an error. What could it be?

  • Hi... Sorry for the delay in answering, I was doing tests and simulations here...
    The version of TestComplete we use in development is 14.10.1042.7 x64.
    The versions of TestExecute we have running here are 14.10.1042.11 x64 and 14.91.341.11 x64...

    The problem happens on the machine that uses TestExecute 14.91.341.11 x64.
    I did tests with TestComplete 15.48.6.7 and it ran just fine...

    I managed to make it work on TestExecute 14.91.341.11 x64 by changing Refresh to Requery:

    http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/ADODB_TCustomADODataSet_Requery.html

     

    Before:

    oQueryMassa.Refresh;

    After:
    oQueryMassa.Requery;

     

    Using Requery worked correctly in all versions of TestExecute. After all, the error wasn't related to PostgreSQL.

     

    Thank you for your help.

    • Jovani_smo's avatar
      Jovani_smo
      Occasional Contributor

      Hello... simply breaks the test, aborts the routine and goes to the next one...

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You have an unexpected window called 'Confirm' appearing after refresh method. The dialog that appears, is that from your application? You might have to automate that.

     

    • Jovani_smo's avatar
      Jovani_smo
      Occasional Contributor

      Hello... so, the confirmation screen is showing because it is not refreshing the database... the confirmation screen shows the order number, but as the database has not been refreshed, it breaks the test.

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    The Refresh method will update the running processes as shown here,

     

    Are you automating PostgreSQL?

    • Jovani_smo's avatar
      Jovani_smo
      Occasional Contributor

      I'm automating a Delphi application that uses PostgreSQL... I update the database and I'm using the Refresh method after that.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Got it.

     

    If the value has been updated in the database, has it not been reflected in the application straight away? Calling a Refresh on the application, I don't think will retrieve the updated data. 

     

    • Jovani_smo's avatar
      Jovani_smo
      Occasional Contributor

      Well that's right... I'm calling the Refresh method just to update the value in the application... and it works fine when I use it with TestExecute 14, the problem happens when I use it with TestExecute 15.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I see no reason why calling Refresh will cause an issue!

     

    Does it work, when using the latest version of TestComplete?

    • Jovani_smo's avatar
      Jovani_smo
      Occasional Contributor

      Hi... Sorry for the delay in answering, I was doing tests and simulations here...
      The version of TestComplete we use in development is 14.10.1042.7 x64.
      The versions of TestExecute we have running here are 14.10.1042.11 x64 and 14.91.341.11 x64...

      The problem happens on the machine that uses TestExecute 14.91.341.11 x64.
      I did tests with TestComplete 15.48.6.7 and it ran just fine...

      I managed to make it work on TestExecute 14.91.341.11 x64 by changing Refresh to Requery:

      http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/ADODB_TCustomADODataSet_Requery.html

       

      Before:

      oQueryMassa.Refresh;

      After:
      oQueryMassa.Requery;

       

      Using Requery worked correctly in all versions of TestExecute. After all, the error wasn't related to PostgreSQL.

       

      Thank you for your help.

  • Jovani_smo's avatar
    Jovani_smo
    Occasional Contributor

    Sorry, I forgot to mention it before, I'm using PostgreSQL 14.2 database and the error that returns in the database log is the following:

    ERROR: column c.relhasoids does not exist at character 245
    STATEMENT: select n.nspname, c.relname, a.attname, a.atttypid, t.typname, a.attnum, a.attlen, a.atttypmod, a.attnotnull, c.relhasrules, c.relkind, c.oid, pg_get_expr(d.adbin, d.adrelid), case t.typtype when 'd' then t.typbasetype else 0 end, t.typtypmod, c.relhasoids, attidentity from (((pg_catalog.pg_class c inner join pg_catalog.pg_namespace n on n.oid = c.relnamespace and c.oid = 1608172) inner join pg_catalog.pg_attribute a on (not a.attisdropped) and a.attnum > 0 and a.attrelid = c.oid) inner join pg_catalog.pg_type t on t.oid = a.atttypid) left outer join pg_attrdef d on a.atthasdef and d.adrelid = a.attrelid and d.adnum = a.attnum order by n.nspname, c.relname, attnum

    Remembering, I have two other machines with TestExecute in version 14, using the same version of PostgreSQL and these two machines do not return an error... it only returns an error on the machine that I have TestExecute in version 15 running.