What are you unhappy about? Those tests look pretty simple and slick
to me!

It looks like the JettyTestServer is a singleton inside the test suite
- what happens if you have another test suite? I think you'd then hit
the same problem that I did, when the second test suite tries to fire
up Jetty it will fail because Lift has already been initialized.

- Alex

On Nov 10, 2:25 pm, David Pollak <[email protected]>
wrote:
> I've just committed simple API test code up to the ESME project.  The key
> pieces are at:
>
> http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/test/sca...http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/test/sca...
>
> After spending 30 minutes with the Lift TestKit, I'm wicked unhappy with
> it... but that will change later today. ;-)
>
>
>
> On Tue, Nov 10, 2009 at 9:51 AM, Alex Black <[email protected]> wrote:
>
> > My first unit test worked fine, but my second one dies:
>
> > ERROR - Failed to Boot
> > java.lang.IllegalStateException: Cannot modify after boot.
> >        at net.liftweb.http.RulesSeq$class.safe_$qmark(LiftRules.scala:885)
> >        at net.liftweb.http.RulesSeq$class.prepend(LiftRules.scala:892)
> >        at net.liftweb.http.RulesSeq$$anon$3.prepend(LiftRules.scala:872)
> > ....
>
> > Presumably because it has already loaded and started Lift, and my
> > second unit test fires up Jetty again trying to start Lift again which
> > I take it is not supported.
>
> > So, I figure I should either:
> > a. refactor my tests so that I only create one jetty and lift instance
> > ever
> > - this will probably require 'resetting' the service somehow to ensure
> > a blank slate between each unit test, not sure how I get a hold of the
> > instance in question for that
>
> > b. somehow launch jetty/lift differently, or force lift to cleanup?
>
> > On Nov 9, 10:50 pm, Jonathan Ferguson <[email protected]> wrote:
> > > We fire up Jetty populate a temp database and then run a batch of tests.
> > > Seems to work well for us.
>
> > > Jono
>
> > > 2009/11/10 Alex Black <[email protected]>
>
> > > > Can anyone suggest some good examples or strategies to use to test a
> > > > webservice written with Lift?
>
> > > > I've started down the path of firing up Jetty in a unit test, then
> > > > just hitting it with say a GET and checking the response.  Whats a
> > > > good way of firing up Jetty?  It looks like using ServletTester would
> > > > be the way to go:
>
> >http://www.christianschenk.org/blog/testing-web-applications-with-jetty/
>
> > > > could that work with Lift?
>
> > > > - Alex
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Surf the harmonics
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to