Maven故障安全:集成测试无法识别单个集成测试

时间:2019-01-22 18:36:51

标签: java maven maven-failsafe-plugin

我已经能够获得Maven的故障安全模块,以成功检测并运行针对虚拟项目(link to GitHub repo)的集成测试文件中的测试。但是,当我尝试对现有项目中的模块执行相同的操作时,出现错误,提示未执行任何测试。

这是我所讨论的模块的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
   <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns="http://maven.apache.org/POM/4.0.0"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
     http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
        <artifactId>common</artifactId>
        <groupId>DOMAIN</groupId>
        <version>1.0-SNAPSHOT</version>
     </parent>

     <modelVersion>4.0.0</modelVersion>
     <groupId><DOMAIN></groupId>
     <artifactId>aws-service-utilities</artifactId>
     <version>1.0-SNAPSHOT</version>
     <packaging>jar</packaging>

     <!-- Dependencies omitted, pretty sure they're irrelevant to this issue -->

     <build>
         <plugins>
             <plugin>
                  <artifactId>maven-failsafe-plugin</artifactId>
                  <version>2.22.0</version>
                  <executions>
                      <execution>
                          <goals>
                              <goal>integration-test</goal>
                              <goal>verify</goal>
                          </goals>
                      </execution>
                  </executions>
              </plugin>
          </plugins>
       </build>
    </project>

这是我要检测到的集成测试:

YahooParserIT.java

package com.<DOMAIN>.tests;

import org.junit.Test;
/* Omitting some unnecessary imports */
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.Before;
import org.junit.jupiter.api.TestInstance;

@PowerMockIgnore("javax.management.*")
@RunWith(PowerMockRunner.class)
@PrepareForTest({S3AsyncClient.class, AmazonS3ClientBuilder.class, AmazonS3.class})
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class YahooParserIT {

    @Before
    public void before() {
        TestSetupUtils.prepareS3ServiceUtil();
    }

    @Test
    public void testParser() throws Exception {
        assertTrue(1 == 1);
    }
}

我在aws-service-utilities模块级别运行命令mvn -Dit.test=YahooParserIT failsafe:integration-test -e,并获得以下输出:

enter image description here

上面的命令在我在这个问题的第一句话中提到的虚拟项目上可以很好地工作。知道为什么它没有检测到单一集成测试吗?

Dropbox指向整个项目的pom.xml的链接:https://www.dropbox.com/s/g8emcyu63g2isq0/pom.xml?dl=0

0 个答案:

没有答案