I have an Eclipse project with the following directory structure:
MyProj/
src/main/java/
com.me.myproject.widgets
Widget.java
src/main/config
widget-config.xml
src/test/java
com.me.myproject.widgets
WidgetTest.java
src/test/config
widget-test-config.xml
The Widget
class reads its config (XML) file in from anywhere on the classpath and uses it to configure its properties.
I am trying to just get WidgetTest
's test cases (all written with JUnit) to run inside Eclipse when I right-click the file and go to Run As >> JUnit Test
. I assume I'll have to actually run it as a customized Run Configuration with its own configured classpath, but I'm not sure about that as I've never done this before.
Does anybody know how I can get a custom Run Configuration to run WidgetTest.java
as a JUnit test, and successfully place src/test/config/widget-test-config.xml
on the classpath? Thanks in advance!
Please note, this question is not about how to read a resource from the runtime classpath, its about how to get it on Eclipse's JUnit Run Config classpath in the first place!