Bernd Fondermann wrote:
Niklas Gustavsson wrote:
On Wed, Jul 15, 2009 at 8:03 AM, <[email protected]> wrote:
Author: ngn
Date: Wed Jul 15 06:03:11 2009
New Revision: 794145

URL: http://svn.apache.org/viewvc?rev=794145&view=rev
Log:
Adding integration tests for XEP-0199 XMPP Ping (VYSPER-12). 
AbstractIntegrationTest should go somewhere else once we decide that we want to 
do tests like this.
Alright, this is a first stab at what integration tests (running the
complete server and testing it with an external client) could look
like. Have a look and let me know what you think.

This test perfectly demonstrates the pros and cons of integration
testing of socket based protocols.

All test run within about 5.3 seconds on my machine, probably less on yours.

The integration test _alone_ takes 5 seconds! (Which makes me want to
disable it. Suggestion: Can we move integration tests to a separate
source folder so they can easily be excluded  from running?)

Why is that? The tests sets up the whole server infrastructure. This
adds overhead to the test, but is not the cause for the long running
time. It's Thread.sleep(5000). This is a common problem with testing
async stuff. Maybe we can reduce this to 100 ms, but this might cause
spurious test failures for some, which are hard to reproduce.

A better approach - if possible - would be to have a listener kicking in
when the async processing is finished, causing some kind of continuation
to finish of the test.

In general I'd stick with my original statement to discourage using this
kinds of tests for handlers.
One idea is to define a special profile for such tests (maven profile). Call it 'integration', then you just don't run such tests on a regular basis:
mvn clean install : for standard tests
mvn -clean intsall -Pintegration : for pre-commit tests

Now, having such tests in the base project is good as soon as you just have to run them explicitly. We have done that on ApacheDS, and it saved us a lot of time.

Sadly, you still have to run those tests before committing code, but that's not something you do every five minutes anyway :)

2rupies.

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to