ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Stockall <je...@cryptocard.com>
Subject Re: Passing command line parameter to ant and reading them from within JUnit
Date Thu, 13 Feb 2003 00:45:25 GMT
On Wednesday, February 12, 2003, at 07:31 PM, Tony Obermeit wrote:
> I would like to reference the property values passed
> on the command line to ant within Junit java code.  Is
> this possible?

Yes.

If you run Ant like this:

ant -Dmyprop1=value1 -Dmyprop2=value2

Define your junit target like this:

<junit
	printsummary="yes"
	dir="${classes.dir}">
	<sysproperty key="prop1" value="${myprop1}"/>
	<sysproperty key="prop2" value="${myprop2}"/>
</junit>

Then in your testcases you can do System.getProperty("prop1");

Jesse Stockall - jesse@cryptocard.com
CRYPTOCard Corp.


Mime
View raw message