Junit测试用例未使用Maven运行

问题描述

我正在尝试为以下pom运行Maven测试。但是没有任何测试重新开始。尽管在Maven测试中,它表明测试正在编译中。我正在使用JUnit 4.12。我尝试了几件事,发现父pom引起了问题。如果我删除了父pom并给出了自己的组ID和工件ID,则它可以正常工作。

能否请我解释一下为什么它不能与父pom一起使用并提供解决方案。

<parent>
    <groupId>com.test</groupId>
    <artifactId>test-parent</artifactId>
    <version>20.6.0</version>
</parent>

<artifactId>ai_one_click</artifactId>
<name>one_click</name>
<packaging>jar</packaging>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>com.test</groupId>
        <artifactId>data_model</artifactId>
    </dependency>

    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-mockito2</artifactId>
        <version>2.0.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4</artifactId>
        <version>2.0.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>2.23.4</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.1</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <plugins>
        
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.1</version>
            <executions>
                <execution>
                    <configuration>
                        <includes> <include>**/Test1.java</include> </includes>
                    </configuration>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ ai_one_click ---
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-cli) @ ai_one_click ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to one_click\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.1:test (default-cli) @ ai_one_click ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0,Failures: 0,Errors: 0,Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

我尝试了各种maven命令

  1. clean surefire:test
  2. 清洁测试
  3. clean -D maven.test.failure.ignore = true编译器:测试编译surefire:测试
  4. test -Dtest = Test1

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...