I’m developing a RESTful webservice in Java. For Integrationtesting I use a separate project, which uses the jersey client to access the webservice.
During development I deploy the artifacts on a local glassfish, so the Base URL for the Integrationtests is something like http://localhost:8080/MyWebApplication/myServlet/. I run the integration tests from within Netbeans against the local appserver.
I use jenkins to build, deploy and execute the integration tests on the test system. Once deployed on the test system, the Base URL is different, more like this: https://test.myproduct.com/myProductName/. Reverse proxies route the traffic to application servers.
Today the URL is a final static String in one of the integrationtest classes. How can use get Jenkins (or Netbeans, if that’s easier) to provide the Base URL to an integration test?
If you are using maven, the natural solution is to use different profiles: http://maven.apache.org/guides/introduction/introduction-to-profiles.html has a discussion of exactly your problem. In Jenkins you can easily pick the correct profile.
If you are not using maven, the solution is still to not use a hard coded string value, but to pick up the value from an external property.