users@jersey.java.net

[Jersey] Re: Best Library to Unit Test Jersey Restful Web Services?

From: Mark Thornton <mthornton_at_optrak.com>
Date: Thu, 4 Sep 2014 09:38:00 +0100

No probably about it. Tests with a real server are essential. Quite a few
of the problems I have encountered are server specific.

Mark Thornton

On Thursday, 4 September 2014, Mikael Ståldal <
mikael.staldal_at_appearnetworks.com> wrote:

> One point of abstracting away the server and running tests in-memory is to
> improve the execution time of these tests, it makes it possible to have
> them as unit tests. This is especially nice if you can embed the database
> as well (you can use HSQLDB or H2 if you use a relational SQL database).
>
> But you should probably have some integration tests with a real server as
> well.
>
>
> On Thu, Sep 4, 2014 at 6:41 AM, Ted M. Young [@jitterted] <
> tedyoung_at_gmail.com <javascript:_e(%7B%7D,'cvml','tedyoung_at_gmail.com');>>
> wrote:
>
>> Agree with Gili here. I do exactly that (though I have the advantage of
>> using Dropwizard, which makes testing via an embedded Jetty instance
>> trivial). And since you're using MongoDB, there's also the Embedded MongoDB
>> (https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo) which
>> helps keep your tests isolated from one another.
>>
>> ;ted
>>
>>
>>
>> --
>> Ted M. Young
>> about.me/tedmyoung
>> [image: Ted M. Young on about.me]
>> <http://about.me/tedmyoung>
>>
>>
>> On Wed, Sep 3, 2014 at 8:53 PM, cowwoc <cowwoc_at_bbs.darktech.org
>> <javascript:_e(%7B%7D,'cvml','cowwoc_at_bbs.darktech.org');>> wrote:
>>
>>> In my experience, you're better interacting directly with an embedded
>>> server (such as Jetty) rather than using JerseyTest which attempts to
>>> abstract away the server. I've never really understood the point of
>>> abstracting away the server and I find their abstraction to be leaky (at
>>> least, this was the case in the past).
>>>
>>> Gili
>>>
>>>
>>> On 03/09/2014 10:26 PM, Paul O'Fallon wrote:
>>>
>>> Have you taken a look at JerseyTest? It supports many different
>>> containers, including an in-memory one...
>>>
>>> On Wednesday, September 3, 2014, Andre Perez <andre.perez1501_at_gmail.com
>>> <javascript:_e(%7B%7D,'cvml','andre.perez1501_at_gmail.com');>> wrote:
>>>
>>>> I am using JDK 1.7, Jersey 2.12, Tomcat 7, MongoDB and RestAssured
>>>> <https://code.google.com/p/rest-assured/> to unit test my Rest
>>>> calls... The issue is that RestAssured needs Tomcat to be running with my
>>>> war file, in order, to work. Is there an embedded server or in-memory
>>>> server along with a different unit testing framework which I can use to
>>>> test my Restful Web Services (basically without be tightly coupled to an
>>>> external server)? Would love to hear people's suggestions regarding best
>>>> practices?
>>>>
>>>
>>>
>>
>
>
> --
> Mikael Ståldal
> Chief Software Architect
> *Appear*
> Phone: +46 8 545 91 572
> Email: mikael.staldal_at_appearnetworks.com
> <javascript:_e(%7B%7D,'cvml','mikael.staldal_at_appearnetworks.com');>
>