问题:无法创建任务或输入 testng。原因:名称未定义
我在运行 testng 测试时遇到了一些问题。我使用 ant 任务调用测试,该任务返回以下错误消息:
BUILD FAILED
/**/build.xml:136:问题:无法创建任务或输入 testng
原因:名称未定义。
操作:检查拼写。
操作:检查是否已声明任何自定义任务/类型。
操作:检查是否存在任何
ant 任务如下所示:
<target name="test-start" depends="test-compile" description="Runs the TestNG tests">
<testng
suitename="pseudo test"
haltOnFailure="true"
verbose="2"
groups="pseudoTest">
<classpath refid="test.classpath" />
<classfileset dir="${build.testclasses.dir}" includes="**/*.class" />
</testng>
</target>
<path id="test.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${extralib.dir}/testng-5.13.1.jar" />
<pathelement path="${build.testclasses.dir}" />
</path>
这是测试类:
包**.pseudotest;
导入org.apache.log4j.Logger;
导入 org.testng.annotations.Test;公共类伪测试{
@Test(groups = { "pseudoTest" })
公共无效aSingleTest(){
assert false : "简单测试失败并且不返回 true"; }
}
有人可以帮我解决这个问题
?感谢
BVA
i´ve got a little problem to run a testng test. I invoke the test with a ant task which returns following error message:
BUILD FAILED
/**/build.xml:136: Problem: failed to create task or type testng
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
The ant task looks like this:
<target name="test-start" depends="test-compile" description="Runs the TestNG tests">
<testng
suitename="pseudo test"
haltOnFailure="true"
verbose="2"
groups="pseudoTest">
<classpath refid="test.classpath" />
<classfileset dir="${build.testclasses.dir}" includes="**/*.class" />
</testng>
</target>
<path id="test.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${extralib.dir}/testng-5.13.1.jar" />
<pathelement path="${build.testclasses.dir}" />
</path>
This is the test class:
package **.pseudotest;
import org.apache.log4j.Logger;
import org.testng.annotations.Test;public class PseudoTest {
@Test(groups = { "pseudoTest" })
public void aSingleTest() {
assert false : "The simple test failed and does not return true";
}
}
Can somebody help me to solve this problem?
Thanks
BVA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来您需要将 TestNG 任务添加到 Ant。当遇到
标记时,它不知道要运行哪个类。Sounds like you need to add the TestNG tasks to Ant. It doesn't know what class to run when it encounters the
<testng>
tag.我安装解决了这个问题:
Java EE 基础插件
问题就解决了。
I solved this problem installing:
plugin Java EE Base
and the problem was solved.
我刚刚解决了这个问题,安装:插件Java EE Base,问题就解决了。
me to I just now solved this problem installing: plugin Java EE Base and the problem was solved.