Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hblVK-0000Ur-8S for pgadmin-hackers@arkaria.postgresql.org; Fri, 14 Jun 2019 12:40:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hblVH-0001EZ-Bi for pgadmin-hackers@arkaria.postgresql.org; Fri, 14 Jun 2019 12:40:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hblVG-00018C-Qr for pgadmin-hackers@lists.postgresql.org; Fri, 14 Jun 2019 12:40:23 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hblVD-0002ZU-7w for pgadmin-hackers@postgresql.org; Fri, 14 Jun 2019 12:40:21 +0000 Received: by mail-qt1-x843.google.com with SMTP id n11so2228792qtl.5 for ; Fri, 14 Jun 2019 05:40:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dA/sexsS8iNN2QtIRkPzmjJLsWCwYqGlKDlmTt5N6vA=; b=g7c1RJKGUEVFLbL7VWLKY6XdRDdlfZ/716nVp/TbbeHhby4+pueHioSGer7yNRBT6x BwZm+uUXvLt0CrFg3Axz7GM5BkfjM5ymLPpGUYSWX/b32lSEUPFxQ+u5DohaHca5xRar GUN2PYzeWad0iUFq4q01cq1hm4pMaKI512ViohZ0wIhKnGGLO5tBAlPPCDx/I5qUOgsy Plhye0IitnIqKq0DX10GEGb6u1GFCPE/LhQqXo9wwjiCfLs/6qy09uE8QyShEHy6+XhP inf/k3ySUWGM+N+KGyiKr/lr0gSWqeoVg0gxNJ+0MtbYkUKu156GmQ3JQU9N008sZ5Ej ofag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dA/sexsS8iNN2QtIRkPzmjJLsWCwYqGlKDlmTt5N6vA=; b=bs+9MMtdPnTk+rUOqsnblbGKVMAw41pgdr1ty+Q7cq9eQsiiKQbvPZ5EGRKnFkWi7+ qsHM41dLrTvhIXjA9DmDvtRRz1NeCXrsAumRg0vFlzIQ2qLKwDlBXFE+dCLxk5+bjRyA 73YdvYZ6MfAqOjJRxxwKHWdugl8L11At8y3J2LFF8JklkycP8mf0/7ufe3ZE9+lYVaL0 ABA4Ryou/gu5/MXdiDhsCjHdkjpVOnVcZ/0Y3FoZfjhQz8RZl3N/Udtht+zxtzoTgWn9 ge8lZ37oR20JxEdZ4httQf1zF1euV+LbfMpdyKz/A4U85izYTHMzyx+Nk0Fg15EWokRn HaYQ== X-Gm-Message-State: APjAAAUFWB1vb7IAulZBjq4s2uHLk12HBzb/aF4RmzpLND4W+zu+WxNV FyDSTJTymVWg/w/DECJpp858TjfSk3EaAvc5TITjhjWI0qOr6w== X-Google-Smtp-Source: APXvYqx7vxl2k2LsZUvTYMn7JAkFnMQdHH1wgXLLaiPaBKqlQn5qXWHrU9NF480Z26spr8eJcysG+sFucFkTmMe4f+w= X-Received: by 2002:a0c:9b94:: with SMTP id o20mr8024160qve.56.1560516017629; Fri, 14 Jun 2019 05:40:17 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Akshay Joshi Date: Fri, 14 Jun 2019 18:10:06 +0530 Message-ID: Subject: Re: [pgAdmin4][Patch]: Feature #4202 Implement new framework to test Reverse Engineering SQL To: Dave Page Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000e5c3ca058b47f2f0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000e5c3ca058b47f2f0 Content-Type: text/plain; charset="UTF-8" On Fri, Jun 14, 2019 at 1:59 PM Dave Page 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 >> "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" >> : ""*. >> - Create a output file with any name in the same directory where the >> JSON file resides and specify the parameter "*expected_sql_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* --000000000000e5c3ca058b47f2f0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


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

On Thu, Jun 13, 2019 at 12:52 PM Akshay Joshi <<= a href=3D"mailto:akshay.joshi@enterprisedb.com" target=3D"_blank">akshay.jo= shi@enterprisedb.com> wrote:
Hi Hackers

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

How it works: Attached patch contains the generic framework t= o 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/s= erver_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 &q= uot;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 i= t.

Nice!

A few comments:

- The scenario name should be &= quot;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?
=C2=A0 =C2=A0
=C2=A0= =C2=A0Will fix the above.=C2=A0
- How do we r= un only the re_sql tests? I tried the obvious ways (e.g.=C2=A0python runtes= ts.py --pkg regression.re_sql.tests.test_resql.ReverseEngineeringSQLTestCas= e) but got errors. Please add an example to web/regression/README.

=C2=A0 =C2=A0It 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=C2=A0 "re= gression.re_sql.tests", will continue working on this.
=C2= =A0=C2=A0
- Once we have a way to run these = tests only, please add a "make check-resql" target to the Makefil= e.
- Can the expected output be formatted in the JSON such that i= t doesn't use \n, but uses regular line breaks? That would make it easi= er to copy/paste.

=C2=A0 = =C2=A0 I have tried that during implementation, but JSON does not allow lin= e-breaks.

Thanks.
<= br>
--
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
--000000000000e5c3ca058b47f2f0--