测试类运行失败:TestEngine with ID ‘junit-jupiter‘ failed to discover tests

背景:原本我的项目是可以运行的,然后我用另外一台电脑拉了下来,也是可以用的,但是很奇怪,用着用着就不能用了。报了以下错误:

/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=57098:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/shaonaiyi/.m2/repository/org/junit/platform/junit-platform-launcher/1.8.2/junit-platform-launcher-1.8.2.jar:/Users/shaonaiyi/.m2/repository/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar:/Users/shaonaiyi/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/Users/shaonaiyi/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar:/Users/shaonaiyi/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit5-rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit-rt.jar:/Users/shaonaiyi/IdeaProjects/mybatis-plus-learning/demo/target/test-classes:/Users/shaonaiyi/IdeaProjects/mybatis-plus-learning/demo/target/classes:/Users/shaonaiyi/app/mvn_repos/org/springframework/boot/spring-boot-starter/2.7.13/spring-boot-starter-2.7.13.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/boot/spring-boot/2.7.13/spring-boot-2.7.13.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/spring-context/5.3.28/spring-context-5.3.28.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/spring-aop/5.3.28/spring-aop-5.3.28.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/spring-beans/5.3.28/spring-beans-5.3.28.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/spring-expression/5.3.28/spring-expression-5.3.28.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/boot/spring-boot-autoconfigure/2.7.13/spring-boot-autoconfigure-2.7.13.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/boot/spring-boot-starter-logging/2.7.13/spring-boot-starter-logging-2.7.13.jar:/Users/shaonaiyi/app/mvn_repos/ch/qos/logback/logback-classic/1.2.12/logback-classic-1.2.12.jar:/Users/shaonaiyi/app/mvn_repos/ch/qos/logback/logback-core/1.2.12/logback-core-1.2.12.jar:/Users/shaonaiyi/app/mvn_repos/org/apache/logging/log4j/log4j-to-slf4j/2.17.2/log4j-to-slf4j-2.17.2.jar:/Users/shaonaiyi/app/mvn_repos/org/apache/logging/log4j/log4j-api/2.17.2/log4j-api-2.17.2.jar:/Users/shaonaiyi/app/mvn_repos/org/slf4j/jul-to-slf4j/1.7.36/jul-to-slf4j-1.7.36.jar:/Users/shaonaiyi/app/mvn_repos/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/spring-core/5.3.28/spring-core-5.3.28.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/spring-jcl/5.3.28/spring-jcl-5.3.28.jar:/Users/shaonaiyi/app/mvn_repos/org/yaml/snakeyaml/1.30/snakeyaml-1.30.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/boot/spring-boot-starter-test/2.7.13/spring-boot-starter-test-2.7.13.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/boot/spring-boot-test/2.7.13/spring-boot-test-2.7.13.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/boot/spring-boot-test-autoconfigure/2.7.13/spring-boot-test-autoconfigure-2.7.13.jar:/Users/shaonaiyi/app/mvn_repos/com/jayway/jsonpath/json-path/2.7.0/json-path-2.7.0.jar:/Users/shaonaiyi/app/mvn_repos/net/minidev/json-smart/2.4.11/json-smart-2.4.11.jar:/Users/shaonaiyi/app/mvn_repos/net/minidev/accessors-smart/2.4.11/accessors-smart-2.4.11.jar:/Users/shaonaiyi/app/mvn_repos/org/ow2/asm/asm/9.3/asm-9.3.jar:/Users/shaonaiyi/app/mvn_repos/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar:/Users/shaonaiyi/app/mvn_repos/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar:/Users/shaonaiyi/app/mvn_repos/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar:/Users/shaonaiyi/app/mvn_repos/org/assertj/assertj-core/3.22.0/assertj-core-3.22.0.jar:/Users/shaonaiyi/app/mvn_repos/org/hamcrest/hamcrest/2.2/hamcrest-2.2.jar:/Users/shaonaiyi/app/mvn_repos/org/junit/jupiter/junit-jupiter/5.8.2/junit-jupiter-5.8.2.jar:/Users/shaonaiyi/app/mvn_repos/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar:/Users/shaonaiyi/app/mvn_repos/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/Users/shaonaiyi/app/mvn_repos/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar:/Users/shaonaiyi/app/mvn_repos/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/Users/shaonaiyi/app/mvn_repos/org/junit/jupiter/junit-jupiter-params/5.8.2/junit-jupiter-params-5.8.2.jar:/Users/shaonaiyi/app/mvn_repos/org/junit/jupiter/junit-jupiter-engine/5.8.2/junit-jupiter-engine-5.8.2.jar:/Users/shaonaiyi/app/mvn_repos/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar:/Users/shaonaiyi/app/mvn_repos/org/mockito/mockito-core/4.5.1/mockito-core-4.5.1.jar:/Users/shaonaiyi/app/mvn_repos/net/bytebuddy/byte-buddy/1.12.23/byte-buddy-1.12.23.jar:/Users/shaonaiyi/app/mvn_repos/net/bytebuddy/byte-buddy-agent/1.12.23/byte-buddy-agent-1.12.23.jar:/Users/shaonaiyi/app/mvn_repos/org/objenesis/objenesis/3.2/objenesis-3.2.jar:/Users/shaonaiyi/app/mvn_repos/org/mockito/mockito-junit-jupiter/4.5.1/mockito-junit-jupiter-4.5.1.jar:/Users/shaonaiyi/app/mvn_repos/org/skyscreamer/jsonassert/1.5.1/jsonassert-1.5.1.jar:/Users/shaonaiyi/app/mvn_repos/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/spring-test/5.3.28/spring-test-5.3.28.jar:/Users/shaonaiyi/app/mvn_repos/org/xmlunit/xmlunit-core/2.9.1/xmlunit-core-2.9.1.jar:/Users/shaonaiyi/app/mvn_repos/com/baomidou/mybatis-plus-boot-starter/3.5.1/mybatis-plus-boot-starter-3.5.1.jar:/Users/shaonaiyi/app/mvn_repos/com/baomidou/mybatis-plus/3.5.1/mybatis-plus-3.5.1.jar:/Users/shaonaiyi/app/mvn_repos/com/baomidou/mybatis-plus-extension/3.5.1/mybatis-plus-extension-3.5.1.jar:/Users/shaonaiyi/app/mvn_repos/com/baomidou/mybatis-plus-core/3.5.1/mybatis-plus-core-3.5.1.jar:/Users/shaonaiyi/app/mvn_repos/com/baomidou/mybatis-plus-annotation/3.5.1/mybatis-plus-annotation-3.5.1.jar:/Users/shaonaiyi/app/mvn_repos/com/github/jsqlparser/jsqlparser/4.3/jsqlparser-4.3.jar:/Users/shaonaiyi/app/mvn_repos/org/mybatis/mybatis/3.5.9/mybatis-3.5.9.jar:/Users/shaonaiyi/app/mvn_repos/org/mybatis/mybatis-spring/2.0.6/mybatis-spring-2.0.6.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/boot/spring-boot-starter-jdbc/2.7.13/spring-boot-starter-jdbc-2.7.13.jar:/Users/shaonaiyi/app/mvn_repos/com/zaxxer/HikariCP/4.0.3/HikariCP-4.0.3.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/spring-jdbc/5.3.28/spring-jdbc-5.3.28.jar:/Users/shaonaiyi/app/mvn_repos/org/springframework/spring-tx/5.3.28/spring-tx-5.3.28.jar:/Users/shaonaiyi/app/mvn_repos/org/projectlombok/lombok/1.18.28/lombok-1.18.28.jar:/Users/shaonaiyi/app/mvn_repos/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit5 com.shaonaiyi.demo.DemoApplicationTests,testSelectList
Internal Error occurred.
org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover testsat org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:134)at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:108)at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:80)at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:110)at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: org.junit.platform.commons.JUnitException: ClassSelector [className = 'com.shaonaiyi.demo.DemoApplicationTests'] resolution failedat org.junit.platform.launcher.listeners.discovery.AbortOnFailureLauncherDiscoveryListener.selectorProcessed(AbortOnFailureLauncherDiscoveryListener.java:39)at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:102)at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:82)at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:46)at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:69)at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)... 13 more
Caused by: org.junit.platform.commons.PreconditionViolationException: Could not load class with name: com.shaonaiyi.demo.DemoApplicationTestsat org.junit.platform.engine.discovery.ClassSelector.lambda$getJavaClass$0(ClassSelector.java:75)at org.junit.platform.commons.function.Try$Failure.getOrThrow(Try.java:335)at org.junit.platform.engine.discovery.ClassSelector.getJavaClass(ClassSelector.java:74)at org.junit.jupiter.engine.discovery.ClassSelectorResolver.resolve(ClassSelectorResolver.java:66)at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:134)at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1632)at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:185)at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:125)at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:91)... 18 more
Caused by: java.lang.ClassNotFoundException: com.shaonaiyi.demo.DemoApplicationTestsat java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)at org.junit.platform.commons.util.ReflectionUtils.lambda$tryToLoadClass$9(ReflectionUtils.java:829)at org.junit.platform.commons.function.Try.lambda$call$0(Try.java:57)at org.junit.platform.commons.function.Try.of(Try.java:93)at org.junit.platform.commons.function.Try.call(Try.java:57)at org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass(ReflectionUtils.java:792)at org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass(ReflectionUtils.java:748)... 33 more

网上的很多方法都试过了,什么加依赖,排除依赖之类的,但是其实这样的错误,不应该关心项目本身的问题,因为它在另外一台电脑是可以跑的,所以考虑的话可以考虑环境,比如Maven版本、配置、依赖之类的。

最终解决办法:在IDEA中操作一下就可以了,先mvn clean一下Maven依赖,然后再mvn install一下,注意,一定要install,只clean是不行的。

但是,又发现了一个新的问题,测试时,只能新增、查看,不能删除和修改😂😂😂…

尝试加上@Rollback(false),也不生效,删除时影响行数是0,修改时影响行数是1,但结果就是不一样。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/191956.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder 实现密码加密 验证 代码示例

BCryptPasswordEncoder 是 Spring Security 提供的用于加密和验证密码的实现类。它使用强大的 BCrypt 散列函数来存储密码的散列值,提供了一种安全的密码存储方法。以下是一个简单的示例代码,演示如何使用 BCryptPasswordEncoder 进行密码加密和验证&…

索引器【C#】

索引: 索引,索的是实例化的编号,派生的子类,第 [ N ] 个儿子。 用数组的方式访问实例。 返回的是实例的,一个属性值。 声明: this [ 索引 ] public string this[int index]{get{}set{}}pub…

idea 插件开发日志绑定问题

错误日志 Searchable options index builder completed SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/D:/gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2021.2/b0727ceddea2b62b16825db9308e14a470198…

【QT5】QT5安装

QT5的安装 从软件开发的角度看,选择版本最新的稳定版是最佳选择,目前QT已经开发到QT6了,但是自从QT5最后一个版本QT5.15起,QT官方就不再提供离线安装包了,安装最新版本的QT除了要注册账号等麻烦的操作外,Q…

【数组和函数实战: 斗地主游戏】

目录 1. 玩法说明 2. 分析和设计 3. 代码实现 4. 游戏演示1. 玩法说明 一副54张牌,3最小,两个王最大,其实是2,和上面一样从大到小排列 2. 分析和设计 2.1 分析和设计 常量和变量设计 一副牌有54张,有牌的数值和花色,可以分别用两个数组来存储,card为卡牌表示的数值,color为…

Java数据结构之《希尔排序》题目

一、前言: 这是怀化学院的:Java数据结构中的一道难度中等的一道编程题(此方法为博主自己研究,问题基本解决,若有bug欢迎下方评论提出意见,我会第一时间改进代码,谢谢!) 后面其他编程题只要我写完…

CGAL的四叉树、八叉树、正交树

四叉树(Quadtree):四叉树是一种用于二维空间分割的数据结构。它将一个二维区域划分为四个象限,每个象限进一步细分为四个小块,以此类推。四叉树可以用于空间索引、图形学、地理信息系统(GIS)等领…

前端打包添加前缀

vue2添加前缀 router的base加上前缀 export default new Router({mode: history, // 去掉url中的#base: privateDeployUrl, // 这里加上前缀scrollBehavior: () > ({y: 0}),routes: constantRoutes })vue.config.js,publicPath属性加上前缀 publicPath: proces…

vue面试题整理(1.0)

一、对MVC,MVP,MVVM的理解 三者都是项目的架构模式(不是类的设计模式),即:一个项目的结构,如何分层,不同层负责不同的职责。 1.MVC MVC的出现是用在后端(全栈时代&…

Kali 修改IP地址和DNS 开启SSH和远程桌面

一、修和IP和DNS 1、打开配置文件 vim /etc/network/interfaces# 加入 auto eth0 iface eth0 inet static address 10.3.0.231 netmask 255.255.255.0 gateway 10.3.0.12、清空网卡配置 ip addr flush dev eth0 3、配置DNS vim /etc/resolv.confnameserver 114.114.114.11…

爬虫-xpath篇

1.xpath的基础语法 表达式描述nodename选中该元素/从根节点选取、或者是元素和元素间的过渡//从匹配选择的当前节点选择文档中的节点,而不考虑它们的位置.选取当前节点…选取当前节点的父节点选取属性text()选取文本 举例: 路径表达式结果html选择html元…

TLS协议握手流程

浅析 TLS(ECDHE)协议的握手流程(图解) - 知乎 前言 通过 wireshark 抓取 HTTPS 包,理解 TLS 1.2 安全通信协议的握手流程。 重点理解几个点: TLS 握手流程:通过 wireshark 抓取 HTTPS 包理解…

常用数据预处理方法 python

常用数据预处理方法 数据清洗缺失值处理示例删除缺失值插值法填充缺失值 异常值处理示例删除异常值替换异常值 数据类型转换示例数据类型转换在数据清洗过程中非常常见 重复值处理示例处理重复值是数据清洗的重要步骤 数据转换示例 数据集成示例数据集成是将多个数据源合并为一…

Linux CentOS搭建NGINX环境

在Linux CentOS 7.x系统安装NGINX 1.13.7版本,具体步骤如下 1、安装所需环境 //安装gcc yum install gcc-c//安装PCRE pcre-devel yum install -y pcre pcre-devel//安装zlib yum install -y zlib zlib-devel//安装Open SSL yum install -y openssl openssl-devel…

【网络协议】聊聊网络ReadTimeout和ConnectTimeout

在实际的开发中,网络超时是一个比较常见的问题,比如说针对支付系统,超时就需要进行和三方人员进行核对订单状态,是否人工介入处理。 但其实在设计网络框架的时候,一般都有两个超时参数 连接超时参数 ConnectTimeout&am…

目标检测YOLO系列从入门到精通技术详解100篇-【目标检测】缺陷检测

目录 几个高频面试题目 深度学习工具在缺陷检测中是如何工作的? 深度学习是如何工作的? 深度学习缺陷检测技术

vue项目node-sass^4.14.1 python gyp 报错解决办法

npm i node-sass4.14.1 --sass_binary_sitehttps://npm.taobao.org/mirrors/node-sass/参考链接:链接

LabVIEW在不同操作系统上使VI、可执行文件或安装程序

LabVIEW在不同操作系统上使VI、可执行文件或安装程序 LabVIEW可以在多个操作系统上运行,主要支持以下几种操作系统: Windows: LabVIEW在各个版本的Windows操作系统上都能运行,包括Windows 7、Windows 8和Windows10。LabVIEW为Wi…

elk:filebeat也是一个日志收集工具

filebeat是一个轻量级的日志收集工具,所使用的系统资源比logstash部署和启动使用的资源要小的多 filebeat可以允许在非java环境,他可以代替logstash在非java环境上收集日志 filebeat无法实现数据的过滤,一般是结合logstash的数据过滤功能一…

Safe and Practical GPU Computation in TrustZone论文阅读笔记

Safe and Practical GPU Computation in TrustZone 背景知识: youtube GR视频讲解链接:ASPLOS’22 - Session 2A - GPUReplay: A 50-KB GPU Stack for Client ML - YouTube GPU软件栈: 概念:"GPU软件栈"指的是与GPU硬件…