Standard directory layout is defined there :
http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
so, if you want to respect maven best practices, you'll put your test resources in
src/test/resources and subdirectories. This directiry can be configured in your pom
(http://maven.apache.org/maven-model/maven.html#class_testResource).
All test resources will be copied to target/test-classes and attached to classpath when maven will
run tests. In your test class, the best way to access to your test resources is to use
getClass().getResources( resourceName ) or getClass().getResourceAsStream( resourceName )
Emmanuel
Dave Hoffer a écrit :
In Maven what is the best practice of referencing test files for use in
unit tests?
Prior to using Maven, we will typically load test files with code like
this in our test classes "./TestData/Parameters/Reflectance.xml". This
doesn't work in Maven as the current directory is different. Maven
seems to want the files in the \test\resources\ folder but this gets
copied to the target folder.
What is the best practice given that both Maven and the IDE (in our case
IntelliJ) have to be able to run the tests?
-dh
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]