Unable To Read Properties File Using JUnit Plugin

Hi,


I'm sure there's a simple solution to this problem. I've got a two module project, Module A and Module B. In Module A, I have a test source directory and I can run all of my JUnit Tests in that directory just fine. The JUnit tests inherit Module A's JDK and classpath.

However, when I run ModuleA itself, I get logging output. It looks in the Working directory and finds my logging.properties file and poof ... logging. But when I run a test of a class in Module A, again using the same classpath, no logging ... can't find my logging.properties file.

I've even gone so far as to add the exact directory where this file resides back into ModuleA's classpath. Still no dice.

How can I get com.intellij.rt.execution.junit2.JUnitStarter to find my properties files? What's the trick?

Thanks,


Michael

2 comments

Hi,

Try this:

Go to the "edit configurations" dialogue and pick the "JUnit" tab. Select "edit defaults", and add this VM property:

-Dlog4j.configuration=file:/path/to/your/log4j.properties

This is not the fault of IDEA, by the way, but how Junit handles logging. To create the same effect in my Junit ANT target, I had to do the following:

... ]]>

Hope this helps!

~Keith




0

Perfect. You are a prince among men.

0

Please sign in to leave a comment.