Things in src/test/resources are in the class path. So, you can open
streams to them with getClass().getResourceAsStream("name").

Or, move it to src/test/data, and then configure a system prop in surefire like:

     <data>${basedir}/src/test/data</data>

and do System.getProperty("data") in your junit test.



On Wed, Feb 9, 2011 at 9:20 PM, tom rider <mlubin...@hotmail.com> wrote:
>
> Environment: Maven version 2.2.1       JUnit version 3.8.1
> My JUnit test case reads the input file. I put this file into
> src/test/resources folder.
>  In JUnit the following line gives me FileNotFoundException
>  File f = new File("myfile");
>
> Question: how to specify in pom.xml file that my test input files are
> located inside src/test/resources folder?
> --
> View this message in context: 
> http://maven.40175.n5.nabble.com/FileNotFoundException-while-reading-static-input-file-in-JUnit-tp3378700p3378700.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to