[Lift] Re: Unit testing a RESTful webservice with Lift

2009-11-13 Thread David Pollak
On Fri, Nov 13, 2009 at 8:30 AM, Alex Black  wrote:

>
> another question: is there any way (or need) to stop the Jetty server?
>

No.


>
> Usually running my tests Jetty starts up in about a second or two, but
> once in a while it will take 10s or more, could this have to do with a
> previous instance hanging around or not been shut down properly?
>

Yeah... I notice that as well.  It's a lot worse on my Linux box than on my
Mac.  Oddly, my Mac (2ghz core duo) builds Lift almost as fast as my Linux
desktop (3ghz i7 which runs about 4x faster than the Mac) because the Linux
box has so many waits for Jetty to start.  Would love to get this solved.


>
> On Nov 11, 12:05 pm, David Pollak 
> wrote:
> > On Wed, Nov 11, 2009 at 7:09 AM, Alex Black  wrote:
> >
> > > What are you unhappy about? Those tests look pretty simple and slick
> > > to me!
> >
> > Yeah, but with this change:http://reviewboard.liftweb.net/r/95/
> >
> > You'll get:
> >
> >  "Login" in {
> >   for{
> > login <- post("/api/login", "token" -> token) !@ "Failed to
> > log in" if (testSuccess(login))
> > status <- login.get("/api/status") !@ "Failed to get status"
> > if (testSuccess(status))
> >   } {
> > (status.xml \ "user" \ "@id").text must_== theUser.id.toString
> >   }
> > }
> >
> > > 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.
> >
> > The example in ESME is a singleton, but the start method is actually a
> lazy
> > val, so you can call it from any test, but it will only be triggered once
> > per run per classloader.  Does this give you what you want?  If not,
> it'll
> > be some mucking around with multiple classloaders.
> >
> >
> >
> >
> >
> > > - Alex
> >
> > > On Nov 10, 2:25 pm, David Pollak 
> > > 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..
> ..
> > > ..
> >
> > > > 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 
> 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  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 
> >
> > > > > > > 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
> >
> > --
> > 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
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--~--~-~--~~~---~--~~
You received this m

[Lift] Re: Unit testing a RESTful webservice with Lift

2009-11-13 Thread Alex Black

another question: is there any way (or need) to stop the Jetty server?

Usually running my tests Jetty starts up in about a second or two, but
once in a while it will take 10s or more, could this have to do with a
previous instance hanging around or not been shut down properly?

On Nov 11, 12:05 pm, David Pollak 
wrote:
> On Wed, Nov 11, 2009 at 7:09 AM, Alex Black  wrote:
>
> > What are you unhappy about? Those tests look pretty simple and slick
> > to me!
>
> Yeah, but with this change:http://reviewboard.liftweb.net/r/95/
>
> You'll get:
>
>  "Login" in {
>       for{
>         login <- post("/api/login", "token" -> token) !@ "Failed to
> log in" if (testSuccess(login))
>         status <- login.get("/api/status") !@ "Failed to get status"
> if (testSuccess(status))
>       } {
>         (status.xml \ "user" \ "@id").text must_== theUser.id.toString
>       }
>     }
>
> > 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.
>
> The example in ESME is a singleton, but the start method is actually a lazy
> val, so you can call it from any test, but it will only be triggered once
> per run per classloader.  Does this give you what you want?  If not, it'll
> be some mucking around with multiple classloaders.
>
>
>
>
>
> > - Alex
>
> > On Nov 10, 2:25 pm, David Pollak 
> > 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
> > ..
>
> > > 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  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  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 
>
> > > > > > 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
>
> --
> 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Unit testing a RESTful webservice with Lift

2009-11-11 Thread Alex Black
Looks nice.

Singleton - ah, yes, that sounds like it will work well, good call.

On Wed, Nov 11, 2009 at 12:05 PM, David Pollak <
feeder.of.the.be...@gmail.com> wrote:

>
>
> On Wed, Nov 11, 2009 at 7:09 AM, Alex Black  wrote:
>
>>
>> What are you unhappy about? Those tests look pretty simple and slick
>> to me!
>>
>>
> Yeah, but with this change: http://reviewboard.liftweb.net/r/95/
>
> You'll get:
>
>  "Login" in {
>   for{
> login <- post("/api/login", "token" -> token) !@ "Failed to log in" 
> if (testSuccess(login))
> status <- login.get("/api/status") !@ "Failed to get status" if 
> (testSuccess(status))
>   } {
> (status.xml \ "user" \ "@id").text must_== theUser.id.toString
>   }
> }
>
>
>
>> 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.
>>
>
> The example in ESME is a singleton, but the start method is actually a lazy
> val, so you can call it from any test, but it will only be triggered once
> per run per classloader.  Does this give you what you want?  If not, it'll
> be some mucking around with multiple classloaders.
>
>
>
>
>>
>> - Alex
>>
>> On Nov 10, 2:25 pm, David Pollak 
>> 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  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  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 
>> >
>> > > > > 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
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
>
> Follow me: http://twitter.com/dpp
> Surf the harmonics
>
> >
>


-- 
http://blog.alexblack.ca
http://twitter.com/waterlooalex

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Unit testing a RESTful webservice with Lift

2009-11-11 Thread David Pollak
On Wed, Nov 11, 2009 at 7:09 AM, Alex Black  wrote:

>
> What are you unhappy about? Those tests look pretty simple and slick
> to me!
>
>
Yeah, but with this change: http://reviewboard.liftweb.net/r/95/

You'll get:

 "Login" in {
  for{
login <- post("/api/login", "token" -> token) !@ "Failed to
log in" if (testSuccess(login))
status <- login.get("/api/status") !@ "Failed to get status"
if (testSuccess(status))
  } {
(status.xml \ "user" \ "@id").text must_== theUser.id.toString
  }
}



> 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.
>

The example in ESME is a singleton, but the start method is actually a lazy
val, so you can call it from any test, but it will only be triggered once
per run per classloader.  Does this give you what you want?  If not, it'll
be some mucking around with multiple classloaders.




>
> - Alex
>
> On Nov 10, 2:25 pm, David Pollak 
> 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  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  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 
> >
> > > > > 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
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Unit testing a RESTful webservice with Lift

2009-11-11 Thread Alex Black

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 
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  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  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 
>
> > > > 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Unit testing a RESTful webservice with Lift

2009-11-10 Thread David Pollak
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/scala/org/apache/esme/api/ApiTest.scala?revision=834618&view=markup
http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/test/scala/org/apache/esme/JettySetup.scala?revision=834618&view=markup

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  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  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 
> >
> >
> >
> > > 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 framework http://liftweb.net
Beginning Scala http://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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Unit testing a RESTful webservice with Lift

2009-11-10 Thread Alex Black

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  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 
>
>
>
> > 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
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Unit testing a RESTful webservice with Lift

2009-11-10 Thread Alex Black
Cool, I am trying that out. It seems to work well, but jetty takes abouts 2s
to fire up, any tips on reducing that?

--
From: Jonathan Ferguson 
Sent: Monday, November 09, 2009 10:50 PM
To: liftweb@googlegroups.com
Subject: [Lift] Re: Unit testing a RESTful webservice with Lift

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 

>
> 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
>
>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Unit testing a RESTful webservice with Lift

2009-11-09 Thread Jonathan Ferguson
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 

>
> 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
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Unit Testing

2009-11-02 Thread Randinn

This may help...

http://wiki.github.com/dpp/liftweb/how-to-unit-test-lift-snippets-with-a-logged-in-user


On Nov 3, 4:13 pm, sunanda  wrote:
> Hi,
> How to do unit testing in Lift Framework.
> Sunanda.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---