Ant 不使用testng.xml文件运行testng

Ant 不使用testng.xml文件运行testng,ant,testng,Ant,Testng,是否可以在不传递testng.xml文件的情况下从ant运行testng 我有一个带有@Test注释的类,我打算动态加载它 我在我的项目中使用intellj idea,我只需右键单击该类,但我想创建build.xml以脱离使用idea的需要。TestNG网站上有一个关于如何在不传递xml文件的情况下从Ant运行TestNG任务的链接: <testng classpathref="run.cp" outputDir="${testng.report.dir}" haltOnF

是否可以在不传递testng.xml文件的情况下从ant运行testng

我有一个带有@Test注释的类,我打算动态加载它

我在我的项目中使用intellj idea,我只需右键单击该类,但我想创建build.xml以脱离使用idea的需要。

TestNG网站上有一个关于如何在不传递xml文件的情况下从Ant运行TestNG任务的链接:

<testng classpathref="run.cp"
    outputDir="${testng.report.dir}"
    haltOnFailure="true"M verbose="2">
<classfileset dir="${test.build.dir}" includes="**/*.class" />
</testng>


我正在尝试,但我得到
无法从文件C:\Users\oreyes\ryz\out\build\ryz\compiler\TestCompiler加载类。类
我尝试了一些其他配置(如编写类名和其他),您是否验证了编译的类位于类路径上?是的,但是。。。猜猜看。。。我的类路径不在testng元素doh!中!。。非常感谢。是的,这是正确的方法。请注意,您可以从命令行或ant执行的操作只是testng.xml的一个子集,因此,随着您的测试套件变得更加复杂,我建议切换到testng.xml,这将非常容易。