IAd*_*ter 76 maven-2 unit-testing stack-trace surefire
我想在控制台中看到单元测试的堆栈跟踪.surefire是否支持这个?
h7r*_*h7r 155
我发现的一个相关问题是,最近版本中的surefire显然默认情况下将trimStackTrace设置为true(渲染失败测试中的大多数堆栈跟踪无用),这非常不方便.
设置-DtrimStackTrace=false或定义
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
解决了这个.
Eug*_*hov 55
您可以使用以下命令在控制台上查看堆栈跟踪,而不是target/surefire-reports文件夹中的报告文件:
mvn -Dsurefire.useFile=false test
Run Code Online (Sandbox Code Playgroud)
yeg*_*256 23
要扩展之前给出的答案,您还可以在以下位置配置此行为pom.xml:
..
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<useFile>false</useFile>
</configuration>
</plugin>
..
Run Code Online (Sandbox Code Playgroud)