JTF: Running tests against an app deployed on a staging server
By Naresh on Nov 12, 2009
Few days back I saw somebody asking whether the Jersey Test Framework allows you to run your tests on an application which is deployed on a staging server. The answer was NO at that point of time. Then I realized that this is a common use case and that it would be good to add this support.
With this release of Jersey 1.1.4, the Jersey Test Framework now lets you run your tests against your application deployed on a staging server. All that you have to do is just set this property JERSEY_HOST_NAME to the IP Address or the domain name of the machine i.e., the staging server, on which your application is pre-deployed.
Lets say you have your application deployed on a machine with IP 22.214.171.124, tests could be run using the following command on your local machine:
mvn clean test -Dtest.containerFactory=com.sun.jersey.test.framework.spi.container.external.ExternalTestContainerFactory -DJERSEY_HOST_NAME=126.96.36.199 -DJERSEY_HTTP_PORT=<http_port>
- The support for specifying the JERSEY_HOST_NAME is limited only to the external container types.
- Apart from the JERSEY_HOST_NAME you would also need to set the JERSEY_HTTP_PORT to the HTTP port on which your server is listening.
- For more information on the various container types supported by the framework, please refer the previous blog entry on the framework.