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 20:12:53 -0800
Hi Paul,
On Nov 26, 2007, at 3:19 AM, Paul Hoadley wrote:
Hello,
I'm running WO 5.4 on Leopard, Eclipse 3.3.1.1, WOLips 3.3.4667,
and writing some tests with JUnit 4 shipped with Eclipse.
Unrelated to you question, I have moved to TestNG. I find it far
easier to configure and use than JUnit. If you are just getting
started with JUnit, it really is worth a long look.
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",
I think I might have a copy of that around here... :-)
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.
(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?
Chuck
---
java.lang.IllegalStateException: Unabled to find an
EOClassDescription for objects of class
net.logicsquad.am.model.auth.Country
at com.webobjects.eocontrol.EOGenericRecord.__setClassDescription
(EOGenericRecord.java:98)
at com.webobjects.eocontrol.EOGenericRecord.<init>
(EOGenericRecord.java:73)
at net.logicsquad.am.core.LSGenericRecord.<init>
(LSGenericRecord.java:30)
at net.logicsquad.am.model.auth._Country.<init>(_Country.java:16)
at net.logicsquad.am.model.auth.Country.<init>(Country.java:5)
at net.logicsquad.am.test.TestContactDetails.before
(TestContactDetails.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod
(BeforeAndAfterRunner.java:74)
at org.junit.internal.runners.BeforeAndAfterRunner.runBefores
(BeforeAndAfterRunner.java:50)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected
(BeforeAndAfterRunner.java:33)
at org.junit.internal.runners.TestMethodRunner.runMethod
(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run
(TestMethodRunner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod
(TestClassMethodsRunner.java:66)
at org.junit.internal.runners.TestClassMethodsRunner.run
(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected
(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected
(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run
(TestClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run
(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run
(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
(RemoteTestRunner.java:196)
---
--
Paul.
w http://logicsquad.net/
h http://paul.hoadley.name/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
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