TestNG的无法从蚂蚁加载测试类 [英] testng fails to load test classes from ant
本文介绍了TestNG的无法从蚂蚁加载测试类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从蚂蚁运行TestNG的测试。阅读的手册后,我想出了:
I'm trying to run TestNG tests from Ant. After reading the manual, I came up with:
<taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="../../lib/testng-6.8.1.jar"/>
<target name="testng" depends="compile-tests" description="Run testng test suite">
<fileset id="mixed.tests" dir="${bin.main}">
<include name="**/*Test.*"/>
</fileset>
<testng mode="mixed" classfilesetref="mixed.tests"
verbose="5"
failureProperty="tests.failed" outputdir="/tmp/report">
<classpath>
<fileset dir="../../lib" includes="*.jar"/>
<fileset dir="../../java/bin/" includes="**/*.class"/>
<fileset dir="/home/y/lib/jars" excludes="junit*jar,messagebus-disc-parent.jar" includes="**/*.jar" description="all jars installed by dependent pacakges" />
</classpath>
</testng>
当我运行它,它失败:
[testng] 'org.testng.TestNG'
[testng] '@/tmp/testng8260935716887369607'
[testng]
[testng] The ' characters around the executable and arguments are
[testng] not part of the command.
[testng] Exception in thread "main" org.testng.TestNGException:
[testng] Cannot load class from file: /home/adamatan/SOME_PATH_THAT_EXISTS/functional/EnforceBasicFilteringTest.class
[testng] at org.testng.internal.ClassHelper.fileToClass(ClassHelper.java:600)
[testng] at org.testng.TestNG.configure(TestNG.java:1393)
[testng] at org.testng.TestNG.privateMain(TestNG.java:1354)
[testng] at org.testng.TestNG.main(TestNG.java:1333)
[testng] The tests failed.
我已经尝试过:
文件和权限:
/home/adamatan/SOME_PATH_THAT_EXISTS/functional/EnforceBasicFilteringTest.class
:
- 出现在classpath中打印(这是很长,所以我不把它放在这里)。
- 是编译目标创建的,所以它是非空的,蚂蚁可以读取其中的内容。
-
的ls -l </ code> -ing该文件具有
-rw-R - R-- 1 adamatan用户4548年11月21 12:19
- Appears in the classpath printout (it's very long, so I don't put it here).
- Is created by the compile target, so it is non-empty, and ant can read its contents.
ls -l
-ing the file gives-rw-r--r-- 1 adamatan users 4548 Nov 21 12:19
都试过 TestNG的模式=TestNG的
和 TestNG的模式=混
。这两个失败,同样的错误。
Tried both testng mode="testng"
and testng mode="mixed"
. Both failed with the same error.
为什么不能阅读TestNG的刚创建这个有效的类文件?
Why can't testng read this valid class file that was just created?
推荐答案
同样的问题被加入到classpath中,其中测试本身的位置(看起来像它的 $ {斌的目录解决了我。主要}你的情况
)。
The same problem was solved for me by adding to the classpath the directory where tests themselves are located (looks like it's ${bin.main}
in your case).
这篇关于TestNG的无法从蚂蚁加载测试类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文