简体   繁体   English

我无法正确配置我的类路径

[英]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.

相关问题 Ant-TestNG类路径问题:getResource找不到文件 - Ant-TestNG classpath issue: getResource can't find the file Class.getResource() 在我的 Eclipse 应用程序中返回 null? 无法配置类路径? - Class.getResource() returns null in my Eclipse Application? Can't configure classpath? TestNG类可以并行运行,但方法不能并行运行。 如何配置testng.xml文件和测试类,以便方法也可以并行运行? - TestNG classes run in parallel, but methods don't. How do I configure my testng.xml file and test classes so methods will also run in parrallel? 我找不到我的CLASSPATH,我确定如何设置它? - I can't find my CLASSPATH and I'm sure how to set it? 我在JADE Main Container GUI中的CLASSPATH中找不到代理类 - I can't find my agent class from the CLASSPATH in the JADE Main Container GUI 无法使用 testng 配置运行我的测试 class - Can't run my test class with testng config Eclipse在我的/ test源文件夹中的类路径上找不到类 - Eclipse can't find classes on the classpath in my /test source folder 我的GUI无法正常显示 - I can't get my GUI to display properly 为什么我不能正确地从哈希表中检索? - Why can't I properly retrieve from my hashtable? 如何将使用 testng 的放心测试更改为 cucumber? - How can I change my restassured test using testng into cucumber?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM