I have a run-tests target set up in the base component. I'm having one small 
problem that I hope a junit guru can help me with...

The tests that require properties files are failing with a 
MissingResourceException. I know what the problem is - the classloader can't 
find the properties files, but I can't figure out how to fix it.

Here is the classpath I set up for the junit tests:

    <path id="junit.class.path">
        <fileset dir="${build.dir}/lib" includes="*.jar"/>
        <fileset dir="config" includes="*.properties"/>
        <fileset dir="${lib.dir}" includes="*.jar"/>
        <fileset dir="${lib.dir}/commons" includes="*.jar"/>
        <fileset dir="${lib.dir}/j2eespecs" includes="*.jar"/>
        <fileset dir="${lib.dir}/scripting" includes="*.jar"/>
        <fileset dir="../start/build/lib" includes="*.jar"/>
    </path>

And here is the target:

    <target name="run-tests" depends="jar">
        <junit fork="yes" haltonfailure="yes">
            <test name="org.ofbiz.base.test.BaseUnitTests" />
            <formatter type="plain" usefile="false" />
            <classpath refid="junit.class.path" />
        </junit>
    </target>

Any help would be greatly appreciated!

-Adrian

--- On Thu, 11/19/09, Adrian Crum <[email protected]> wrote:

> From: Adrian Crum <[email protected]>
> Subject: Re: All JUnit tests now pass! Next steps...
> To: [email protected]
> Date: Thursday, November 19, 2009, 1:59 PM
> Thanks for the links! I'll look into
> it further this weekend.
> 
> -Adrian
> 
> Scott Gray wrote:
> > Just because our test tools require container loading
> there is no reason why we couldn't run tests that don't
> require containers and use the junit ant task to run them
> during the test build:
> > http://junit.sourceforge.net/doc/faq/faq.htm#running_5
> > http://ant.apache.org/manual/OptionalTasks/junit.html
> > 
> > That reminds me, we need to upgrade to the latest
> version of JUnit, I'll take care of it this weekend.
> > 
> > Regards
> > Scott
> > 
> > On 20/11/2009, at 10:00 AM, Adrian Crum wrote:
> > 
> >> I guess I was being myopic. Adam mentioned having
> to load the containers, and he's right - most
> component-level tests would require loading OFBiz in order
> for them to work. I was thinking only of the framework/base
> component - where you could run unit tests on the various
> classes found there. That wouldn't require container loading
> (I think).
> >> 
> >> Maybe it's too much of a bother. *shrug*
> >> 
> >> -Adrian
> >> 
> >> 
> >> Scott Gray wrote:
> >>> You can run a single test suite using the main
> build file:
> >>> ant run-single-test-suite
> -Dtest.component=accounting
> -Dtest.suiteName=accountingtests
> >>> it doesn't depend on the build target for some
> reason though but that could easily be changed.
> >>> Is this what you meant or something
> different?
> >>> Regards
> >>> Scott
> >>> On 20/11/2009, at 9:20 AM, Adrian Crum wrote:
> >>>> What I had in mind was something like a
> run-tests ant target in the component's build.xml file. The
> run-tests target would depend on the build target.
> >>>> 
> >>>> That would make code testing really easy
> and convenient: modify code, run-tests, modify code some
> more, run-tests...
> >>>> 
> >>>> -Adrian
> >>>> 
> >>>> Scott Gray wrote:
> >>>>> On 20/11/2009, at 4:43 AM, Adrian Crum
> wrote:
> >>>>>> I would like to build out the unit
> tests in the framework/base component, but I still need help
> getting that component's build.xml file to run tests.
> >>>>> Sorry I meant to look into it when you
> first raised that thread, I'll dig it up and see if I can
> help.
> >>>>> Regards
> >>>>> Scott
> > 
> 


      

Reply via email to