You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Jeremy Boynes <jb...@apache.org> on 2006/03/10 05:35:01 UTC

How the tomcat integration tests work

The integration tests in the tomcat module are a little different from
other in our build. Although they use JUnit they are not unit tests. The
JUnit framework is used because it is natively understood by Maven so
these tests are easily integrated into the build - they just run, no
special setup is needed.

These tests, however, do not unit test the internals of the code in the
tomcat model. Instead, they boot a Tomcat server, deploy web
applications to it and then send HTTP requests to it to exercise the
applications. Rather than use a standalone Tomcat installation, they use
the embedding API; with the way Tomcat works, this is actually the same
API used by the Catalina main() method so we are basically booting
Tomcat as normal.

The only real difference here is the request/response objects used to
pass the request into Tomcat. We could have submitted the request by
starting a Coyote connector on a socket and connected to it over the
network. However, experience in the past has shown that this can be
problematic for users given other applications that may have ports open,
machines lacking network cards, some firewall configurations, and
believe it or not some JVM versions. Instead, the tests use their own
versions of Request and Response that do not depend on the Coyote
network transport.

I added these tests recently as part of the Tomcat integration work and
so far they only cover a couple of the scenarios. It would be good to
add additional tests to increase the number of scenarios and the
coverage. The same technique can also be used in other modules (such as
web services) that require some form of web server integration.

Any questions, please drop a note to this list.

Cheers
Jeremy