users@jersey.java.net

Re: [Jersey] testing Jersey web-service

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 25 Nov 2008 08:51:56 +0100

In addition you can look at the spring sample, which also has unit
tests:

http://download.java.net/maven/2/com/sun/jersey/samples/spring-annotations/1.0/spring-annotations-1.0-project.zip

I guess it depends if you want to do true unit testing or use the unit
test framework for functional tests.

If you search the mail archive [1] you can find emails related to
mocking up tests from other users. I am sure we could make it easier
to mock up stuff but it is something i do not have that much
experience in, so perhaps others would have better ideas on how this
can be improved.

Paul.

[1] http://markmail.org/search/?q=list%3Anet.java.dev.jersey.users+mock

On Nov 25, 2008, at 5:54 AM, Srinivas Naresh Bhimisetty wrote:

> Hi John,
>
> you could use one of the light-weight containers to do what you
> want. In fact, most of the Jersey samples have unit tests where the
> resources are deployed to light-weight containers like
> EmbeddedGlassfish, Grizzly or HTTPServer.
>
> You might want to have a look at these samples [1], or a bundle of
> these samples is available at
> [1] https://jersey.dev.java.net/source/browse/jersey/trunk/jersey/samples/
> [2] http://download.java.net/maven/2/com/sun/jersey/samples/jersey-samples/1.0/jersey-samples-1.0-project.zip
>
> The helloworld-webapp sample uses the "EmbeddedGlassfish" for
> deployments.
>
> Also, the development of a test framework is going on. This
> framework could be used to run the tests on a set of light-weight
> containers.
>
> Hope this helps,
> Naresh
>
> John O'Conner wrote:
>> Now that I have a couple GET methods implemented, I would like to
>> create JUnit tests. I'd like to run these tests without deploying
>> the entire ws to JBoss. Does anyone have any suggestions for how to
>> test a Jersey web service without actually deploying? I'm also
>> using Spring....I've heard about mock classes with Spring...maybe
>> that can help me mock the db connection, maybe the app server too?
>>
>> Regards,
>> John O'Conner
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>