eviltester / blogcomments

1 stars 0 forks source link

2017/12/resource-files-for-tests-java-maven #29

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

How to organise resource files for tests using Maven and Java - EvilTester.com

Resources are a very useful concept in Java. They are essentially files in the project which are compiled into the .jar

Java also has commands for finding them .getResource and reading them .getResourceAsStream

Very Handy.

But, they can be hard to wrap your head around. As evidenced by my own experiences trying to use them and the number of queries on stack overflow.

https://www.eviltester.com/2017/12/resource-files-for-tests-java-maven.html

felipegutierrez commented 4 years ago

thanks! no my unit tests are working with the resource directory.

rajat-prajapati commented 3 years ago

Hi, Its not working for me, I followed all your steps. File configFile= new File(getClass().getClassLoader().getResource("configuration.properties").getFile());

My Project hierarchy is like below. test/resources/configuration.properties Any help will be appreciated, thanks in advance !