Re: JUnit testing outside Eclipse
Re: JUnit testing outside Eclipse
- Subject: Re: JUnit testing outside Eclipse
- From: Chuck Hill <email@hidden>
- Date: Fri, 6 Aug 2010 08:48:58 -0700
On Aug 6, 2010, at 4:08 AM, Paul Hoadley wrote:
> Hello,
>
> Having recently set up a Hudson build server, I am now trying to get some JUnit tests running as part of the build, and hence outside of Eclipse. I have a test suite for a framework which I've previously run manually in Eclipse just fine, but it's evident that Eclipse is providing quite a bit of help with the classpath. I'm about half way through manually tracking down all the locations of classes on which the test suite depends (javafoundation.jar, javaeoacess.jar, javaeocontrol.jar, log4j-1.2.14.jar...), and have almost got the tests running outside Eclipse. Is this the only way to do it? Or am I missing an easier way?
Yes? Are you using the WO-fu of wopath?
<!-- Non-source Classpath for project-->
<wopath id="project.classpath">
<frameworks root="User" eclipse="true" />
<frameworks root="Local" eclipse="true" />
<frameworks root="System" eclipse="true" />
<path refid="project.jars" /> <!-- See below for example -->
</wopath>
<property name="ProjectJars" value="${the.basedir}${file.separator}ERJars${file.separator}Libraries" />
<path id="project.jars">
<fileset dir="${ProjectJars}" includes="*.jar" />
</path>
And then (this is TestNG, but JUnit is very similar)
<target name="unit.test" depends="init.all, set_framework_build_properties" if="has.unit.tests">
<testng workingdir="${project.working.directory}"
outputDir="${test.report.dir}/${database.type}"
sourcedirref="${project.source.path}"
haltOnfailure="false"
dumpCommand="true" parallel="false">
<!-- Pass values to net.hhshoppers.hh.testng.EOTestSuite.java -->
<jvmarg value="-DDBType=${database.type}" />
<jvmarg value="-DJDBCUrl=${database.url}" />
<jvmarg value="-DJDBCDriver=${database.driver}" />
<jvmarg value="-DDBUserName=${database.userid}" />
<jvmarg value="-DDBPassword=${database.password}" />
<!-- Enable coverage reporting if the classes are instrumented -->
<jvmarg value="-Demma.coverage.out.file=${emma.coverage.out.file}" />
<jvmarg value="-Demma.coverage.out.merge=${emma.coverage.out.merge}" />
<!-- Make sure the tests run with enough memory -->
<jvmarg value="-Xmx768m" />
<classpath refid="project.classpath"/>
<classpath>
<fileset dir="${project.java.dir}" includes="**/*.jar" />
</classpath>
<xmlfileset dir="Testing/" includes="${unit.test.suite}"/>
</testng>
</target>
--
Chuck Hill Senior Consultant / VP Development
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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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