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 1hcl3v-0002MZ-MC for pgadmin-hackers@arkaria.postgresql.org; Mon, 17 Jun 2019 06:24:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hcl3s-0005R1-Ku for pgadmin-hackers@arkaria.postgresql.org; Mon, 17 Jun 2019 06:24:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hcl3s-0005Qu-7S for pgadmin-hackers@lists.postgresql.org; Mon, 17 Jun 2019 06:24:12 +0000 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hcl3o-0002Pp-Hp for pgadmin-hackers@postgresql.org; Mon, 17 Jun 2019 06:24:11 +0000 Received: by mail-qt1-x841.google.com with SMTP id d17so4455339qtj.8 for ; Sun, 16 Jun 2019 23:24:08 -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=Rvb5NNaGSYYn1or75b3aK2BlDR/RDJgJ+OaGXdTP7ag=; b=EnbmzbJ10iuh04iV95Vrappy9OY8s9hj1UNnbXBmKSpd7JLEvMfcOwBoVXJKrYahAI Ow2ZnnRQuQL/7E//0lWLxaAtGExyvpHgXRz9DZo+phO+r1aR7V2S2VuU2mtT1XkDoChi bMNRbVuA2YA075UKEOAKhf2NWnkUcxU3jao0r9w5zmAW+kXimar6uzSfhZZGB4f16lho NmMmCWMFv4fuLvMJI+DObGspp895xSSv6zYHy/TB/U+VpZ0cosV7HIGDf7IxTwTn3SIF 5BT12AdRZOlC+3v8ZXuD7q/yrg1MZFXYQAsaEC44KaTnwCdIFgVfZfleBzaVhEyXU4oQ m+AQ== 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=Rvb5NNaGSYYn1or75b3aK2BlDR/RDJgJ+OaGXdTP7ag=; b=KEnoO2eUoQzdGc8NukOxt2wG19d/3ecO5VqGrQ5tpxFEGJG5YHjyIgXs4gVyt2KIVU keZLdWXtww+wOQtYz+Emo/manEl17dpzR1g2ca4wAz2v9L2aQCcc7yKXvXQgK457r+LR QJGqSTA3C/z99ouB7Pu9GQR5RcbZp+hI9HE3BTgc3vOCq5SYHpEvIrBfJwlDJR++eKaE xGIdWTyG/KR4xZF+Hox5Q+By3pWnZHTz47CQwSNPiNk7cviAWsxBP1ikDJyd2Jg1BU7k cigBI5PhzrA8VBJ8y3WTU6mmylsoyFbxpExvJ5oYayVc3Od56QKrtwp+5f8h83AX96HF NjcQ== X-Gm-Message-State: APjAAAXYoaOj9btdZx8MvTMrcpgik1nDyo/qeHgj6J36JOMAnZfEp7Yx /Vfzak6OK7JMuQHUl1Gw2PT3c/lHfJvbZ5+BLp3OvQ== X-Google-Smtp-Source: APXvYqy4drNostPQPFUDyXmaOLIG5yyunLRPMGeVYdpFM8TtfiwagzE6BTnJ/p7iPOQ783yahvccmbwsTmGDqXgrXvQ= X-Received: by 2002:ac8:4413:: with SMTP id j19mr23941734qtn.281.1560752645835; Sun, 16 Jun 2019 23:24:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Akshay Joshi Date: Mon, 17 Jun 2019 11:53:54 +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="00000000000009a303058b7f0b22" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --00000000000009a303058b7f0b22 Content-Type: text/plain; charset="UTF-8" Hi Dave/Hackers On Fri, Jun 14, 2019 at 6:10 PM Akshay Joshi wrote: > > > 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. > Can we add a new parameter to --pkg "*resql*" to run all the reverse engineered test cases for all the modules, it just like parameter "*all*" which is used to run all the regression tests. Following will be the scenario if we add new parameter: - If we run --pkg all, run all the API and resql test cases. - If we run --pkg , run the API and resql test cases for the specified module list - if we run --pkg resql, run all the resql test cases only. > >> - 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* > -- *Thanks & Regards* *Akshay Joshi* *Sr. Software Architect* *EnterpriseDB Software India Private Limited* *Mobile: +91 976-788-8246* --00000000000009a303058b7f0b22 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi=C2=A0Dave/Hackers

On Fri, Jun 14, 2019= at 6:10 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:


On F= ri, 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 pa= rt 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 to read all the JSON file= s 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 sequen= tial order.

Format of the JSON file is mentioned i= n "<path_of_source>web/pgadmin/browser/server_groups/servers/dat= abases/casts/tests/default/test.json"

For exp= ected 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 nam= e in the same directory where the JSON file resides and specify the paramet= er "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?
=C2=A0 =C2=A0
=C2=A0 =C2=A0Will fix the abov= e.=C2=A0
- How do we run only the re_sql tests= ? I tried the obvious ways (e.g.=C2=A0python runtests.py --pkg regression.r= e_sql.tests.test_resql.ReverseEngineeringSQLTestCase) but got errors. Pleas= e 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 t= ried but facing issues when run only=C2=A0 "regression.re_sql.tests&qu= ot;, will continue working on this.

=
=C2=A0 =C2=A0 =C2=A0Can we add a new parameter=C2=A0 to --pkg &q= uot;resql" to run all the reverse engineered test cases for all= the modules, it just like parameter "all" which is used t= o run all the regression tests. Following will be the scenario if we add ne= w parameter:
  • If we run --pkg all, run all the API and res= ql test cases.
  • If we run --pkg <module list>, run the API and= resql test cases for the specified module list=C2=A0
  • if we run --p= kg resql, run all the resql test cases only.=C2=A0 =C2=A0=C2=A0
=C2=A0=C2=A0
- Onc= e we have a way to run these tests only, please add a "make check-resq= l" target to the Makefile.
- Can the expected output be form= atted in the JSON such that it doesn't use \n, but uses regular line br= eaks? That would make it easier to copy/paste.

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

Thanks.

--
Dave = Page
Blog: htt= p://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: <= a href=3D"http://www.enterprisedb.com" target=3D"_blank">http://www.enterpr= isedb.com
The Enterprise PostgreSQL Company


--
=
Thanks & Regar= ds
Akshay Joshi
= Sr. Software Architect
<= /div>
EnterpriseDB Software India Private Limited
Mobile: +91 976-788-8246
<= /div>


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