Hi Dirk,
I've used the way suggested in http://blog.vogella.com/2010/07/06/reading-resources-from-plugin/ to read in XML files and also made sure that the xml/ directory is present in build.properties/bin.includes list.
1. Loading XML
+    private MenuModel loadMenuModelFrom(String testFileLocation) {
+        String fileUrlString = "platform:/plugin/" + PLUGIN_ID + testFileLocation;
+        InputStream inputStream = null;
+        try {
+            URL fileUrl = new URL(fileUrlString);
+            inputStream = fileUrl.openConnection().getInputStream();
+        } catch (MalformedURLException e) {
+            fail("The URL is invalid: " + fileUrlString);
+        } catch (IOException e) {
+            // inputStream = null;
+        }
+        return new XMLParser().readMenuModel(inputStream);
     }
2. Packaging XML with the binary
-> cat build.properties 
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
               .,\
               xml/
It works both from Tycho and from Eclipse.
Kind regards, 
Mikhail Kalkov 
Purple Scout AB 
Software Developer
Address: Kyrkogatan 20-22, SE-41110 Gothenburg, Sweden
Phone:   +46 (0) 732 - 051405
E-mail:  mikhail.kalkov@xxxxxxxxxxxxxx
Web:     www.purplescout.se
Från: "Dirk Fauth" <dirk.fauth@xxxxxxxxx>
Till: tycho-user@xxxxxxxxxxx
Skickat: torsdag, 5 sep 2013 16:48:58
Ämne: [tycho-user] getResource() in test cases
Hi,
I came across some strange behaviour when running my test cases with tycho.
I have created an eclipse-test-plugin with using the tycho-surefire-plugin
The tycho-surefire-plugin is configured to run a test suite by applying the arguments for testSuite and testClass.
My test cases need to load and process XML files that are provided in the sources.
I tried two scenarios:
a) put the XML file relative to the test class and load the file via <classname>.class.getResource()
b) put the XML file to src/test/resources and load via this.getClass().getResource()
The first approach is some generic one, the second is Maven specific.
For a) I found the XML file in the compiled target/classes folder respectively to the package it should be in.
For b) the XML file is located in target/test-classes.
So far everything is working as intended. If I run my JUnit test from within Eclipse, everything works as expected for both scenarios. But when running the tests with Tycho, in both cases I get errors saying "The given file does not exist!"
I've found the mailing list entry here 
http://dev.eclipse.org/mhonarc/lists/tycho-user/msg04534.html but it doesn't contain a hint on a solution.
Is there any progress on that? Am I doing things wrong to load resources for my test cases? Is there a solution I haven't found anywhere?
It would be great if you could give me some feedback on that.
Greez,
Dirk
 
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user