ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Flemming Haurum <>
Subject RE: JUnit and loading external test data from file
Date Sat, 21 Jun 2003 07:41:58 GMT
Thank you all for the help, the getResourceAsStream was the right solution
to my problem.


 -----Original Message-----
From: 	Christopher Lenz [] 
Sent:	18. juni 2003 17:45
To:	Ant Users List
Subject:	Re: JUnit and loading external test data from file

W. Sean Hennessy wrote:
> You might consider decoupling your test code dependencies from Ant and
> bundle the testdatafile.txt in a testresoures.jar file.
> Better mechanisms might be found in a java.list.
> getResourceAsStream("testdatafile.txt");

No need to create a JAR for that.
Simply copy the test resource files into the same directory into which the 
corresponding test classes get compiled:

     |-- mypackage
     |    |-- MyTest.class
     |    |-- MyTestInput.txt

Then using MyTest.class.getResourceAsStream("MyTestInput.txt") should work.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message