views:

94

answers:

1

Hi @all,

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

A: 

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.

duffymo
This solved my problem. I added <taskdef resource="testngtasks" classpath="${extralib.dir}/testng5.13.1.jar" />to the build.xml.Thank You!
mmm...