I am trying to set up DBUnit test AND test EO stuff also.
It seems the testrunner environment is very different than the normal environment that EOF operates under; I can't use EOF to do fetches. If I try,
java.lang.IllegalArgumentException: An object store for the entity "Patient" could not be found. Verify that the entity is defined in an EOModel, and that the model is installed properly. To see what models are loaded, you can try printing the return value of EOModelGroup.defaultGroup() in your application. at com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:536) at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4114)
Of course the fetches work with a normal Application launch, but not in the test environment; many missing resources.
I looked at WOUnitTest,
but it has a WOOUTMAIN web component that calls
public WOComponent saveSettings() { setSettings(); try { WOUTTestRunner.savePreferences(); } catch (java.io.IOException e) { NSLog.err.appendln("WOUT failed to save settings because " + e); } return context().page(); }
now public class WOUTTestRunner extends BaseTestRunner
BUT there is no WOUTTestRunner.savePreferences(); at least under junit 3.8.1
So what does work for testing database/EOF?
Thanks,
Greg |