Antwort: RE: [Webtest] Canoo + Grails

George Policello George Policello" <gpolicello@mmetrics.com
Thu, 3 Apr 2008 09:45:11 -0700


Niko,

I am not completely sure what you are asking for.

Here is one way to get things into a Groovy script from a Webtest =
"step". The process may be reversible also, that is, one may be able to =
add to the two Property (Map) objects in the Groovy code; but I have not =
tried that as yet.

// =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
// Get the two types of properties set in the Webtest.
// =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
def antProperties =3D step.getWebtestProperties( step.PROPERTY_TYPE_ANT =
) ;
def dynamicProperties =3D step.getWebtestProperties( =
step.PROPERTY_TYPE_DYNAMIC ) ;
// =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

"dynamic" =3D=3D Webtest Property.

They are two separate domains so you either have to know which you want =
or try both.

Once you have the Maps, just use them like any Java Map. That is, =
extract your Ant property or Webtest property like this;

  def antPropertyOfInterest =3D
      antProperties.get( 'ant.property.of.interest.name' ) ;

  def dynamicPropertyOfInterest =3D
      dynamicProperties.get( 'dynamic.property.of.interest.name' ) ;

Hope that helps a bit,
George
________________________________________
From: webtest-admin@lists.canoo.com =
[mailto:webtest-admin@lists.canoo.com] On Behalf Of pompl@comnetmedia.de
Sent: Thursday, April 03, 2008 4:41 AM
To: webtest@lists.canoo.com
Subject: Antwort: RE: [Webtest] Canoo + Grails



Hi Niko,=20

> Another question is (for may be including in the documentation), how =
to
> define more than one test suites (beside the standard
> webtest/tests/TestSuite.groovy) and how to invoke them.=20

just search for "Any public interest in separating tests by =A0groups?" =
in the "grails user" mailing list.=20

There is a patch which may solve your problem.=20

I hope, it will be applied to a coming grails version.=20


Best regards=20
Marc Pompl=20


"Niko Schmuck" <niko.schmuck@nava.de>=20
Gesendet von: webtest-admin@lists.canoo.com=20
03.04.2008 12:20=20
Bitte antworten an
webtest@lists.canoo.com

An
Dierk K=F6nig <dierk.koenig@canoo.com>=20
Kopie
webtest@lists.canoo.com=20
Thema
RE: [Webtest] Canoo + Grails







Hi Dierk, and all,

webtest embedded into the grails development process is absolutely great
to use. Thanks very much for your groovy-fication!

The only thing I wonder is, how one would get out the webtest step
properties into the groovy script for further processing. I am sure =
there
is a groovy way to interact between webtest properties and groovy
variables, but cannot find it.

Another question is (for may be including in the documentation), how to
define more than one test suites (beside the standard
webtest/tests/TestSuite.groovy) and how to invoke them.

Cheers,
Niko


On Wed, April 2, 2008 4:05 pm, Dierk K=F6nig wrote:
> Hi David,
>
> The documentation of general Groovy usage with WebTest is
> under http://webtest.canoo.com/webtest/manual/groovyTesting.html
> which in turns points to
> http://grails.codehaus.org/Functional+Testing
> for the Grais specifics.
>
> Could you give a list of topics that are not covered by these
> pages?
>
> much appreciated
> Dierk
>
> | -----Original Message-----
> | From: webtest-admin@lists.canoo.com
> | [mailto:webtest-admin@lists.canoo.com] On Behalf Of
> | david.cate@wachovia.com
> | Sent: Mittwoch, 2. April 2008 14:39
> | To: webtest@gate4.canoo.com
> | Subject: Re: [Webtest] Canoo + Grails
> |
> |
> | Marc, thank you for the response - got it working
> | beautifully. I've noticed that while the Canoo documentation
> | is fairly thorough with the exception of the Grails portion
> | and even Grails skips around the functional testing portion as well.
> |
> | 1. Are there any sites or guides that give a good overview of
> | custom functional testing for Webtests in Grails?
> | 2. This is just to confirm something: the XML patterns for
> | specifying the tests are not available with the Grails plugin
> | - correct? If I create my tests within the XML using
> | definitions and entity replacements - I would then need to
> | change those tests to use the method described below?
> |
> |
> |
> |
> | Marc Guillemot <mguillemot@yahoo.fr>
> | Sent by: webtest-admin@gate4.canoo.com
> |
> | 04/02/2008 05:34 AM
> | Please respond to
> | webtest@gate4.canoo.com
> |
> | To
> | webtest@gate4.canoo.com
> | cc
> | Subject
> | Re: [Webtest] Canoo + Grails
> |
> |
> |
> |
> |
> |
> | Hi,
> |
> | the mailing list is fully correct.
> |
> | In Grails you can just extract common step sequences in
> | utility methods like
> |
> | // Utility.groovy
> | class Utility
> | {
> | =A0doLogin(ant)
> | =A0{
> | =A0 =A0ant.group(description: 'perform login')
> | =A0 =A0{
> | =A0 =A0 =A0invoke "http://..."
> | =A0 =A0}
> | =A0}
> | }
> |
> | // SomeTest.groovy
> | import static Utility.*
> | ...
> | webtest('some test')
> | {
> | =A0doLogin(ant)
> | =A0...
> | }
> |
> | (my mailer still doesn't compile, syntax error are possible ;-))
> |
> | When you're utility methods are located directly in your
> | class (or in some parent class), you don't need to pass ant
> | as parameter.
> |
> | Cheers,
> | Marc.
> | --
> | Blog: http://mguillem.wordpress.com
> |
> |
> | david.cate@wachovia.com wrote:
> | >
> | > I have Grails running with Canoo Webtest plugin installed.
> | Life is great
> | > except my tests feel very repetitive. When I used Canoo Webtests
> | > stand-alone, I used a lot of in-line parsing with the entity and =
put
> | > common tests in areas available to all. I know a lot of
> | work was going
> | > on in the background to make those pieces available. Is
> | there a similar
> | > process for the plugin for Grails? Is there a different way
> | to include
> | > common tests?
> | >
> | > This may not the best forum to address the question, if
> | it's not please
> | > let me know. There's not a whole lot of information that
> | discusses this
> | > that i could find. I would love to be proven wrong -
> | especially if you
> | > have the documentation available :)
> |
> | _______________________________________________
> | WebTest mailing list
> | WebTest@lists.canoo.com
> | http://lists.canoo.com/mailman/listinfo/webtest
> |
> |
> |
>


_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest