[Webtest] Groovy Integration Questions

Harihara Vinayakaram Harihara Vinayakaram" <hvram1@gmail.com
Tue, 1 Jul 2008 22:11:54 +0530


------=_Part_6829_15490913.1214930514557
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi
   I am not qualified to answer all the questions . But let me try answering
a few that I know of.  We started with the aim of developing a test suite in
groovy but we gave it up since it was difficult to get engineers to learn
groovy rather than ant specific syntax which they were familiar. It was
easier to get newer tests in

   So we ended up with a test harness in groovy (using the grails framework
as the model ) that ran an automated suite by clicking on the links and the
rest of the actual tests were in XML .

    Yes XML has its own issues with webtest. Particulary (JIRA WT-382 )
which makes verification of tests a pain but gets the job done when
integrated with Hudson

   Some issues we faced when we used groovy was :
       a) It is tough to get the idea that groovy is interpreted . So you
see print's in closures getting printed on the console and the actual tests
getting executed much later

       b) Organization of tests in groovy did not have any documentation but
this was rectified . You can search the mailing list for examples

       c) XPath support in groovy was very laboured . (i.e.) if you want to
write a test and then decide on what to click based on some xPath expression
was very tough

My experience has been that it is better to stick with XML predominantly and
extend if needed using Groovy

Regards
Hari

On Tue, Jul 1, 2008 at 9:18 PM, <geojohn@lexmark.com> wrote:

>
> Hello all,
>
> I'm researching WebTest's feasibility for use in the testing of some web
> interfaces. We've achieved some very nice results with WebTest, and we like
> it, but we also feel that in some cases the use of XML is holding us back.
> We want functions which accept parameters and return values (includes and
> properties are not a good substitute), we need more data types (hashes,
> arrays, etc), we want more extensibility with third-party libraries, etc. It
> seems that WebTest's integration with Groovy would offer us the desired
> functionality.
>
> Unfortunately, as far as I can tell, the use of WebTest with Groovy is not
> very well-documented. I was hoping that perhaps you could help me out by
> answering some questions.
>
> 1.) Can Groovy code return data to XML-based tests, somehow? Perhaps via
> ANT properties?
> 2.) Is it possible to write a class in Groovy, then call its functions
> directly from WebTest XML files?
> 2.) How does one organize a test suite written in Groovy? It doesn't seem
> that using build.xml etc would be valid.
> 3.) Is it better to create a Groovy test suite using WebTest and the
> WebTest file structure, or is it better to create a Grails project and
> import the WebTest functionality from an external source?
> 3.) Does anyone have an example/proof-of-concept test suite written
> predominately in Groovy which they might be willing to share?
> 4.) Are there major drawbacks to using a 100% Groovy code base as opposed
> to WebTest's XML based tests?
>
> Thank you all for your help. Your input is greatly appreciated.
>
> Thanks,
> George Johnson

------=_Part_6829_15490913.1214930514557
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi<br>&nbsp;&nbsp; I am not qualified to answer all the questions . But let me try answering a few that I know of.&nbsp; We started with the aim of developing a test suite in groovy but we gave it up since it was difficult to get engineers to learn groovy rather than ant specific syntax which they were familiar. It was easier to get newer tests in <br>
<br>&nbsp;&nbsp; So we ended up with a test harness in groovy (using the grails framework as the model ) that ran an automated suite by clicking on the links and the rest of the actual tests were in XML . <br><br>&nbsp;&nbsp;&nbsp; Yes XML has its own issues with webtest. Particulary (JIRA WT-382 ) which makes verification of tests a pain but gets the job done when integrated with Hudson<br>
<br>&nbsp;&nbsp; Some issues we faced when we used groovy was :<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a) It is tough to get the idea that groovy is interpreted . So you see print&#39;s in closures getting printed on the console and the actual tests getting executed much later<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b) Organization of tests in groovy did not have any documentation but this was rectified . You can search the mailing list for examples<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c) XPath support in groovy was very laboured . (i.e.) if you want to write a test and then decide on what to click based on some xPath expression was very tough<br>
<br>My experience has been that it is better to stick with XML predominantly and extend if needed using Groovy<br><br>Regards<br>Hari<br><br><div class="gmail_quote">On Tue, Jul 1, 2008 at 9:18 PM,  &lt;<a href="mailto:geojohn@lexmark.com">geojohn@lexmark.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><font face="sans-serif" size="2">Hello all,</font>
<br>
<br><font face="sans-serif" size="2">I&#39;m researching WebTest&#39;s feasibility
for use in the testing of some web interfaces. We&#39;ve achieved some very
nice results with WebTest, and we like it, but we also feel that in some
cases the use of XML is holding us back. We want functions which accept
parameters and return values (includes and properties are not a good substitute),
we need more data types (hashes, arrays, etc), we want more extensibility
with third-party libraries, etc. It seems that WebTest&#39;s integration with
Groovy would offer us the desired functionality.</font>
<br>
<br><font face="sans-serif" size="2">Unfortunately, as far as I can tell,
the use of WebTest with Groovy is not very well-documented. I was hoping
that perhaps you could help me out by answering some questions.</font>
<br>
<br><font face="sans-serif" size="2">1.) Can Groovy code return data to XML-based
tests, somehow? Perhaps via ANT properties?</font>
<br><font face="sans-serif" size="2">2.) Is it possible to write a class
in Groovy, then call its functions directly from WebTest XML files?</font>
<br><font face="sans-serif" size="2">2.) How does one organize a test suite
written in Groovy? It doesn&#39;t seem that using build.xml etc would be valid.</font>
<br><font face="sans-serif" size="2">3.) Is it better to create a Groovy
test suite using WebTest and the WebTest file structure, or is it better
to create a Grails project and import the WebTest functionality from an
external source?</font>
<br><font face="sans-serif" size="2">3.) Does anyone have an example/proof-of-concept
test suite written predominately in Groovy which they might be willing
to share?</font>
<br><font face="sans-serif" size="2">4.) Are there major drawbacks to using
a 100% Groovy code base as opposed to WebTest&#39;s XML based tests?</font>
<br>
<br><font face="sans-serif" size="2">Thank you all for your help. Your input
is greatly appreciated.</font>
<br>
<br><font face="sans-serif" size="2">Thanks,</font>
<br><font face="sans-serif" size="2">George Johnson</font></blockquote></div><br>

------=_Part_6829_15490913.1214930514557--