为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

茅侃侃 2021-08-04 17:41:18
给定文件夹结构: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 运行测试?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 231 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信