简体   繁体   English

如何设置get junit以显示正确的错误或异常堆栈跟踪

[英]how do I set get junit to show correct error or exception stack trace

I have noticed when I run a Junit test using maven on the cli when ever there is an error or exception all I get is 我注意到当我在cli上使用Maven运行Junit测试时,只要遇到错误或异常,

com.x.blah.testmyclass : tried to access method 
org.apache.maven.surefire.report.SimpleReportEntry.<init>
  (Ljava/lang/String;Ljava/lang/String;Lorg/apache/maven/surefire/report/StackTraceWriter;)V from class
 org.apache.maven.surefire.common.junit4.JUnit4RunListener

Is there any way to: 有什么办法可以:

  1. Get it to print out the actual test that caused the failure within the class 获取它以打印出导致类内失败的实际测试
  2. Output the original exception that was thrown 输出引发的原始异常

I am not very experienced in Maven and have looked around online but can't see anything obvious and have been resorting to logging in my tests when they fail which can be very time consuming 我对Maven的经验不是很丰富,并且在线浏览过,但是看不到任何明显的东西,并且在测试失败时一直求助于我的测试,这非常耗时

Check your surefire-plugin version! 检查您的surefire插件版本!

maven-surefire-plugin 2.10 has this SimpleReportEntry(String, StackTraceWriter) constructor but in version 2.19 doesn't have it. maven-surefire-plugin 2.10具有此SimpleReportEntry(String,StackTraceWriter)构造函数,但在2.19版中没有此构造函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM