Creating relative path during Junit test run? [message #271844] |
Tue, 30 June 2009 21:10 |
Eclipse User |
|
|
|
Originally posted by: riwright.adobe.com
I try to be a good citizen and write Junit tests as I go along. Eclipse
helps out a lot there. But one problem I have run into is creating new
files relative to my workspace, ideally in a sub-folder of the Junit test or
similar. Normally I would do something like
Ifile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new
Path("zot.txt"));
This works fine when I am in a running plugin. But when used in a Junit
test I get the message "Workbench closed".
What's the right way to do this? I'll keep poking, but if anyone knows the
right answer, I would be appreciative.
TIA, Ric
|
|
|
|
Re: Creating relative path during Junit test run? [message #271935 is a reply to message #271844] |
Thu, 02 July 2009 17:43 |
Eclipse User |
|
|
|
Originally posted by: riwright.adobe.com
Pilot error on my part, in effect. I was launching the JUnit test directly
rather than via the JUnit plugin. Once I did that, I was in business.
Ric
On 6/30/09 2:10 PM, in article C66FCD60.2C214%riwright@adobe.com, "Ric
Wright" <riwright@adobe.com> wrote:
> I try to be a good citizen and write Junit tests as I go along. Eclipse
> helps out a lot there. But one problem I have run into is creating new
> files relative to my workspace, ideally in a sub-folder of the Junit test or
> similar. Normally I would do something like
>
> Ifile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new
> Path("zot.txt"));
>
> This works fine when I am in a running plugin. But when used in a Junit
> test I get the message "Workbench closed".
>
> What's the right way to do this? I'll keep poking, but if anyone knows the
> right answer, I would be appreciative.
>
> TIA, Ric
>
|
|
|
Powered by
FUDForum. Page generated in 0.05977 seconds