jenkinsci / jenkinsci/junit-plugin

[JENKINS-27931] stdout/stderr are truncated even on failing test

Open
#984 5 comments 0 reactions 0 assignees View on GitHub
component:junit-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
87
Forks
351
Avg merge
1d 19h
Merged PRs (30d)
2

Description

A test class with many tests in it may produce "large" logs on stdout. In that case, if there is a test failing within this test class, I would have expected that the entire stdout output is kept by junit plugin.

But it is truncated.

...[truncated 1051034 chars]...

This seems to be voluntary: https://github.com/jenkinsci/junit-plugin/commit/5f7513baff89516cd7217ea39101ad67116cd059

I totally understand the need of discard data for tests succeed. However for failing tests, it makes almost impossible to find the cause of failure.

Besides, it contradicts the documentation of the option Retain long standard output/error which states:

If checked, any standard output or error from a test suite will be retained in the test results after the build completes. (This refers only to additional messages printed to console, not to a failure stack trace.) Such output is always kept if the test failed, but by default lengthy output from passing tests is truncated to save space. Check this option if you need to see every log message from even passing tests, but beware that Jenkins's memory consumption can substantially increase as a result, even if you never look at the test results!

Is that possible to at least make this configurable ? In my workflow, the ideal would be to completely discard passing tests logs, and keep all of failing ones.

---
Originally reported by alexv, imported from: stdout/stderr are truncated even on failing test


  • status: Open
  • priority: Major
  • component(s): junit-plugin
  • label(s): stdout, truncation
  • resolution: Unresolved
  • votes: 20
  • watchers: 17
  • imported: 2025-11-26

Raw content of original issue

A test class with many tests in it may produce "large" logs on stdout. In that case, if there is a test failing within this test class, I would have expected that the entire stdout output is kept by junit plugin.

But it is truncated.


...[truncated 1051034 chars]...


This seems to be voluntary: https://github.com/jenkinsci/junit-plugin/commit/5f7513baff89516cd7217ea39101ad67116cd059

I totally understand the need of discard data for tests succeed. However for failing tests, it makes almost impossible to find the cause of failure.

Besides, it contradicts the documentation of the option Retain long standard output/error which states:


If checked, any standard output or error from a test suite will be retained in the test results after the build completes. (This refers only to additional messages printed to console, not to a failure stack trace.) Such output is always kept if the test failed, but by default lengthy output from passing tests is truncated to save space. Check this option if you need to see every log message from even passing tests, but beware that Jenkins's memory consumption can substantially increase as a result, even if you never look at the test results!


Is that possible to at least make this configurable ? In my workflow, the ideal would be to completely discard passing tests logs, and keep all of failing ones.

environment

```
Jenkins 1.609, 2.60.2

Junit plugin 1.5
```

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the referenced commit 5f7513baff89516cd7217ea39101ad67116cd059 and the junit-plugin code that handles retained stdout and stderr. Reproduce a large-output test class containing a failing test, then verify that the configured behavior preserves failing-test output while allowing passing-test logs to be discarded.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.