[
https://issues.apache.org/jira/browse/SUREFIRE-1883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17288310#comment-17288310
]
Falko Modler commented on SUREFIRE-1883:
----------------------------------------
[~kleewan] IIRC, it does solve the case I have mentioned above (output while
debugging).
Downside of downgrading is - as usual - that you get other bugs.
> Logs get dumped to console all at once when the execution is over, instead of
> being printed in real time
> --------------------------------------------------------------------------------------------------------
>
> Key: SUREFIRE-1883
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1883
> Project: Maven Surefire
> Issue Type: Bug
> Components: Maven Surefire Plugin
> Affects Versions: 3.0.0-M5
> Environment: Windows 10, Java 11.0.7, Intellij IDEA 2020.3
> Reporter: Marco Patavini
> Priority: Major
>
> Hello,
> I'm working on a test automation project using Maven (with Surefire plugin)
> and JUnit 5. Since I have very long-running UI scripts (up to 20 minutes), I
> make intensive use of logging to the console. This is crucial to me, at least
> in the developing phase of each script. However, logs gets dumped all at once
> at the end of the execution, instead of being printed in real-time. I realize
> this makes perfect sense in case of parallel execution (to avoid overlapping
> issues), but I would like a way to disable this when executing in a serial
> fashion. I've searched both Surefire and JUnit documentations, but I can't
> seem to find a way. Any help would be appreciated. This is a very simple
> dummy project to reproduce the issue:
> projectRoot/pom.xml:
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>org.example</groupId>
> <artifactId>project</artifactId>
> <version>1.0</version>
> <properties>
> <maven.compiler.source>11</maven.compiler.source>
> <maven.compiler.target>11</maven.compiler.target>
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> </properties>
> <build>
> <pluginManagement>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <version>3.0.0-M5</version>
> </plugin>
> </plugins>
> </pluginManagement>
> </build>
> <dependencies>
> <dependency>
> <groupId>org.junit.jupiter</groupId>
> <artifactId>junit-jupiter-engine</artifactId>
> <version>5.7.0</version>
> <scope>test</scope>
> </dependency>
> </dependencies>
> </project>{code}
> projectRoot/src/test/java/DummyTest.java:
> {code:java}
> import org.junit.jupiter.api.Test;
> public class DummyTest {
> @Test
> public void ConsoleLoggingTest() {
> System.out.println("STARTING TEST...");
> try { Thread.sleep(30000); } catch (Exception ignored) { } //SIMULATE
> LONG-RUNNING TASK
> System.out.println("TEST IS FINISHED!");
> }
> }{code}
> I use to execute tests with the {{mvn test}} command in my IDE (IntelliJ
> IDEA). Please note that I used {{System.out.println()}} for the sake of
> simplicity, but I get the same behavior using any logging library, like
> {{log4j}}.
> Another thing worth mentioning is that I get the correct behavior if running
> the tests through the integrated JUnit plugin in my IDE, instead of running
> them though Maven Surefire. Also, I get the same exact issue using TestNG.
> I can remember having a similar setup a couple of years ago (Surefire 2.x +
> JUnit 4) and I've never experienced this issue. Something must have been
> changed, but I can't find any useful information in the docs. I'm afraid I'm
> missing something obvious.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)