You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Fredrik Liden <fl...@translate.com> on 2007/06/13 02:46:40 UTC

Unit testing web apps

Do you have any recommendations/guide lines for testing a Cayenne web
application. Do I need a combination of cactus for the web pages and
jUnit for the service layer and data objects? Would I be able to access
the cayenne data context from within the setup and tear down functions.
Or should I consider this testing as a completely separate application
from the current web app since the test is not running as a servlet and
can't get the context from there? How do you guys test your apps? 

Thanks!
Fredrik

AW: Unit testing web apps

Posted by Peter Schröder <Pe...@freenet-ag.de>.
yes, there is a firefox plugin http://www.openqa.org/selenium-ide/ 

-----Ursprüngliche Nachricht-----
Von: Mike Kienenberger [mailto:mkienenb@gmail.com] 
Gesendet: Donnerstag, 14. Juni 2007 16:57
An: user@cayenne.apache.org
Betreff: Re: Unit testing web apps

Actually, I seem to recall that there are some Firefox (or maybe it
was IE) tools for developing Selenium tests rather rapidly.   I don't
remember the details as I was just casually investigating the tool at
the time.

On 6/14/07, Malcolm Edgar <ma...@gmail.com> wrote:
> The decision to develop UI unit tests really comes down to how much
> budget you have for your applications development.
>
> If you do, than that is great.  You can also develop some load testing
> capability at the same time. Just note is time consuming / expensive
> to do so.
>
> regards Malcolm Edgar
>
> On 6/14/07, Peter Schröder <Pe...@freenet-ag.de> wrote:
> > hi kevin,
> >
> > i think that testing the ui is a very important part for a good quality web-application. it also helps understanding the webapp for new developers or reminding you of things that have been implemented in a sloppy way. it is poor that in most cases i dont take the time to write some tests on that...
> >
> > kind regards
> > peter
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Kevin Menard [mailto:kmenard@servprise.com]
> > Gesendet: Mittwoch, 13. Juni 2007 20:34
> > An: user@cayenne.apache.org
> > Betreff: RE: Unit testing web apps
> >
> > > -----Original Message-----
> > > From: Malcolm Edgar [mailto:malcolm.edgar@gmail.com]
> > > Sent: Tuesday, June 12, 2007 9:47 PM
> > > To: user@cayenne.apache.org
> > > Subject: Re: Unit testing web apps
> > >
> > > I think writing unit tests for DAO/Service classes is OK, but
> > > going up to the UI tier is not worth the effort. This is due
> > > to the amount of change you see in UI's and the effort it
> > > takes to write and maintain these tests.
> >
> > I have to disagree here.  While they are a pain in the neck to maintain,
> > our selenium tests have turned up numerous problems.  Just recently we
> > discovered a problem with using a shared data cache on certain objects.
> > It also helps tests session-bound contexts.
> >
> > Since Selenium uses an XPath-like syntax for DOM navigation, you can
> > write tests that generally work even after UI changes.
> >
> > --
> > Kevin
> >
>

Re: Unit testing web apps

Posted by Mike Kienenberger <mk...@gmail.com>.
Actually, I seem to recall that there are some Firefox (or maybe it
was IE) tools for developing Selenium tests rather rapidly.   I don't
remember the details as I was just casually investigating the tool at
the time.

On 6/14/07, Malcolm Edgar <ma...@gmail.com> wrote:
> The decision to develop UI unit tests really comes down to how much
> budget you have for your applications development.
>
> If you do, than that is great.  You can also develop some load testing
> capability at the same time. Just note is time consuming / expensive
> to do so.
>
> regards Malcolm Edgar
>
> On 6/14/07, Peter Schröder <Pe...@freenet-ag.de> wrote:
> > hi kevin,
> >
> > i think that testing the ui is a very important part for a good quality web-application. it also helps understanding the webapp for new developers or reminding you of things that have been implemented in a sloppy way. it is poor that in most cases i dont take the time to write some tests on that...
> >
> > kind regards
> > peter
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Kevin Menard [mailto:kmenard@servprise.com]
> > Gesendet: Mittwoch, 13. Juni 2007 20:34
> > An: user@cayenne.apache.org
> > Betreff: RE: Unit testing web apps
> >
> > > -----Original Message-----
> > > From: Malcolm Edgar [mailto:malcolm.edgar@gmail.com]
> > > Sent: Tuesday, June 12, 2007 9:47 PM
> > > To: user@cayenne.apache.org
> > > Subject: Re: Unit testing web apps
> > >
> > > I think writing unit tests for DAO/Service classes is OK, but
> > > going up to the UI tier is not worth the effort. This is due
> > > to the amount of change you see in UI's and the effort it
> > > takes to write and maintain these tests.
> >
> > I have to disagree here.  While they are a pain in the neck to maintain,
> > our selenium tests have turned up numerous problems.  Just recently we
> > discovered a problem with using a shared data cache on certain objects.
> > It also helps tests session-bound contexts.
> >
> > Since Selenium uses an XPath-like syntax for DOM navigation, you can
> > write tests that generally work even after UI changes.
> >
> > --
> > Kevin
> >
>

Re: Unit testing web apps

Posted by Malcolm Edgar <ma...@gmail.com>.
The decision to develop UI unit tests really comes down to how much
budget you have for your applications development.

If you do, than that is great.  You can also develop some load testing
capability at the same time. Just note is time consuming / expensive
to do so.

regards Malcolm Edgar

On 6/14/07, Peter Schröder <Pe...@freenet-ag.de> wrote:
> hi kevin,
>
> i think that testing the ui is a very important part for a good quality web-application. it also helps understanding the webapp for new developers or reminding you of things that have been implemented in a sloppy way. it is poor that in most cases i dont take the time to write some tests on that...
>
> kind regards
> peter
>
> -----Ursprüngliche Nachricht-----
> Von: Kevin Menard [mailto:kmenard@servprise.com]
> Gesendet: Mittwoch, 13. Juni 2007 20:34
> An: user@cayenne.apache.org
> Betreff: RE: Unit testing web apps
>
> > -----Original Message-----
> > From: Malcolm Edgar [mailto:malcolm.edgar@gmail.com]
> > Sent: Tuesday, June 12, 2007 9:47 PM
> > To: user@cayenne.apache.org
> > Subject: Re: Unit testing web apps
> >
> > I think writing unit tests for DAO/Service classes is OK, but
> > going up to the UI tier is not worth the effort. This is due
> > to the amount of change you see in UI's and the effort it
> > takes to write and maintain these tests.
>
> I have to disagree here.  While they are a pain in the neck to maintain,
> our selenium tests have turned up numerous problems.  Just recently we
> discovered a problem with using a shared data cache on certain objects.
> It also helps tests session-bound contexts.
>
> Since Selenium uses an XPath-like syntax for DOM navigation, you can
> write tests that generally work even after UI changes.
>
> --
> Kevin
>

AW: Unit testing web apps

Posted by Peter Schröder <Pe...@freenet-ag.de>.
hi kevin,

i think that testing the ui is a very important part for a good quality web-application. it also helps understanding the webapp for new developers or reminding you of things that have been implemented in a sloppy way. it is poor that in most cases i dont take the time to write some tests on that...

kind regards
peter 

-----Ursprüngliche Nachricht-----
Von: Kevin Menard [mailto:kmenard@servprise.com] 
Gesendet: Mittwoch, 13. Juni 2007 20:34
An: user@cayenne.apache.org
Betreff: RE: Unit testing web apps

> -----Original Message-----
> From: Malcolm Edgar [mailto:malcolm.edgar@gmail.com] 
> Sent: Tuesday, June 12, 2007 9:47 PM
> To: user@cayenne.apache.org
> Subject: Re: Unit testing web apps
> 
> I think writing unit tests for DAO/Service classes is OK, but 
> going up to the UI tier is not worth the effort. This is due 
> to the amount of change you see in UI's and the effort it 
> takes to write and maintain these tests.

I have to disagree here.  While they are a pain in the neck to maintain,
our selenium tests have turned up numerous problems.  Just recently we
discovered a problem with using a shared data cache on certain objects.
It also helps tests session-bound contexts.

Since Selenium uses an XPath-like syntax for DOM navigation, you can
write tests that generally work even after UI changes.

-- 
Kevin

RE: Unit testing web apps

Posted by Kevin Menard <km...@servprise.com>.
> -----Original Message-----
> From: Malcolm Edgar [mailto:malcolm.edgar@gmail.com] 
> Sent: Tuesday, June 12, 2007 9:47 PM
> To: user@cayenne.apache.org
> Subject: Re: Unit testing web apps
> 
> I think writing unit tests for DAO/Service classes is OK, but 
> going up to the UI tier is not worth the effort. This is due 
> to the amount of change you see in UI's and the effort it 
> takes to write and maintain these tests.

I have to disagree here.  While they are a pain in the neck to maintain,
our selenium tests have turned up numerous problems.  Just recently we
discovered a problem with using a shared data cache on certain objects.
It also helps tests session-bound contexts.

Since Selenium uses an XPath-like syntax for DOM navigation, you can
write tests that generally work even after UI changes.

-- 
Kevin

Re: Unit testing web apps

Posted by Malcolm Edgar <ma...@gmail.com>.
I think writing unit tests for DAO/Service classes is OK, but going up
to the UI tier is not worth the effort. This is due to the amount of
change you see in UI's and the effort it takes to write and maintain
these tests.

regards Malcolm Edgar

On 6/13/07, Fredrik Liden <fl...@translate.com> wrote:
> Do you have any recommendations/guide lines for testing a Cayenne web
> application. Do I need a combination of cactus for the web pages and
> jUnit for the service layer and data objects? Would I be able to access
> the cayenne data context from within the setup and tear down functions.
> Or should I consider this testing as a completely separate application
> from the current web app since the test is not running as a servlet and
> can't get the context from there? How do you guys test your apps?
>
> Thanks!
> Fredrik
>

Re: Unit testing web apps

Posted by Mike Kienenberger <mk...@gmail.com>.
Selenium is what the Apache MyFaces project uses.

On 6/13/07, Fredrik Liden <fl...@translate.com> wrote:
> Thanks both,
>
> Yeah I'm guessing the UI layer is not as important as long as the service classes doesn't crumble if there's some UI bugs. Selenium looks quite interesting though. Peter, if I test the classes as plain java classes I'm guessing I would have to use
>
> DataContext context = DataContext.createDataContext();
> DataContext.bindThreadDataContext(context);
>
> Fredrik
>
>
> -----Original Message-----
> From: Peter Schröder [mailto:Peter.Schroeder@freenet-ag.de]
> Sent: Wednesday, June 13, 2007 12:35 AM
> To: user@cayenne.apache.org
> Subject: AW: Unit testing web apps
>
> hi fredrik,
>
> we use simple junit tests for testing the service layer of our webapps. in the service layer we receive a datacontext via the cayenne servlet-listener using DataContext.getThreadedDataContext(). so we do a DataContext.bindThreadedDataContext(newContext) in the setup-method of the unit-test.
>
> for testing the webapp there are several possibilites: html-unit, selenium ...
>
> kind regards
> peter
>
> -----Ursprüngliche Nachricht-----
> Von: Fredrik Liden [mailto:fliden@translate.com]
> Gesendet: Mittwoch, 13. Juni 2007 02:47
> An: user@cayenne.apache.org
> Betreff: Unit testing web apps
>
> Do you have any recommendations/guide lines for testing a Cayenne web
> application. Do I need a combination of cactus for the web pages and
> jUnit for the service layer and data objects? Would I be able to access
> the cayenne data context from within the setup and tear down functions.
> Or should I consider this testing as a completely separate application
> from the current web app since the test is not running as a servlet and
> can't get the context from there? How do you guys test your apps?
>
> Thanks!
> Fredrik
>

RE: Unit testing web apps

Posted by Fredrik Liden <fl...@translate.com>.
Thanks both,

Yeah I'm guessing the UI layer is not as important as long as the service classes doesn't crumble if there's some UI bugs. Selenium looks quite interesting though. Peter, if I test the classes as plain java classes I'm guessing I would have to use 

DataContext context = DataContext.createDataContext();
DataContext.bindThreadDataContext(context); 

Fredrik


-----Original Message-----
From: Peter Schröder [mailto:Peter.Schroeder@freenet-ag.de] 
Sent: Wednesday, June 13, 2007 12:35 AM
To: user@cayenne.apache.org
Subject: AW: Unit testing web apps

hi fredrik,

we use simple junit tests for testing the service layer of our webapps. in the service layer we receive a datacontext via the cayenne servlet-listener using DataContext.getThreadedDataContext(). so we do a DataContext.bindThreadedDataContext(newContext) in the setup-method of the unit-test.

for testing the webapp there are several possibilites: html-unit, selenium ...

kind regards
peter

-----Ursprüngliche Nachricht-----
Von: Fredrik Liden [mailto:fliden@translate.com] 
Gesendet: Mittwoch, 13. Juni 2007 02:47
An: user@cayenne.apache.org
Betreff: Unit testing web apps

Do you have any recommendations/guide lines for testing a Cayenne web
application. Do I need a combination of cactus for the web pages and
jUnit for the service layer and data objects? Would I be able to access
the cayenne data context from within the setup and tear down functions.
Or should I consider this testing as a completely separate application
from the current web app since the test is not running as a servlet and
can't get the context from there? How do you guys test your apps? 

Thanks!
Fredrik

AW: Unit testing web apps

Posted by Peter Schröder <Pe...@freenet-ag.de>.
hi fredrik,

we use simple junit tests for testing the service layer of our webapps. in the service layer we receive a datacontext via the cayenne servlet-listener using DataContext.getThreadedDataContext(). so we do a DataContext.bindThreadedDataContext(newContext) in the setup-method of the unit-test.

for testing the webapp there are several possibilites: html-unit, selenium ...

kind regards
peter

-----Ursprüngliche Nachricht-----
Von: Fredrik Liden [mailto:fliden@translate.com] 
Gesendet: Mittwoch, 13. Juni 2007 02:47
An: user@cayenne.apache.org
Betreff: Unit testing web apps

Do you have any recommendations/guide lines for testing a Cayenne web
application. Do I need a combination of cactus for the web pages and
jUnit for the service layer and data objects? Would I be able to access
the cayenne data context from within the setup and tear down functions.
Or should I consider this testing as a completely separate application
from the current web app since the test is not running as a servlet and
can't get the context from there? How do you guys test your apps? 

Thanks!
Fredrik