[unit-testing] 콘솔에서 메이븐의 확실한 쇼 스택 트레이스 만들기

콘솔에서 단위 테스트의 스택 추적을보고 싶습니다. surefire가 이것을 지원합니까?



답변

다음 명령을 사용하여 target / surefire-reports 폴더의 보고서 파일 대신 콘솔에서 스택 추적을 볼 수 있습니다.

mvn -Dsurefire.useFile=false test


답변

내가 찾은 관련 문제는 최근 버전에서 surefire가 기본적으로 trimStackTrace를 true로 설정한다는 것입니다 (실패한 테스트에서 대부분의 스택 추적을 쓸모 없게 렌더링). 이는 매우 불편합니다.

설정 -DtrimStackTrace=false또는 정의

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <trimStackTrace>false</trimStackTrace>
    </configuration>
</plugin>

이 문제를 해결했습니다.


답변

이전에 제공된 답변을 확장하려면 다음에서이 동작을 구성 할 수도 있습니다 pom.xml.

..
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.5</version>
  <configuration>
    <useFile>false</useFile>
  </configuration>
</plugin>
..


답변