Testing and Workspace Deletion [message #332297] |
Fri, 17 October 2008 14:18  |
Eclipse User |
|
|
|
I have a collection of tests that create several projects and files within
the workspace that are repeatedly cleared before each JUnit test:
@Before
public void clearWS() {
IWorkspace ws = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = ws.getRoot();
try {
root.delete(true, true, null);
} catch (CoreException e) {
fail(UNABLE_EMPTY_WS_MSG);
}
}
The first several tests always run successfully while the last half (~8)
randomly pass or fail, with the failure occurring because the resource
cannot be deleted (CoreException). All of the tests write files into the
workspace in the same manner, so I don't understand why clearing the
workspace sometimes fails.
My only thought is that there is a lock on a file or folder resource, but
I am closing all of my file streams after writing.
Any thoughts on this would be appreciated,
J
|
|
|
|
Powered by
FUDForum. Page generated in 0.03509 seconds