Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maven-surefire-plugins's setting "redirectTestOutputToFile" is being ignored #986

Closed
piotrkrokowski opened this issue Jul 25, 2017 · 9 comments

Comments

@piotrkrokowski
Copy link

piotrkrokowski commented Jul 25, 2017

Given the following plugin definition:

<plugin>
   <artifactId>maven-surefire-plugin</artifactId>
   <version>2.19.1</version>
   <configuration>
      <redirectTestOutputToFile>true</redirectTestOutputToFile>
   </configuration>
   <dependencies>
      <dependency>
         <groupId>org.junit.platform</groupId>
         <artifactId>junit-platform-surefire-provider</artifactId>
         <version>1.0.0-M6</version>
      </dependency>
      <dependency>
         <groupId>org.junit.vintage</groupId>
         <artifactId>junit-vintage-engine</artifactId>
         <version>4.12.0-M6</version>
      </dependency>
      <dependency>
         <groupId>org.junit.jupiter</groupId>
         <artifactId>junit-jupiter-engine</artifactId>
         <version>5.0.0-M6</version>
      </dependency>
   </dependencies>
</plugin>

and tests, that produce console output with System.out.println(), Test's console output is being written out on the actual console, while it is expected to be redirected to surefire's files, as it happened before adding junit-vintage-engine and junit-platform-surefire-provider to dependencies.

This issue is severe, because the project I'm working on heavily depends on the fact that tests output is suppressed (without it, it produces hundreds of megabytes of logs, ruining the performance and blocking storage capacity).

@smoyer64
Copy link
Contributor

I've worked on the Surefire provider a little bit and I'm not surprised that the executor doesn't redirect the output. I've been working on a JUnit 5 extension that allows you to control the console but I think what's needed here is for the provider itself to redirect System.out. Fortunately the test results themselves are recorded via the RunListener (see https://github.com/junit-team/junit5/blob/master/junit-platform-surefire-provider/src/main/java/org/junit/platform/surefire/provider/JUnitPlatformProvider.java#L107).

I'm not sure that the JUnit 5 team is interested in making this code a full-fledged Provider but I'd be happy to add this feature to the plugin if it's deemed worthwhile. I'm also a bit surprised that the AbstractProvider that is extended by that code doesn't take care of the output redirection.

@piotrkrokowski
Copy link
Author

I'd appreciate such contribution ;)

@sbrannen
Copy link
Member

I've assigned this to the general backlog and put it "up for grabs".

@blairnangle
Copy link

Is this issue still free to be worked on?

@marcphilipp
Copy link
Member

@smoyer64 Is it?

@smoyer64
Copy link
Contributor

@marcphilipp - I haven't started working on it yet so I'd say "yes".

@kaustubhmallik
Copy link

Hey guys, has somebody picked it up yet?

@sbrannen
Copy link
Member

sbrannen commented Sep 4, 2017

@kaustubhmallik, not to my knowledge.

Feel free to give it a shot and report back here.

@BogdanStirbat
Copy link
Contributor

Hi!

For this issue, I added a new pull request.

BogdanStirbat added a commit to BogdanStirbat/junit5 that referenced this issue Oct 8, 2017
BogdanStirbat added a commit to BogdanStirbat/junit5 that referenced this issue Oct 8, 2017
BogdanStirbat added a commit to BogdanStirbat/junit5 that referenced this issue Oct 30, 2017
…m.out and System.err to default platform values.

Issue: junit-team#986
BogdanStirbat added a commit to BogdanStirbat/junit5 that referenced this issue Oct 30, 2017
marcphilipp pushed a commit that referenced this issue Oct 31, 2017
…plements ConsoleOutputReceiver (code review)

Issue: #986
marcphilipp pushed a commit that referenced this issue Oct 31, 2017
…m.out and System.err to default platform values.

Issue: #986
marcphilipp added a commit that referenced this issue Oct 31, 2017
@marcphilipp marcphilipp self-assigned this Oct 31, 2017
@marcphilipp marcphilipp modified the milestones: General Backlog, 5.1 M1 Oct 31, 2017
marcphilipp pushed a commit that referenced this issue Nov 5, 2017
…plements ConsoleOutputReceiver (code review)

Issue: #986
marcphilipp pushed a commit that referenced this issue Nov 5, 2017
…m.out and System.err to default platform values.

Issue: #986
marcphilipp added a commit that referenced this issue Nov 5, 2017
@marcphilipp marcphilipp modified the milestones: 5.1 M1, 5.0.2 Nov 5, 2017
Andrei94 pushed a commit to Andrei94/junit5 that referenced this issue Jun 23, 2018
Andrei94 pushed a commit to Andrei94/junit5 that referenced this issue Jun 23, 2018
Andrei94 pushed a commit to Andrei94/junit5 that referenced this issue Jun 23, 2018
…m.out and System.err to default platform values.

Issue: junit-team#986
Andrei94 pushed a commit to Andrei94/junit5 that referenced this issue Jun 23, 2018
Andrei94 pushed a commit to Andrei94/junit5 that referenced this issue Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants