Search code examples
mavenintegration-testingcargo

maven cargo integration test - how to get cargo.hostname or profile?


I'm using Maven 2 w/ cargo to deploy to different remote tomcats depending on the maven profile used.

I also have integration tests (junit w/ remote webservice calls) that I would like to automatically run.

Question: How do I setup my test code to be able to read either the cargo.hostname (preferred, changed property value based on maven profile) or the maven profile actived so it knows which url to go run the tests against?

Specifically, this is in java in the test case.

Thanks!


Solution

  • Either you define a fixed value for the cargo.hostname (not the best; but sometimes it workds well, cause using a fixed test server) or better define an appropriate property in Maven for it and put the information also into a properties file which will be filtered by the build process in the src/test/resources folder which can be read before the real integration tests.