3

testng テストを実行するのに少し問題があります。次のエラー メッセージを返す ant タスクでテストを呼び出します。

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.

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 をインポートします。

public class PseudoTest {

@Test(groups = { "pseudoTest" })
public void aSingleTest() {
assert false : "単純なテストが失敗し、true を返さない"; }
}

誰かがこの問題を解決するのを手伝ってくれますか?

ありがとう

BVA

4

3 に答える 3

1

TestNG タスクを Ant に追加する必要があるようです。<testng>タグに遭遇したときに実行するクラスがわかりません。

于 2010-08-17T12:19:10.833 に答える
0

私はちょうどこの問題をインストールして解決しました:プラグイン Java EE Base そして問題は解決されました。

于 2021-05-30T14:40:19.627 に答える