Re: [pgAdmin4][Patch]: Feature #4202 Implement new framework to testReverse Engineering SQL - Mailing list pgadmin-hackers

From Akshay Joshi
Subject Re: [pgAdmin4][Patch]: Feature #4202 Implement new framework to testReverse Engineering SQL
Date
Msg-id CANxoLDdbQV-PP16GQUnCz0Ki8xt_P-T3DDPZEq=R6YQNxAiUQQ@mail.gmail.com
Whole thread Raw
In response to Re: [pgAdmin4][Patch]: Feature #4202 Implement new framework to testReverse Engineering SQL  (Dave Page <dpage@pgadmin.org>)
Responses Re: [pgAdmin4][Patch]: Feature #4202 Implement new framework to testReverse Engineering SQL
List pgadmin-hackers


On Fri, Jun 14, 2019 at 1:59 PM Dave Page <dpage@pgadmin.org> wrote:
Hi

On Thu, Jun 13, 2019 at 12:52 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi Hackers

I have implemented the new test framework to test the Reverse Engineering SQL. I have integrated it as a part of API/Regression test suite. It will work when we run all the test cases or module wise test case.

How it works: Attached patch contains the generic framework to read all the JSON files from the tests->version based (example 9.6_plus, 10_plus or default) folder. Run all the test scenarios present in the JSON file in sequential order.

Format of the JSON file is mentioned in "<path_of_source>web/pgadmin/browser/server_groups/servers/databases/casts/tests/default/test.json"

For expected SQL we will have following two options:
  • Provide the expected sql in scenario itself as parameter "expected_sql" : "<SQL>".
  • Create a output file with any name in the same directory where the JSON file resides and specify the parameter "expected_sql_file": "<name of the file>"
Attached patch contains both the above mentioned examples.

Please review it.

Nice!

A few comments:

- The scenario name should be "Reverse Engineered SQL Test Cases"
- After the scenario name is output, can we output a \n so the next line isn't appended to the name?
   
   Will fix the above. 
- How do we run only the re_sql tests? I tried the obvious ways (e.g. python runtests.py --pkg regression.re_sql.tests.test_resql.ReverseEngineeringSQLTestCase) but got errors. Please add an example to web/regression/README.

   It is not a pgadmin module and we have kept it in regression folder, so will have to change the existing code. I have tried but facing issues when run only  "regression.re_sql.tests", will continue working on this.
  
- Once we have a way to run these tests only, please add a "make check-resql" target to the Makefile.
- Can the expected output be formatted in the JSON such that it doesn't use \n, but uses regular line breaks? That would make it easier to copy/paste.

    I have tried that during implementation, but JSON does not allow line-breaks.

Thanks.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


--
Thanks & Regards
Akshay Joshi
Sr. Software Architect
EnterpriseDB Software India Private Limited
Mobile: +91 976-788-8246

pgadmin-hackers by date:

Previous
From: Dave Page
Date:
Subject: Re: [pgAdmin][RM4329] Initialization error when parameterisedfunctions debugged in parallel in two separate tabs
Next
From: Phil Sevenants
Date:
Subject: usability issues