单元测试-FATAL ERROR in native method: processing of -javaagent failed

文章目录

  • 前言
    • [单元测试-FATAL ERROR in native method: processing of -javaagent failed](#单元测试-FATAL ERROR in native method: processing of -javaagent failed)
      • [1. 报错信息](#1. 报错信息)
      • [2. 解决方案](#2. 解决方案)

前言

如果您觉得有用的话,记得给博主点个赞,评论,收藏一键三连啊,写作不易啊^ _ ^。

而且听说点赞的人每天的运气都不会太差,实在白嫖的话,那欢迎常来啊!!!


单元测试-FATAL ERROR in native method: processing of -javaagent failed

1. 报错信息

bash 复制代码
"C:\Program Files\Java\jdk1.8.0_211\bin\java.exe" -javaagent:C:\Users\杨镇宇\.IdeaIC2019.2\system\testAgent\intellij-coverage-agent-1.0.508.jar=C:\Users\杨镇宇\AppData\Local\Temp\coverageargs -Didea.test.cyclic.buffer.size=1048576 "-com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.yzy.demo.utils.HttpUtilTest
java.lang.reflect.InvocationTargetException
FATAL ERROR in native method: processing of -javaagent failed
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
	at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.coverage.main.CoveragePremain.premain(CoveragePremain.java:35)
	at com.intellij.rt.coverage.main.CoveragePremain.premain(CoveragePremain.java:28)
	... 6 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
	at com.intellij.rt.coverage.instrumentation.Instrumentator.performPremain(Instrumentator.java:55)
	at com.intellij.rt.coverage.instrumentation.Instrumentator.premain(Instrumentator.java:33)
	... 12 more

Process finished with exit code 1
Exception in thread "main" 

2. 解决方案

加一行

bash 复制代码
-Djava.io.tmpdir=F:\tmp

tmp文件夹必须存在,F:\tmp是自己建的文件夹,名称无所谓,但是必须要有此文件夹。

-Djava.io.tmpdir=F:\tmp告诉 IntelliJ IDEA 在启动时将 F:\tmp作为临时文件存储目录,这样可以避免使用默认的临时目录。

重启idea

执行单侧测试类:

效果:

相关推荐
devmoon2 小时前
为 Pallet 搭建最小化 Mock Runtime 并编写单元测试环境
开发语言·单元测试·区块链·智能合约·polkadot
软件检测小牛玛21 小时前
软件功能测试找谁做?第三方软件检测机构推荐:中承信安
功能测试·单元测试·软件测试报告·软件功能测试·第三方软件测评
软件检测小牛玛3 天前
具备软件功能测试资质的机构哪家更权威?山东软件测评机构 中承信安
功能测试·单元测试·软件测试报告·软件测评机构
闻哥3 天前
从测试坏味道到优雅实践:打造高质量单元测试
java·面试·单元测试·log4j·springboot
Warren983 天前
Pytest Fixture 作用域与接口测试 Token 污染问题实战解析
功能测试·面试·单元测试·集成测试·pytest·postman·模块测试
知行合一。。。3 天前
程序中的log4j、stderr、stdout日志
python·单元测试·log4j
测试秃头怪4 天前
面试大厂就靠这份软件测试八股文了【含答案】
自动化测试·软件测试·python·功能测试·面试·职场和发展·单元测试
测试大圣4 天前
软件测试基础知识总结(超全的)
软件测试·python·功能测试·测试工具·职场和发展·单元测试·测试用例
CodeCraft Studio4 天前
【Parasoft案例分享】在 DO-178C 标准下,如何实现航空嵌入式软件测试自动化
单元测试·自动化·静态分析·代码覆盖率·parasoft·do-178c·软件自动化测试