You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Phil Steitz <ph...@steitz.com> on 2003/05/14 17:11:05 UTC

[math] stupid question about test input files

I am bundling up my RandomData, EmpiricalDistribution and ValueServer 
classes for submission and the last two can take file input data.  The 
test cases need to read from a test data file.  Can I assume that this 
file will be available to the test cases with no path spec?

Phil


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [math] stupid question about test input files

Posted by Phil Steitz <ph...@steitz.com>.
Craig R. McClanahan wrote:
> 
> On Wed, 14 May 2003, Phil Steitz wrote:
> 
> 
>>Date: Wed, 14 May 2003 08:11:05 -0700
>>From: Phil Steitz <ph...@steitz.com>
>>Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
>>To: Jakarta Commons Developers List <co...@jakarta.apache.org>
>>Subject: [math] stupid question about test input files
>>
>>I am bundling up my RandomData, EmpiricalDistribution and ValueServer
>>classes for submission and the last two can take file input data.  The
>>test cases need to read from a test data file.  Can I assume that this
>>file will be available to the test cases with no path spec?
>>
> 
> 
> A plain filename with no path will be assumed to exist in the directory
> from which the tests are run -- not necessarily a good assumption.
> 
> FWIW, I normally deal with this sort of thing by including the test files
> in the same package source directory as the test case itself, make sure
> they get copied to the output "classes" directory, and use
> ClassLoader.getResourceAsStream() to load them.  The test cases for
> Digester (among others) use that approach.
> 

Thanks!  I will look at the Digester test cases and follow that pattern.

Phil

> 
>>Phil
> 
> 
> Craig
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [math] stupid question about test input files

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 14 May 2003, Phil Steitz wrote:

> Date: Wed, 14 May 2003 08:11:05 -0700
> From: Phil Steitz <ph...@steitz.com>
> Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> Subject: [math] stupid question about test input files
>
> I am bundling up my RandomData, EmpiricalDistribution and ValueServer
> classes for submission and the last two can take file input data.  The
> test cases need to read from a test data file.  Can I assume that this
> file will be available to the test cases with no path spec?
>

A plain filename with no path will be assumed to exist in the directory
from which the tests are run -- not necessarily a good assumption.

FWIW, I normally deal with this sort of thing by including the test files
in the same package source directory as the test case itself, make sure
they get copied to the output "classes" directory, and use
ClassLoader.getResourceAsStream() to load them.  The test cases for
Digester (among others) use that approach.

> Phil

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org