maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Wilson <>
Subject Re: maven-failsafe-plugin: what is it actually intended for?
Date Wed, 13 Nov 2013 19:13:00 GMT
FWIW, I tend to think less about the particular definitions and
semantics of testing types and think more about the needs associated
with tests. For tests which depend on deployed resources, etc... I use
failsafe. For tests which can be handled locally whether resources are
mocked or called externally (but for which said execution does not
require deployment- IE sending a request and handling a response)- I
use surefire.

Back to the testing "definitions". In my mind, as others have stated
unit tests are meant to test individual units and features within a
piece of code. Personally, I am willing to include in that features
which depend on multiple modules within a project. To me it is more
philosophical than anything, by the strictest definition I would
imaging Unit tests are meant to test functionality within one class,
such as a method. For instance, say you have a method in a shopping
cart class which creates a new account with data XYZ. The customer
object is created and in that creation generates a predictable user ID
(based on name and birthday for instance).

Integration tests, to me, accomplish two things, they test that these
individual units play nice with each other (particularly across
projects), and they test that a particular compiled project
"integrates" well into its deployed environment. This includes playing
nice with deployed resources, the server environment, etc....

I agree with the statement that time is not a defining parameter in
the discussion of unit vs. integration test. If you are testing
something that just plain takes a lot of time to do (such as a complex
calculation) then it seems that could very plausibly be considered a
unit test- even if it takes an hour (I have written single methods
with that behavior before- computing Fourier series coefficients for
instance). I think the defining quality is what exactly is being
tested and what phase in the project lifecycle it is mean to occur in.

Again though, for purposes of setting up maven, I think it terms of
"which plugin do I actually need". Failsafe is much easier to use for
testing deployed functionality, surefire for unit or "light
integration" functionality (IE between locally testable compilation

I hope that long winded answer helps :s

On Wed, Nov 13, 2013 at 10:05 AM, Ron Wheeler
<> wrote:
> You will probably get better answers.
> On 13/11/2013 12:09 PM, James Green wrote:
>> So where should one place a test that intends on exercising code against
>> something real? We have bits here that involve http calls that pre-date
>> soap and we therefore have no mock.
> It depends on what you are testing.
> If it is a webapp, you may find that you have to put the script in a
> spreadsheet that you give to a human.
> If you have a keystoke emulator, then the script will go in the emulator.
> Integration tests in general would be separate projects.
> Mocks have nothing to do with soap so I am not sure what age has to do with
> testing.
>> A repeat of the second question from my original post: does the integrate
>> test execute against the artefact produced or against the original source
>> code?
> You always want to test against the artifact produced in an integration
> test.
> Unit test is usually in the project that produces the artifact and has to
> pass before the artifact is produced.
> Ron
>> On 13 November 2013 15:59, Stephen Connolly
>> <
>>> wrote:
>>> On 13 November 2013 15:20, James Green <> wrote:
>>>> I love the FAQ entry that states that it is intended for running
>>>> integration tests.
>>>> The next entry should read: What do you call an integration test?
>>> Any test that takes more than 1 second to run is *not* a unit test.
>>> Most tests that take more than 50ms to run are *not* unit tests... but
>>> there can be some exceptions
>>> If a unit test needs to call out to other systems, it will typically use
>>> a
>>> mock.
>>> If your test is actually calling out to other systems (which could be
>>> code
>>> from a dependency, etc - i.e. not just a TCP socket, could be a call
>>> within
>>> JVM) then it is testing the integration of those two parts... therefore
>>> it
>>> is not a unit test.
>>> There is no hard and fast rule as to where the transition occurs... but
>>> we
>>> know that tests who's execution time is greater than 1 second are not
>>> unit
>>> tests... and hence are integration tests...
>>> HTH
>>>> I've asked around and no-one comes up with a consistent answer. I guess
>>> it
>>>> depends on what is executing the integration test. In this case maven is
>>>> invoking someone after the packaging phase so should I expect to run
>>> tests
>>>> against the packaged binary artefact? Is that the purpose here?
>>>> Thanks,
>>>> James
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email:
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message