出错原因:

测试代码执行的文件需要从target文件夹中获取。如下:

因此,需要在pom.xml中加入代码,生成target文件夹及正确的路径, 才能执行test。

代码:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <testFailureIgnore>true</testFailureIgnore>
        </configuration>
      </plugin>
    </plugins>
  </build>

有用就点个赞叭 QAQ

更多推荐

【已解决】surefire-reports for the individual test results.