Where to put WebTest.groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Where to put WebTest.groovy

Dierk König
Hi Graeme,

all generated webtest would inherit from
WebTest, which would look like the current
WebTest.groovy in the books sample.

What would be the appropriate package and directory
for it to make sure it is available on the cp when
tests are executed?

What would be the best source artifact to scaffold
a webtest for: the domain class?
I intend to scaffold webtests that correspond to the
scaffolded views, i.e. the CRUD functionality as
visible to the user.

cheers
Mittie
Reply | Threaded
Open this post in threaded view
|

Re: Where to put WebTest.groovy

graemer
On 18/02/06, Dierk Koenig <[hidden email]> wrote:
> Hi Graeme,
>
> all generated webtest would inherit from
> WebTest, which would look like the current
> WebTest.groovy in the books sample.
>
> What would be the appropriate package and directory
> for it to make sure it is available on the cp when
> tests are executed?

Hi dierk, there is a directory called "grails-test" in the root of
every project where the unit tests go this is probably the best place.


>
> What would be the best source artifact to scaffold
> a webtest for: the domain class?
> I intend to scaffold webtests that correspond to the
> scaffolded views, i.e. the CRUD functionality as
> visible to the user.

this is a tough one as you may want to create a webtest for every
action in your controller, but for scaffolded views the domain class
is necessary if you are gunna generate a truely scaffolded webtest (ie
with all the fields checked and the test functionality already
generated)

Graeme
>
> cheers
> Mittie
>
Reply | Threaded
Open this post in threaded view
|

RE: Where to put WebTest.groovy

Dierk König
> > What would be the appropriate package and directory
> > for it to make sure it is available on the cp when
> > tests are executed?
>
> Hi dierk, there is a directory called "grails-test" in the root of
> every project where the unit tests go this is probably the best place.

I plan to generate a 'webtest' dir parallel to 'grails-test'
where the scaffolded webtests go.
However, I'd like WebTest - the common superclass of all tests -
not to be duplicated but residing under grails-home.
Where could that be?

> > What would be the best source artifact to scaffold
> > a webtest for: the domain class?
> > I intend to scaffold webtests that correspond to the
> > scaffolded views, i.e. the CRUD functionality as
> > visible to the user.
>
> this is a tough one as you may want to create a webtest for every
> action in your controller, but for scaffolded views the domain class
> is necessary if you are gunna generate a truely scaffolded webtest (ie
> with all the fields checked and the test functionality already
> generated)

I'll start small and see what's possible.
Funtional tests are always a 'second source' of information for
cross-checking the behavior. So some of the work for specifying the test
will always be left to the user anyway.
(I guess more ideas will come up as soon as we have something
tangible.)

cheers
Mittie
Reply | Threaded
Open this post in threaded view
|

Re: Where to put WebTest.groovy

graemer
On 18/02/06, Dierk Koenig <[hidden email]> wrote:

> > > What would be the appropriate package and directory
> > > for it to make sure it is available on the cp when
> > > tests are executed?
> >
> > Hi dierk, there is a directory called "grails-test" in the root of
> > every project where the unit tests go this is probably the best place.
>
> I plan to generate a 'webtest' dir parallel to 'grails-test'
> where the scaffolded webtests go.
> However, I'd like WebTest - the common superclass of all tests -
> not to be duplicated but residing under grails-home.
> Where could that be?


There is a directory in under %GRAILS_HOME%\src\grails\grails-app
where all resources for grails apps go.. you could make a
%GRAILS_HOME%\src\grails\webtest directory.

Otherwise why don't you put it in the "src/commons" tree and then it
would be included in the grails jar..

>
> > > What would be the best source artifact to scaffold
> > > a webtest for: the domain class?
> > > I intend to scaffold webtests that correspond to the
> > > scaffolded views, i.e. the CRUD functionality as
> > > visible to the user.
> >
> > this is a tough one as you may want to create a webtest for every
> > action in your controller, but for scaffolded views the domain class
> > is necessary if you are gunna generate a truely scaffolded webtest (ie
> > with all the fields checked and the test functionality already
> > generated)
>
> I'll start small and see what's possible.
> Funtional tests are always a 'second source' of information for
> cross-checking the behavior. So some of the work for specifying the test
> will always be left to the user anyway.
> (I guess more ideas will come up as soon as we have something
> tangible.)

Sounds good

Graeme

>
> cheers
> Mittie
>
Reply | Threaded
Open this post in threaded view
|

Re: Where to put WebTest.groovy

graemer
Great! Thanks for the contribution Dierk :-)

Graeme

On 18/02/06, Graeme Rocher <[hidden email]> wrote:

> On 18/02/06, Dierk Koenig <[hidden email]> wrote:
> > > > What would be the appropriate package and directory
> > > > for it to make sure it is available on the cp when
> > > > tests are executed?
> > >
> > > Hi dierk, there is a directory called "grails-test" in the root of
> > > every project where the unit tests go this is probably the best place.
> >
> > I plan to generate a 'webtest' dir parallel to 'grails-test'
> > where the scaffolded webtests go.
> > However, I'd like WebTest - the common superclass of all tests -
> > not to be duplicated but residing under grails-home.
> > Where could that be?
>
>
> There is a directory in under %GRAILS_HOME%\src\grails\grails-app
> where all resources for grails apps go.. you could make a
> %GRAILS_HOME%\src\grails\webtest directory.
>
> Otherwise why don't you put it in the "src/commons" tree and then it
> would be included in the grails jar..
>
> >
> > > > What would be the best source artifact to scaffold
> > > > a webtest for: the domain class?
> > > > I intend to scaffold webtests that correspond to the
> > > > scaffolded views, i.e. the CRUD functionality as
> > > > visible to the user.
> > >
> > > this is a tough one as you may want to create a webtest for every
> > > action in your controller, but for scaffolded views the domain class
> > > is necessary if you are gunna generate a truely scaffolded webtest (ie
> > > with all the fields checked and the test functionality already
> > > generated)
> >
> > I'll start small and see what's possible.
> > Funtional tests are always a 'second source' of information for
> > cross-checking the behavior. So some of the work for specifying the test
> > will always be left to the user anyway.
> > (I guess more ideas will come up as soon as we have something
> > tangible.)
>
> Sounds good
>
> Graeme
>
> >
> > cheers
> > Mittie
> >
>
Reply | Threaded
Open this post in threaded view
|

RE: Where to put WebTest.groovy

Dierk König
It was a pleasure :-)

Feel free to change what I did in any way you like.
E.g. we may want to come up with Grails-specific xslt for
report generation, which can be as simple as changing the logo.

Something that came to my mind during the process was that we would
very much profit from
- a continuous integration
- a functional selftest

The functional selftest could be like
- create a sample app:
  - go to tmp, delete 'mypapp' if needed
  - issue 'grails create-app'; System.in << 'myapp'
  - issue 'grails create-domain-class'; System.in << 'mybo'
    ... maybe more here ...
  - issue 'grails generate-all'; System.in << 'mybo'
- testing (maybe even allow failures, but no errors)
  - issue 'grails create-webtest'
  - augment the tests if necessary (or use some minimal one)
  - issue 'grails run-app&' (in spawned process)
  - issue 'grails run-webtest'
  - kill spawned process

This could serve the purpose of self-checking but would
also provide a 'guide' for what user steps are expected to
occur in which sequence.

cheers
Mittie

P.S. for the purpose of spawning the server while running the
selftests we have that running for the Canoo WebTest project -
even on the continuous integration. That's how we do our selftests.
It needs a bit of work but I guess I would be able to
copy that over.

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]On Behalf
> Of Graeme Rocher
> Sent: Samstag, 18. Februar 2006 23:12
> To: Dierk Koenig
> Cc: [hidden email]
> Subject: Re: [grails-dev] Where to put WebTest.groovy
>
>
> Great! Thanks for the contribution Dierk :-)
>
> Graeme

Reply | Threaded
Open this post in threaded view
|

Re: Where to put WebTest.groovy

graemer
Sounds like a great idea, I would like to setup continuous integration
but have just never got round to asking Guillaume how this is done on
Beetlejuice

The self test would be excellent, I would also like to setup
functional tests for the ever growing tag library:

http://grails.codehaus.org/GSP+Tag+Reference

Cheers
Graeme

On 19/02/06, Dierk Koenig <[hidden email]> wrote:

> It was a pleasure :-)
>
> Feel free to change what I did in any way you like.
> E.g. we may want to come up with Grails-specific xslt for
> report generation, which can be as simple as changing the logo.
>
> Something that came to my mind during the process was that we would
> very much profit from
> - a continuous integration
> - a functional selftest
>
> The functional selftest could be like
> - create a sample app:
>   - go to tmp, delete 'mypapp' if needed
>   - issue 'grails create-app'; System.in << 'myapp'
>   - issue 'grails create-domain-class'; System.in << 'mybo'
>     ... maybe more here ...
>   - issue 'grails generate-all'; System.in << 'mybo'
> - testing (maybe even allow failures, but no errors)
>   - issue 'grails create-webtest'
>   - augment the tests if necessary (or use some minimal one)
>   - issue 'grails run-app&' (in spawned process)
>   - issue 'grails run-webtest'
>   - kill spawned process
>
> This could serve the purpose of self-checking but would
> also provide a 'guide' for what user steps are expected to
> occur in which sequence.
>
> cheers
> Mittie
>
> P.S. for the purpose of spawning the server while running the
> selftests we have that running for the Canoo WebTest project -
> even on the continuous integration. That's how we do our selftests.
> It needs a bit of work but I guess I would be able to
> copy that over.
>
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]]On Behalf
> > Of Graeme Rocher
> > Sent: Samstag, 18. Februar 2006 23:12
> > To: Dierk Koenig
> > Cc: [hidden email]
> > Subject: Re: [grails-dev] Where to put WebTest.groovy
> >
> >
> > Great! Thanks for the contribution Dierk :-)
> >
> > Graeme
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Where to put WebTest.groovy

Guillaume Laforge-2
I'm more in more inclined to going away from BeetleJuice.
And probably accepting Dierk's proposition to setup our CI server
alongside with Canoo's CI infrastructure.

On 2/19/06, Graeme Rocher <[hidden email]> wrote:

> Sounds like a great idea, I would like to setup continuous integration
> but have just never got round to asking Guillaume how this is done on
> Beetlejuice
>
> The self test would be excellent, I would also like to setup
> functional tests for the ever growing tag library:
>
> http://grails.codehaus.org/GSP+Tag+Reference
>
> Cheers
> Graeme
>
> On 19/02/06, Dierk Koenig <[hidden email]> wrote:
> > It was a pleasure :-)
> >
> > Feel free to change what I did in any way you like.
> > E.g. we may want to come up with Grails-specific xslt for
> > report generation, which can be as simple as changing the logo.
> >
> > Something that came to my mind during the process was that we would
> > very much profit from
> > - a continuous integration
> > - a functional selftest
> >
> > The functional selftest could be like
> > - create a sample app:
> >   - go to tmp, delete 'mypapp' if needed
> >   - issue 'grails create-app'; System.in << 'myapp'
> >   - issue 'grails create-domain-class'; System.in << 'mybo'
> >     ... maybe more here ...
> >   - issue 'grails generate-all'; System.in << 'mybo'
> > - testing (maybe even allow failures, but no errors)
> >   - issue 'grails create-webtest'
> >   - augment the tests if necessary (or use some minimal one)
> >   - issue 'grails run-app&' (in spawned process)
> >   - issue 'grails run-webtest'
> >   - kill spawned process
> >
> > This could serve the purpose of self-checking but would
> > also provide a 'guide' for what user steps are expected to
> > occur in which sequence.
> >
> > cheers
> > Mittie
> >
> > P.S. for the purpose of spawning the server while running the
> > selftests we have that running for the Canoo WebTest project -
> > even on the continuous integration. That's how we do our selftests.
> > It needs a bit of work but I guess I would be able to
> > copy that over.
> >
> > > -----Original Message-----
> > > From: [hidden email] [mailto:[hidden email]]On Behalf
> > > Of Graeme Rocher
> > > Sent: Samstag, 18. Februar 2006 23:12
> > > To: Dierk Koenig
> > > Cc: [hidden email]
> > > Subject: Re: [grails-dev] Where to put WebTest.groovy
> > >
> > >
> > > Great! Thanks for the contribution Dierk :-)
> > >
> > > Graeme
> >
> >
>


--
Guillaume Laforge
Groovy Project Manager
http://glaforge.free.fr/blog/groovy
Reply | Threaded
Open this post in threaded view
|

Grails functional selftest

Dierk König
In reply to this post by graemer
ok, I just committed a first sketch that only works on Windows, yet.

go to the samples dir, type
 groovy SampleGenerator
and watch what happens...

Does 'run-app' work with any of the current examples?
I always get an error message about 'web-app' being an unknown element type
...

cheers
Mittie

P.S. if your tag library is used in the scaffolded views, they will get
tested automatically this way. Otherwise, you can make dedicated webtests
for them.

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]On Behalf
> Of Graeme Rocher
> Sent: Sonntag, 19. Februar 2006 9:28
> To: [hidden email]
> Subject: Re: [grails-dev] Where to put WebTest.groovy
>
>
> Sounds like a great idea, I would like to setup continuous integration
> but have just never got round to asking Guillaume how this is done on
> Beetlejuice
>
> The self test would be excellent, I would also like to setup
> functional tests for the ever growing tag library:
>
> http://grails.codehaus.org/GSP+Tag+Reference
>
> Cheers
> Graeme
>
> On 19/02/06, Dierk Koenig <[hidden email]> wrote:
> > It was a pleasure :-)
> >
> > Feel free to change what I did in any way you like.
> > E.g. we may want to come up with Grails-specific xslt for
> > report generation, which can be as simple as changing the logo.
> >
> > Something that came to my mind during the process was that we would
> > very much profit from
> > - a continuous integration
> > - a functional selftest
> >
> > The functional selftest could be like
> > - create a sample app:
> >   - go to tmp, delete 'mypapp' if needed
> >   - issue 'grails create-app'; System.in << 'myapp'
> >   - issue 'grails create-domain-class'; System.in << 'mybo'
> >     ... maybe more here ...
> >   - issue 'grails generate-all'; System.in << 'mybo'
> > - testing (maybe even allow failures, but no errors)
> >   - issue 'grails create-webtest'
> >   - augment the tests if necessary (or use some minimal one)
> >   - issue 'grails run-app&' (in spawned process)
> >   - issue 'grails run-webtest'
> >   - kill spawned process
> >
> > This could serve the purpose of self-checking but would
> > also provide a 'guide' for what user steps are expected to
> > occur in which sequence.
> >
> > cheers
> > Mittie
> >
> > P.S. for the purpose of spawning the server while running the
> > selftests we have that running for the Canoo WebTest project -
> > even on the continuous integration. That's how we do our selftests.
> > It needs a bit of work but I guess I would be able to
> > copy that over.
> >
> > > -----Original Message-----
> > > From: [hidden email]
[mailto:[hidden email]]On Behalf

> > Of Graeme Rocher
> > Sent: Samstag, 18. Februar 2006 23:12
> > To: Dierk Koenig
> > Cc: [hidden email]
> > Subject: Re: [grails-dev] Where to put WebTest.groovy
> >
> >
> > Great! Thanks for the contribution Dierk :-)
> >
> > Graeme
>
>

Reply | Threaded
Open this post in threaded view
|

RE: Grails functional selftest

Dierk König
first bug detected with the selftests :-)

MydomainController:35 is
 return [ mydomain :  ]
but should most likely be
 return [ mydomain :  mydomain]

After that, got it working with Tomcat (but not yet with jetty...)

cheers Mittie

> -----Original Message-----
> From: Dierk Koenig [mailto:[hidden email]]
> Sent: Sonntag, 19. Februar 2006 14:04
> To: [hidden email]
> Subject: [grails-dev] Grails functional selftest
>
>
> ok, I just committed a first sketch that only works on Windows, yet.
>
> go to the samples dir, type
>  groovy SampleGenerator
> and watch what happens...
>
> Does 'run-app' work with any of the current examples?
> I always get an error message about 'web-app' being an unknown
> element type
> ...
>
> cheers
> Mittie
>
> P.S. if your tag library is used in the scaffolded views, they will get
> tested automatically this way. Otherwise, you can make dedicated webtests
> for them.
>
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]]On Behalf
> > Of Graeme Rocher
> > Sent: Sonntag, 19. Februar 2006 9:28
> > To: [hidden email]
> > Subject: Re: [grails-dev] Where to put WebTest.groovy
> >
> >
> > Sounds like a great idea, I would like to setup continuous integration
> > but have just never got round to asking Guillaume how this is done on
> > Beetlejuice
> >
> > The self test would be excellent, I would also like to setup
> > functional tests for the ever growing tag library:
> >
> > http://grails.codehaus.org/GSP+Tag+Reference
> >
> > Cheers
> > Graeme
> >
> > On 19/02/06, Dierk Koenig <[hidden email]> wrote:
> > > It was a pleasure :-)
> > >
> > > Feel free to change what I did in any way you like.
> > > E.g. we may want to come up with Grails-specific xslt for
> > > report generation, which can be as simple as changing the logo.
> > >
> > > Something that came to my mind during the process was that we would
> > > very much profit from
> > > - a continuous integration
> > > - a functional selftest
> > >
> > > The functional selftest could be like
> > > - create a sample app:
> > >   - go to tmp, delete 'mypapp' if needed
> > >   - issue 'grails create-app'; System.in << 'myapp'
> > >   - issue 'grails create-domain-class'; System.in << 'mybo'
> > >     ... maybe more here ...
> > >   - issue 'grails generate-all'; System.in << 'mybo'
> > > - testing (maybe even allow failures, but no errors)
> > >   - issue 'grails create-webtest'
> > >   - augment the tests if necessary (or use some minimal one)
> > >   - issue 'grails run-app&' (in spawned process)
> > >   - issue 'grails run-webtest'
> > >   - kill spawned process
> > >
> > > This could serve the purpose of self-checking but would
> > > also provide a 'guide' for what user steps are expected to
> > > occur in which sequence.
> > >
> > > cheers
> > > Mittie
> > >
> > > P.S. for the purpose of spawning the server while running the
> > > selftests we have that running for the Canoo WebTest project -
> > > even on the continuous integration. That's how we do our selftests.
> > > It needs a bit of work but I guess I would be able to
> > > copy that over.
> > >
> > > > -----Original Message-----
> > > > From: [hidden email]
> [mailto:[hidden email]]On Behalf
> > > Of Graeme Rocher
> > > Sent: Samstag, 18. Februar 2006 23:12
> > > To: Dierk Koenig
> > > Cc: [hidden email]
> > > Subject: Re: [grails-dev] Where to put WebTest.groovy
> > >
> > >
> > > Great! Thanks for the contribution Dierk :-)
> > >
> > > Graeme
> >
> >
Reply | Threaded
Open this post in threaded view
|

Re: Grails functional selftest

graemer
Excellent I will have a look, keep up the good work! ;-)

Graeme

On 19/02/06, Dierk Koenig <[hidden email]> wrote:

> first bug detected with the selftests :-)
>
> MydomainController:35 is
>  return [ mydomain :  ]
> but should most likely be
>  return [ mydomain :  mydomain]
>
> After that, got it working with Tomcat (but not yet with jetty...)
>
> cheers Mittie
>
> > -----Original Message-----
> > From: Dierk Koenig [mailto:[hidden email]]
> > Sent: Sonntag, 19. Februar 2006 14:04
> > To: [hidden email]
> > Subject: [grails-dev] Grails functional selftest
> >
> >
> > ok, I just committed a first sketch that only works on Windows, yet.
> >
> > go to the samples dir, type
> >  groovy SampleGenerator
> > and watch what happens...
> >
> > Does 'run-app' work with any of the current examples?
> > I always get an error message about 'web-app' being an unknown
> > element type
> > ...
> >
> > cheers
> > Mittie
> >
> > P.S. if your tag library is used in the scaffolded views, they will get
> > tested automatically this way. Otherwise, you can make dedicated webtests
> > for them.
> >
> > > -----Original Message-----
> > > From: [hidden email] [mailto:[hidden email]]On Behalf
> > > Of Graeme Rocher
> > > Sent: Sonntag, 19. Februar 2006 9:28
> > > To: [hidden email]
> > > Subject: Re: [grails-dev] Where to put WebTest.groovy
> > >
> > >
> > > Sounds like a great idea, I would like to setup continuous integration
> > > but have just never got round to asking Guillaume how this is done on
> > > Beetlejuice
> > >
> > > The self test would be excellent, I would also like to setup
> > > functional tests for the ever growing tag library:
> > >
> > > http://grails.codehaus.org/GSP+Tag+Reference
> > >
> > > Cheers
> > > Graeme
> > >
> > > On 19/02/06, Dierk Koenig <[hidden email]> wrote:
> > > > It was a pleasure :-)
> > > >
> > > > Feel free to change what I did in any way you like.
> > > > E.g. we may want to come up with Grails-specific xslt for
> > > > report generation, which can be as simple as changing the logo.
> > > >
> > > > Something that came to my mind during the process was that we would
> > > > very much profit from
> > > > - a continuous integration
> > > > - a functional selftest
> > > >
> > > > The functional selftest could be like
> > > > - create a sample app:
> > > >   - go to tmp, delete 'mypapp' if needed
> > > >   - issue 'grails create-app'; System.in << 'myapp'
> > > >   - issue 'grails create-domain-class'; System.in << 'mybo'
> > > >     ... maybe more here ...
> > > >   - issue 'grails generate-all'; System.in << 'mybo'
> > > > - testing (maybe even allow failures, but no errors)
> > > >   - issue 'grails create-webtest'
> > > >   - augment the tests if necessary (or use some minimal one)
> > > >   - issue 'grails run-app&' (in spawned process)
> > > >   - issue 'grails run-webtest'
> > > >   - kill spawned process
> > > >
> > > > This could serve the purpose of self-checking but would
> > > > also provide a 'guide' for what user steps are expected to
> > > > occur in which sequence.
> > > >
> > > > cheers
> > > > Mittie
> > > >
> > > > P.S. for the purpose of spawning the server while running the
> > > > selftests we have that running for the Canoo WebTest project -
> > > > even on the continuous integration. That's how we do our selftests.
> > > > It needs a bit of work but I guess I would be able to
> > > > copy that over.
> > > >
> > > > > -----Original Message-----
> > > > > From: [hidden email]
> > [mailto:[hidden email]]On Behalf
> > > > Of Graeme Rocher
> > > > Sent: Samstag, 18. Februar 2006 23:12
> > > > To: Dierk Koenig
> > > > Cc: [hidden email]
> > > > Subject: Re: [grails-dev] Where to put WebTest.groovy
> > > >
> > > >
> > > > Great! Thanks for the contribution Dierk :-)
> > > >
> > > > Graeme
> > >
> > >
>