Eclipse Plugin: Resources not found when running a class as a TestNG Test

1,297 views
Skip to first unread message

Felipe Knorr Kuhn

unread,
Apr 18, 2011, 2:11:32 PM4/18/11
to testng...@googlegroups.com
Hi Cédric,

We have a project here that runs just fine when invoked by Maven or running the testng.xml file.

However, if we right click on a class and select to run as a TestNG test, our properties files are not found (the class is under src/test/java and the properties files are under src/test/resources).

Could this be a bug in the plugin not copying the resources files when compiling the single class?

Thanks,

FK

Cédric Beust ♔

unread,
Apr 18, 2011, 2:36:46 PM4/18/11
to testng...@googlegroups.com
Hi Felipe,

You need to tell Eclipse your resources need to be copied to the build directory, I believe that adding src/test/resources as a source folder should do the trick.

-- 
Cédric


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.



--
Cédric


Mohamed Mansour

unread,
Apr 18, 2011, 2:42:17 PM4/18/11
to testng...@googlegroups.com

I noticed the same thing in JBoss seam projects. I thought I had to deal with that myself. I had to change different resource path depending whether to run it in the eclipse plugin or through ant command line.

So I didn't know if it was testng,  would be great if I could run the tests in eclipse and command line without depending on changing paths.

I could try and submit a patch if it would get accepted.

Kind regards,
Mohamed Mansour

Prashant

unread,
Feb 11, 2014, 7:57:09 AM2/11/14
to testng...@googlegroups.com
I am also facing same problem. Even after making src/test/resources as a source folder, the right click run of individual test does not add  "src/test/resources" into classpath and test fails to find property file in "src/test/resources" folder. Is there any setting available in TestNG plugin to set global classpath?

Thanks,
Prashant

Prashant

unread,
Feb 11, 2014, 8:32:24 AM2/11/14
to testng...@googlegroups.com
My bad... Just restarted eclipse and property file from resources folder got copied into project's output folder (bin) and yes TestNG did picked it up for running individual test case. :)

Thanks,
Prashant
Reply all
Reply to author
Forward
0 new messages