Using dynamic properties in POM.XML

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Using dynamic properties in POM.XML

This post was updated on .

I'm using Maven to help manage a automated testing project for integrated system-level testing, not unit testing. The project holds the test code, but the device under test is something completely separate. The first test grabs the installer (located externally) and installs the product under test on a remote machine, and then the test code in the Maven project runs remote tests against that deployed product. Works great.

When it's complete, it generates a test report, via the usage of surefire->testNG, and a customized report listener, reportNG. From the POM file, re: reportNG:

<org.uncommons.reportng.title>Automation Test Report</org.uncommons.reportng.title>

This ends up generating a wonderful test report.

I'd like this title to include the build number of the product under test. This is different (and not directly tied to) the version of the Maven project, which is the test code. I'd love to be able to do something like this...

<org.uncommons.reportng.title>Automation Test Report: Product X ${externalProduct.buildNumber}</org.uncommons.reportng.title>

... if ${externalProduct.buildNumber} was a global variable that I could set DURING my testing before testing was complete (but after testing had begun), and then by the time Maven got to generating the report, it would use the value of that global variable, which I had set during the beginning of my testing (part of my testing dynamically figures out what the most recent version is for the device-under-test --- in other words, I don't know what that is until run-time.

Is there any way to get this to work?

Thanks in advance!