我在运行 testng 测试时遇到了一点问题。我使用返回以下错误消息的 ant 任务调用测试:
BUILD FAILED<br/>
/**/build.xml:136: Problem: failed to create task or type testng<br/>
Cause: The name is undefined.<br/>
Action: Check the spelling.<br/>
Action: Check that any custom tasks/types have been declared.<br/>
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
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>
这是测试类:
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"; }
}
谁能帮我解决这个问题?
谢谢
商业值(value)
最佳答案
听起来您需要将 TestNG 任务添加到 Ant。当遇到 <testng>
时,它不知道要运行什么类标签。
关于java - 问题 : failed to create task or type testng. 原因:名称未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3502123/