[英]TestNG I can't properly configure my classpath
I'm running my testng tests using ant. 我正在使用ant运行testng测试。 I get a noclassdeffounderror.
我收到一个noclassdeffounderror。 I believe it is becuase I'm not setting my classpath properly but I can't seem to figure it out.
我认为这是因为我没有正确设置我的类路径,但我似乎无法弄清楚。 `
`
<!-- 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>`
Any help is greatly appreciated.This is the error: Caused by: java.lang.ClassNotFoundException: org.springframework.test.context.testng.AbstractTestNGSpringContextTests 非常感谢任何帮助。这是错误:由以下原因引起:java.lang.ClassNotFoundException:org.springframework.test.context.testng.AbstractTestNGSpringContextTests
It seems that the lib folder I had all my jars in was fine but the path declaration was wrong somehow. 我所有的jar都放在lib文件夹中似乎很好,但是路径声明不正确。 This is what I added to solve the problem.
这就是我为解决问题而添加的内容。
<path id="testng.classpath"> <fileset dir="${Libs}"> <include name="**/*.jar"/> </fileset> </path>
I removed the Libs pathelement from the ant task and replaced it with a reference to the testng.classpath and all my classes were found. <path id="testng.classpath"> <fileset dir="${Libs}"> <include name="**/*.jar"/> </fileset> </path>
我从库中删除了Libs pathelement ant任务并将其替换为对testng.classpath的引用,并找到了我所有的类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.