WOUnitTest

From: Brendan Duddridge (brenda..lickspace.com)
Date: Sun Sep 05 2004 - 13:13:16 EDT

  • Next message: Brendan Duddridge: "Re: WOUnitTest"

    Hi,

    Has anyone successfully used the WOUnitTest framework from within Eclipse by
    selecting Run as Junit Test from the Run menu?

    I can get it to work if I run the application and access the
    http://localhost/cgi-bin/WebObjects/TestApp.woa/wa/uta Direct Action, but if
    I just run as a Junit Test from within Eclipse, I get the following error:

    java.lang.IllegalStateException: Unabled to find an EOClassDescription for
    objects of class com.clickspace.driveit.dimodel.Address
        at
    com.webobjects.eocontrol.EOGenericRecord.__setClassDescription(EOGenericReco
    rd.java:98)
        at
    com.webobjects.eocontrol.EOGenericRecord.<init>(EOGenericRecord.java:72)
        at com.clickspace.driveit.dimodel._Address.<init>(_Address.java:18)
        at com.clickspace.driveit.dimodel.Address.<init>(Address.java:17)
        at
    com.clickspace.driveit.tests.AddressTestCase.testCreateAddressFromContact(Ad
    dressTestCase.java:39)
        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:324)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at com.codefab.wounittest.WOUTTestCase.runBare(WOUTTestCase.java:82)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
    nner.java:421)
        at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
    java:305)
        at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
    .java:186)

    Is there anything special that has to be done to get the tests to run like
    this? The code dies right on the line where I create a new Address object.
    Herešs my test case class:

    /*
     * Created on Sep 3, 2004
     */
    package com.clickspace.driveit.tests;

    import java.util.*;

    import com.clickspace.driveit.dimodel.*;
    import com.codefab.wounittest.*;
    import com.webobjects.eoaccess.*;

    /**
     *..uthor brendan
     */
    public class AddressTestCase extends WOUTTestCase {

        /*
         *..ee TestCase#setUp()
         */
        protected void setUp() throws Exception {
            super.setUp();
        }

        /*
         *..ee TestCase#tearDown()
         */
        protected void tearDown() throws Exception {
            super.tearDown();
        }

        public void testCreateAddressFromContact() {
            Address address = new Address(); // <--- Code dies here
            address.setPostalCode("T3A 5T4");
            editingContext.insertObject(address);
            assertInvalidForSave(address);
            assertValidForSave(address);
        }

    }

    Thanks,

    ___________________________

    Brendan Duddridge

    ClickSpace Interactive Inc.
    Suite L100
    239 - 10th Ave SE
    Calgary, AB T2G 0V9
    Canada
    (403) 277-5591
    http://www.clickspace.com/



    This archive was generated by hypermail 2.0.0 : Sun Sep 05 2004 - 13:13:24 EDT