Re: JUnit for testing EOs
Re: JUnit for testing EOs
- Subject: Re: JUnit for testing EOs
- From: Chuck Hill <email@hidden>
- Date: Mon, 26 Nov 2007 22:34:23 -0800
Hi Paul,
On Nov 26, 2007, at 9:50 PM, Paul Hoadley wrote:
I can't quite get any tests running which try to instantiate
EOs. I get the stack trace appended below, leading off with
"Unabled to find an EOClassDescription for objects of class
net.logicsquad.am.model.auth.Country". I'm trying to follow the
subsection "JUnit and Eclipse" in chapter 1 of "Practical
WebObjects",
but obviously the book is a few versions behind in all the
tools. From the Run dialog, I select the test class > Classpath
tab > then I've tried adding to both "Bootstrap Entries" and
"User Entries" the folder /AM/build/AM.woa/Contents/Resources/
Java, but I get no joy with either. Am I adding the right folder
to the right place?
Add it to User Entries. It also needs to go above the other
entries in the class path. If the model (or any other resource)
is in a framework, you also need to add the Resources/Java dir for
that to User Entries above the default stuff.
Hmm, well AFAICS I've done that:
<pastedGraphic.png>
Yes, that looks correct. Can you take a look in /AM/build/AM.woa/
Contents/Resources to ensure the eomodel is in there and has the
entities.
Something also may have changed in WO. I have a rather, er, funky
build setup and run the Ant builder at each build. So I always have
a properly formed framework. If you are using the incremental
builder (as most people are), the problem might be related to this.
I don't think so, but it might be. It is definitely related to
NSBundle resource loading and NSBundle is very path sensitive.
The models are not in frameworks. I am still getting "Unabled
[sic!] to find an EOClassDescription".
I love that error message. :-)
Hmmm, just registered that this is an application. I never (or darn
rarely) unit test apps. Does adding /AM/build/AM.woa/Contents/ to
the build path help? Try making that the working directory on the
arguments tab.
(As an aside, do I need to go through this for every single test
class I create?)
Not sure what you are doing there... I create a
"AllTestsSuite.java" for each project and have that instantiate
the test classes. So I only need to set up the launcher once for
each project, for AllTestsSuite. Does that make sense?
Yes it does. I'm also pretty new to JUnit, and was just trying to
get a single test class going.
To be honest, I'm not wedded to the idea of JUnit. If TestNG is
simpler to get going, I'll go take a look at that instead.
It is not going to fix this NSBundle finding its resources issue.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden