我有以下pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.manning.junitbook</groupId>
<artifactId>ch13-continuous</artifactId>
<version>1.0-SNAPSHOT</version>
<name>ch13-continuous</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<sonar.coverage.jacoco.xmlReportPaths>target\site\jacoco\jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.junit.reportPaths>target\surefire-reports</sonar.junit.reportPaths>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
</dependencies>
我的目录/test/java/es.ull/flights和/test/java/es.ull/passenger中分别有一些名为“flighttests”和“passengertests”的测试。然而,当我在intellij上启动mvn测试时,它最终显示了以下内容:
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
为什么会这样??我想可以´我没有定位我的测试,但我没有´我不知道为什么。
2条答案
按热度按时间bfrts1fy1#
也许你可以试试新版本。
你也可以使用jupiter和jupiter depencies尝试junit5。例如,使用jupiter依赖中的@test注解。
uklbhaso2#
您有一些名为“flighttests”和“passengertest”的测试文件,这就是问题所在,请您通过删除末尾的s将名称更改为“flighttest”和“passengertest”,否则它将无法识别测试。我已经核实过了。