当前位置: 首页 > 知识库问答 >
问题:

无法使用maven运行spring启动测试:未执行任何测试

叶智
2023-03-14

我无法使用maven运行spring boot应用程序的测试。我看过很多关于这个的帖子,他们的大多数解决方案是:

  • 将junit版本与maven surefire插件或
  • 确保junit版本不是由父元素预定义的

我的项目不使用父级,也不使用专家-sure-fire插件。否则,根据pom文件,我没有看到任何明显的冲突。我确实看到了 junit:jar:4.13.2,但这是向后兼容性的纯复古依赖性的一部分。

是什么导致了这种情况?

Spring-Boot:  (v2.4.3)
Camunda Platform: (v7.15.0)
Camunda Platform Spring Boot Starter: (v7.15.0)

Apache Maven 3.6.3 
Java version: 11.0.8, vendor: Azul Systems, Inc., runtime: C:\Program Files (x86)\Zulu\zulu-11
OS name: "windows 10", version: "10.0", arch: "x86", family: "windows"

砰的一声

<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.myapp</groupId>
  <artifactId>myappdemo</artifactId>
  <version>1.0.0-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.4.3</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.camunda.bpm</groupId>
        <artifactId>camunda-bom</artifactId>
        <version>7.15.0</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.camunda.bpm.springboot</groupId>
      <artifactId>camunda-bpm-spring-boot-starter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.camunda.bpm.springboot</groupId>
      <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
    </dependency>
    <dependency>
      <groupId>org.camunda.bpm.springboot</groupId>
      <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
    </dependency>
    <dependency>
      <groupId>org.camunda.bpm</groupId>
      <artifactId>camunda-engine-plugin-spin</artifactId>
    </dependency>
    <dependency>
      <groupId>org.camunda.spin</groupId>
      <artifactId>camunda-spin-dataformat-all</artifactId>
    </dependency>
    <dependency>
      <groupId>org.camunda.bpm.springboot</groupId>
      <artifactId>camunda-bpm-spring-boot-starter-test</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
    </dependency>
    <dependency>
      <groupId>com.oracle.database.jdbc</groupId>
      <artifactId>ojdbc11</artifactId>
      <version>21.4.0.0.1</version>
    </dependency>
    <dependency>
      <groupId>com.oracle.database.jdbc</groupId>
      <artifactId>ucp11</artifactId>
      <version>21.4.0.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-mail</artifactId>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.6.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-junit-jupiter</artifactId>
      <version>3.2.4</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.pdfbox</groupId>
      <artifactId>pdfbox</artifactId>
      <version>2.0.24</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>2.4.3</version>
        <configuration>
          <layout>ZIP</layout>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>

mvn 依赖项:树

[INFO] +- org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter:jar:7.15.0:compile
[INFO] |  +- org.camunda.bpm:camunda-engine-spring:jar:7.15.0:compile
[INFO] |  |  +- org.camunda.bpm:camunda-engine:jar:7.15.0:compile
[INFO] |  |  |  +- org.camunda.bpm.model:camunda-bpmn-model:jar:7.15.0:compile
[INFO] |  |  |  |  \- org.camunda.bpm.model:camunda-xml-model:jar:7.15.0:compile
[INFO] |  |  |  +- org.camunda.bpm.model:camunda-cmmn-model:jar:7.15.0:compile
[INFO] |  |  |  +- org.camunda.bpm.dmn:camunda-engine-dmn:jar:7.15.0:compile
[INFO] |  |  |  |  +- org.camunda.bpm.model:camunda-dmn-model:jar:7.15.0:compile
[INFO] |  |  |  |  +- org.camunda.bpm.dmn:camunda-engine-feel-api:jar:7.15.0:compile
[INFO] |  |  |  |  +- org.camunda.bpm.dmn:camunda-engine-feel-juel:jar:7.15.0:compile
[INFO] |  |  |  |  +- org.camunda.bpm.dmn:camunda-engine-feel-scala:jar:7.15.0:compile
[INFO] |  |  |  |  \- org.camunda.feel:feel-engine:jar:scala-shaded:1.13.1:compile
[INFO] |  |  |  +- org.camunda.commons:camunda-commons-typed-values:jar:7.15.0:compile
[INFO] |  |  |  +- org.mybatis:mybatis:jar:3.5.6:compile
[INFO] |  |  |  +- joda-time:joda-time:jar:2.1:compile
[INFO] |  |  |  +- org.camunda.connect:camunda-connect-core:jar:1.5.2:compile
[INFO] |  |  |  \- org.camunda.connect:camunda-connect-connectors-all:jar:1.5.2:runtime
[INFO] |  |  \- commons-dbcp:commons-dbcp:jar:1.4:compile
[INFO] |  |     \- commons-pool:commons-pool:jar:1.6:compile
[INFO] |  +- org.springframework:spring-context:jar:5.3.4:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:5.3.4:compile
[INFO] |  |  +- org.springframework:spring-core:jar:5.3.4:compile
[INFO] |  |  |  \- org.springframework:spring-jcl:jar:5.3.4:compile
[INFO] |  |  \- org.springframework:spring-expression:jar:5.3.4:compile
[INFO] |  +- org.springframework:spring-jdbc:jar:5.3.4:compile
[INFO] |  +- org.springframework:spring-tx:jar:5.3.4:compile
[INFO] |  +- org.springframework:spring-orm:jar:5.3.4:compile
[INFO] |  +- org.springframework.boot:spring-boot-loader-tools:jar:2.4.3:compile
[INFO] |  |  \- org.apache.commons:commons-compress:jar:1.20:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.4.3:compile
[INFO] |  |  \- org.springframework.boot:spring-boot:jar:2.4.3:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.4.3:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.4.3:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.13.3:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
[INFO] |  |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.27:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.11:compile
[INFO] |  \- com.fasterxml.uuid:java-uuid-generator:jar:3.2.0:compile
[INFO] +- org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-rest:jar:7.15.0:compile
[INFO] |  +- org.camunda.bpm:camunda-engine-rest-jaxrs2:jar:7.15.0:compile
[INFO] |  |  +- commons-fileupload:commons-fileupload:jar:1.4:compile
[INFO] |  |  +- commons-io:commons-io:jar:2.8.0:compile
[INFO] |  |  +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.11.4:compile
[INFO] |  |  +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.11.4:compile
[INFO] |  |  +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.11.4:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.4:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.4:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.11.4:compile
[INFO] |  \- org.springframework.boot:spring-boot-starter-jersey:jar:2.4.3:compile
[INFO] |     +- org.springframework.boot:spring-boot-starter-validation:jar:2.4.3:compile
[INFO] |     |  \- org.hibernate.validator:hibernate-validator:jar:6.1.7.Final:compile
[INFO] |     +- org.glassfish.jersey.core:jersey-server:jar:2.32:compile
[INFO] |     |  +- org.glassfish.jersey.core:jersey-common:jar:2.32:compile
[INFO] |     |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.3:compile
[INFO] |     |  +- org.glassfish.jersey.core:jersey-client:jar:2.32:compile
[INFO] |     |  +- jakarta.ws.rs:jakarta.ws.rs-api:jar:2.1.6:compile
[INFO] |     |  +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.32:compile
[INFO] |     |  +- org.glassfish.hk2.external:jakarta.inject:jar:2.6.1:compile
[INFO] |     |  \- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |     +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.32:compile
[INFO] |     +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.32:compile
[INFO] |     +- org.glassfish.jersey.ext:jersey-bean-validation:jar:2.32:compile
[INFO] |     +- org.glassfish.jersey.ext:jersey-spring5:jar:2.32:compile
[INFO] |     |  +- org.glassfish.jersey.inject:jersey-hk2:jar:2.32:compile
[INFO] |     |  |  \- org.glassfish.hk2:hk2-locator:jar:2.6.1:compile
[INFO] |     |  |     \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.6.1:compile
[INFO] |     |  +- org.glassfish.hk2:hk2:jar:2.6.1:compile
[INFO] |     |  |  +- org.glassfish.hk2:hk2-utils:jar:2.6.1:compile
[INFO] |     |  |  +- org.glassfish.hk2:hk2-api:jar:2.6.1:compile
[INFO] |     |  |  +- org.glassfish.hk2:hk2-core:jar:2.6.1:compile
[INFO] |     |  |  +- org.glassfish.hk2:hk2-runlevel:jar:2.6.1:compile
[INFO] |     |  |  \- org.glassfish.hk2:class-model:jar:2.6.1:compile
[INFO] |     |  |     +- org.ow2.asm:asm:jar:7.1:compile
[INFO] |     |  |     +- org.ow2.asm:asm-analysis:jar:7.1:compile
[INFO] |     |  |     +- org.ow2.asm:asm-commons:jar:7.1:compile
[INFO] |     |  |     +- org.ow2.asm:asm-tree:jar:7.1:compile
[INFO] |     |  |     \- org.ow2.asm:asm-util:jar:7.1:compile
[INFO] |     |  \- org.glassfish.hk2:spring-bridge:jar:2.6.1:compile
[INFO] |     \- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.32:compile
[INFO] |        \- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.32:compile
[INFO] +- org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-webapp:jar:7.15.0:compile
[INFO] |  +- org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-webapp-core:jar:7.15.0:compile
[INFO] |  |  \- org.camunda.bpm.webapp:camunda-webapp:jar:classes:7.15.0:compile
[INFO] |  \- org.camunda.bpm.webapp:camunda-webapp-webjar:jar:7.15.0:compile
[INFO] +- org.camunda.bpm:camunda-engine-plugin-spin:jar:7.15.0:compile
[INFO] |  \- org.camunda.spin:camunda-spin-core:jar:1.10.1:compile
[INFO] +- org.camunda.spin:camunda-spin-dataformat-all:jar:1.10.1:compile
[INFO] |  +- org.camunda.commons:camunda-commons-logging:jar:1.10.0:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] |  \- org.camunda.commons:camunda-commons-utils:jar:1.10.0:compile
[INFO] +- org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-test:jar:7.15.0:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-test:jar:2.4.3:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-test:jar:2.4.3:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.4.3:compile
[INFO] |  |  +- com.jayway.jsonpath:json-path:jar:2.4.0:compile
[INFO] |  |  |  \- net.minidev:json-smart:jar:2.3:compile
[INFO] |  |  |     \- net.minidev:accessors-smart:jar:1.2:compile
[INFO] |  |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] |  |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
[INFO] |  |  +- org.assertj:assertj-core:jar:3.18.1:compile
[INFO] |  |  +- org.hamcrest:hamcrest:jar:2.2:compile
[INFO] |  |  +- org.skyscreamer:jsonassert:jar:1.5.0:compile
[INFO] |  |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:compile
[INFO] |  |  +- org.springframework:spring-test:jar:5.3.4:compile
[INFO] |  |  \- org.xmlunit:xmlunit-core:jar:2.7.0:compile
[INFO] |  +- org.junit.vintage:junit-vintage-engine:jar:5.7.1:compile
[INFO] |  |  +- org.apiguardian:apiguardian-api:jar:1.1.0:compile
[INFO] |  |  +- org.junit.platform:junit-platform-engine:jar:1.7.1:compile
[INFO] |  |  \- junit:junit:jar:4.13.2:compile
[INFO] |  \- org.camunda.bpm.assert:camunda-bpm-assert-assertj3-11-1:jar:4.0.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:2.4.3:compile
[INFO] |  +- org.springframework:spring-aop:jar:5.3.4:compile
[INFO] |  +- org.springframework.security:spring-security-config:jar:5.4.5:compile
[INFO] |  |  \- org.springframework.security:spring-security-core:jar:5.4.5:compile
[INFO] |  \- org.springframework.security:spring-security-web:jar:5.4.5:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.4.3:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.4.3:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.4:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.4:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.4.3:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.43:compile
[INFO] |  |  +- org.glassfish:jakarta.el:jar:3.0.3:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.43:compile
[INFO] |  +- org.springframework:spring-web:jar:5.3.4:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.3.4:compile
[INFO] +- mysql:mysql-connector-java:jar:8.0.23:runtime
[INFO] +- com.h2database:h2:jar:1.4.200:compile
[INFO] +- com.oracle.database.jdbc:ojdbc11:jar:21.4.0.0.1:compile
[INFO] +- com.oracle.database.jdbc:ucp11:jar:21.4.0.0.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.4.3:compile
[INFO] |  \- com.zaxxer:HikariCP:jar:3.4.5:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.4.3:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:2.4.3:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.9.6:compile
[INFO] |  +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] |  +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.4.28.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.27.0-GA:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.10.20:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.2.3.Final:compile
[INFO] |  |  +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] |  |  +- org.dom4j:dom4j:jar:2.1.3:compile
[INFO] |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.2.Final:compile
[INFO] |  |  \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3:compile
[INFO] |  |     +- org.glassfish.jaxb:txw2:jar:2.3.3:compile
[INFO] |  |     \- com.sun.istack:istack-commons-runtime:jar:3.0.11:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:2.4.5:compile
[INFO] |  |  \- org.springframework.data:spring-data-commons:jar:2.4.5:compile
[INFO] |  \- org.springframework:spring-aspects:jar:5.3.4:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:2.4.3:compile
[INFO] |  +- org.springframework:spring-context-support:jar:5.3.4:compile
[INFO] |  \- com.sun.mail:jakarta.mail:jar:1.6.5:compile
[INFO] |     \- com.sun.activation:jakarta.activation:jar:1.2.2:compile
[INFO] +- org.junit.jupiter:junit-jupiter:jar:5.6.0:test
[INFO] |  +- org.junit.jupiter:junit-jupiter-api:jar:5.7.1:test
[INFO] |  |  +- org.opentest4j:opentest4j:jar:1.2.0:compile
[INFO] |  |  \- org.junit.platform:junit-platform-commons:jar:1.7.1:compile
[INFO] |  +- org.junit.jupiter:junit-jupiter-params:jar:5.7.1:test
[INFO] |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.7.1:test
[INFO] +- org.mockito:mockito-junit-jupiter:jar:3.2.4:test
[INFO] |  \- org.mockito:mockito-core:jar:3.6.28:compile
[INFO] |     +- net.bytebuddy:byte-buddy-agent:jar:1.10.20:compile
[INFO] |     \- org.objenesis:objenesis:jar:3.1:compile
[INFO] \- org.apache.pdfbox:pdfbox:jar:2.0.24:compile
[INFO]    +- org.apache.pdfbox:fontbox:jar:2.0.24:compile
[INFO]    \- commons-logging:commons-logging:jar:1.2:compile
[INFO] ------------------------------------------------------------------------

共有2个答案

阎德宇
2023-03-14

我的项目不使用父级也不使用maven-surefire插件

如果没有maven surefire插件,您将如何运行junit测试

实际上,maven有一个默认绑定的概念,当它为特定的包装预定义插件和版本时。对于Apache Maven 3.6.3maven-surefire-plugin的默认版本是2.12,2.22中引入了对junit-jupiter的基本支持-您要么需要设置maven-surefire-plugin,要么切换到最新版本的maven。

孙帅
2023-03-14

首先升级您的Spring Boot版本(因为有点过时或更准确的不支持),然后再升级您的Maven版本(也过时了)……还定义junit-bom来定义正确的junit jupiter版本,如下所示:

  <dependency>
    <groupId>org.junit</groupId>
    <artifactId>junit-bom</artifactId>
    <version>5.8.2</version>
    <scope>import</scope>
    <type>pom</type>
  </dependency>

这必须在导入spring boot依赖项之前完成,以正确覆盖spring boot依赖项提供的版本。

另外,你没有使用spring boot作为父插件,这意味着你必须定义所有需要的maven插件。基于此,您将使用通过打包绑定定义的默认绑定。

我强烈建议在您的插件中使用适当的版本定义所有需要的插件,以确保使用定义的插件版本,这些版本在未来永远不会改变。这使您的构建可重复。

正确支持JUnit Jupiter的第一个版本是maven-surefire-plugin (2.22.2)...我强烈建议使用最新版本。

更多细节将在第一个和第二个视频中介绍

 类似资料:
  • 问题内容: 当我使用以下命令在Maven中运行单个测试时: 我得到以下结果: 它在几分钟前工作了,但是现在由于某种原因停止了工作。在运行测试之前,我尝试运行几次,但没有帮助。 测试看起来像这样: }} 更新: 这是由于将此依赖项添加到POM: 当我删除它时,一切正常。即使我添加以下两个依赖关系而不是上一个依赖关系,一切也都可以正常工作: 真奇怪 问题答案: 您可能正在类路径上的某个地方拾取了JUn

  • 我遇到了无法使用Maven运行JUnit5测试的问题。在IDE中运行它们工作正常,但使用“mvn测试”会产生以下输出: 这是我的测试课程: pom: 我做了一些研究,我认为这可能与混合JUnit4和JUnit5特性有关,这导致maven surefire插件无法运行测试。然而,我找不到那些剩余的JUnit4特性可能在哪里。我将感谢任何帮助。

  • 我无法用PHPUnit解决测试问题。这是我的密码,有点问题。这是年度百分比计算(https://en.wikipedia.org/wiki/Annual_percentage_rate ). 在cmd中: 不要考虑Oracle模块,这是另一回事。我在“composer安装”之后运行了“phpunit”。 项目/测试/测试概述。php: 项目/phpunit.xml 我解决不了,试了很多次:(

  • 尝试完成Spring Boot教程:https://Spring.io/guides/gs/spring-boot/#initial 以下是我的课程: 和pom.xml: 当我尝试使用以下命令运行它时:“mvn package&&java-jar target/gs-spring-boot-0.1.0.jar”,我得到的是: “-dmaven.home=C:\program files\jetbr

  • 问题内容: 我在Eclipse中创建了一个新的maven项目,该项目通过使用HtmlUnitDriver和FirefoxDriver来调出一个网页并检查页面标题来运行简单测试。当我运行maven命令mvn test时,这就是我得到的一切: 当我在Eclipse中运行相同的Maven命令时,它显示以下内容: 这是我的pom.xml,供那些想要检查是否可能是问题的人使用: 问题答案: 您是说要添加为P

  • 我有一个rest Spring Boot rest API,我想测试它。我可以在Eclipse中手动运行测试(不使用maven,并通过将应用程序作为JUnit测试运行),它运行良好并显示结果,但是不能“工作”,如下所示。 以下是我的POM文件: