Passing arguments to Junit classes from ant?

R

Roy Smith

I'm using Junit under ant. Some of my test cases need to read files
which contain test data. I don't mind imbedding the file names in the
test cases, but I'd like to have the name of the directory where the
data files are stored parameterized in the build.xml file.

What's the best was to pass information like that from build.xml down
into the test cases? I was sort of under the impression that ant
properties showed up as Java properties accessable via
System.getProperty(), but they don't seem to.
 
J

John C. Bollinger

Roy said:
I'm using Junit under ant. Some of my test cases need to read files
which contain test data. I don't mind imbedding the file names in the
test cases, but I'd like to have the name of the directory where the
data files are stored parameterized in the build.xml file.

What's the best was to pass information like that from build.xml down
into the test cases? I was sort of under the impression that ant
properties showed up as Java properties accessable via
System.getProperty(), but they don't seem to.

Specify system properties explicitly by passing "-Dname-value" as a
<jvmarg> when you spawn JUnit.


John Bollinger
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top