我正在使用ant运行我的testng测试。我得到了一个noclassdeffounderror。我相信这是因为我没有正确设置我的类路径,但我似乎无法弄明白。 `
<!-- This is the command that will be run when the tests are run from outside the vob and for
SWIT purposes. The only test that should be run is the SWIT group which is the only test
needed for SWIT in the jar file. -->
<target name="run-swit-tests">
<tstamp>
<format property="touch.time" pattern="MM_dd_yyyy_hh_mm_aa" offset="-5" unit="hour" />
</tstamp>
<echo>Exluding non-SWIT groups: ${nonswit.groups}</echo>
<testng outputdir="reports"
haltonfailure="false" verbose="2" excludedgroups="${nonswit.groups}">
<classpath>
<pathelement path="${TestClasses}"/>
<pathelement path="${Libs}"/>
</classpath>
<jvmarg value="-Dtangosol.coherence.cacheconfig=foo.xml" />
<jvmarg value="-Dtangosol.coherence.override=bar.xml" />
<jvmarg value="-Dtangosol.coherence.distributed.localstorage=false" />
<jvmarg value="-Dtangosol.pof.enabled=true" />
<jvmarg value="-Dtangosol.coherence.management=all" />
<jvmarg value="-Dtangosol.coherence.member=${user.name}-${touch.time}" />
<jvmarg value="-javaagent:lib/org.springframework.instrument-3.0.5.RELEASE.jar" />
<classfileset dir="." includes="**/Test*.class" excludes="**/Abstract*.class ${excluded.tests}"/>
<reporter>
<property name="generateGroupsAttribute" value="true" />
</reporter>
</testng>
</target>`
非常感谢任何帮助。这是错误:引起:java.lang.ClassNotFoundException:org.springframework.test.context.testng.AbstractTestNGSpringContextTests
答案 0 :(得分:0)
似乎我的所有罐子里面的lib文件夹都很好,但路径声明在某种程度上是错误的。这是我为解决问题而添加的内容。
<path id="testng.classpath">
<fileset dir="${Libs}">
<include name="**/*.jar"/>
</fileset>
</path>
我从ant任务中删除了Libs的元素,并将其替换为对testng.classpath的引用,并找到了我的所有类。