mvn 无法从终端在自定义位置执行 testNG 类

给定文件夹结构:


theProject/src/com/myclass/tests/api/APITest

其中包声明是:


package com.myclass.tests.api;

它使用来自 testng 的 @Test。


在 pom.xml 中,我包含了构建部分:


<build>

    <testSourceDirectory>${project.basedir}/</testSourceDirectory>

     <plugins>

        <plugin>

          <groupId>org.apache.maven.plugins</groupId>

          <artifactId>maven-surefire-plugin</artifactId>

          <version>2.19.1</version>

          <configuration>

                    <includes>

                        <include>**/*Test.class</include>

                        <include>**/*test.class</include>

                        <include>src/com/myclass/tests/api/*Test.class</include>

                    </includes>

                </configuration>

        </plugin>

    </plugins>

  </build>

我试图在 theProject 文件夹(pom.xml 找到)中执行以下命令。


mvn test -Dtest=com.myclass.tests.api.*

但结果给出:


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project theProject: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]

我应该如何从 mvn 运行测试?


茅侃侃
浏览 232回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java