Closed pagmoro closed 3 years ago
Hi, I'm unable to reproduce this.
Looking at the stacktrace it looks like the issue is originating from the Cucumber PrettyFormatter
.
Can you remove the pretty
Cucumber plugin and try again?
Hi @prashant-ramcharan ,
Removing the pretty Cucumber plugin does not help. It gets stuck on both my local machine and in Jenkins. I am using Java 1.8 Also , I was unable to reproduce this in the sample project , but it happens consistently for both 5.8.0 and 5.8.1 in my actual project. Again , not a showstopper , but false is the default option for showTestOutput , so would be nice to have it fixed.
Thanks!
Hi @pagmoro
Is it possible to share a demo project that I can use to reproduce this?
I tried with example projects and few of my own personal projects using Java 8 and 11 and I was unable to reproduce this.
I was able to reproduce this in my sample project as suspected by introducing file logging (same as my actual project).
I'm attaching the logback-test.xml here , you should be able to reproduce it with this. We have a requirement of logging everything to both the console and a file , this seems to be causing issues with showOutput=false
Gradle Dependencies:
dependencies {
testImplementation "io.github.prashant-ramcharan:courgette-jvm:5.8.0"
testImplementation "ch.qos.logback:logback-classic:1.2.2"
testImplementation "org.slf4j:slf4j-api:1.7.28"
}
logback-test.xml:
<?xml version='1.0' encoding='utf-8'?>
<configuration debug="true" >
<property name="LOG_DIR" value="${java.io.tmpdir}" />
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIR}/pagmoro-test.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_DIR}/pagmoro-test-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>500MB</maxFileSize>
<maxHistory>5</maxHistory>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0} - %msg%n</pattern>
</encoder>
</appender>
<appender class="ch.qos.logback.core.ConsoleAppender" name="STDOUT">
<encoder>
<pattern>%simtime %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0} - %msg%n </pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="ROLLING" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
Thanks @pagmoro - I'll take a look.
@pagmoro I still cannot reproduce this even with the logging enabled so it must be related to something else in your project that I don't have in mine.
Project: courgette-jvm-issue-240.zip
I tried with the above project that I just spun up.
Perhaps you can try with this project?
Verified with:
Thank you @prashant-ramcharan - I was able to reproduce this in my environment with your project above without any changes. I can see Intellij reporting "Tests passed: 2 of 2 tests" , but the program continues indefinitely apparently doing nothing (possibly waiting on I/O).
If I change one of the Suites to showTestOutput=true , and the other to false , then run the "test" gradle task and kill it after a while of showing nothing on the screen , the logs for Suite with showTestOutput=true is shown after the force stop and as expected the logs for the other Suite (with showTestOutPut=false) is not seen. It does look like it is hung after executing the 2 tests.
Ofcourse if both suites have showTestOutput=true, everything runs fine.
Are you trying this on MacOS? Our Jenkins build is on Linux and my PC is windows , and it fails on both.
Correction: The 2 of 2 Tests is for the one with showTestOutput = true. The tests are not run at all for the other one. 2nd Correction: Appears that after terminating the program all the output appears in the logs
Also - I'm assuming the intention of showTestOutput is to control output to the STDOUT only? In my case output is sent to console as well as a log file. Would ideally want file logging to continue , but even if both file logging and console are disabled with showTestOutput=false , the program should not hang. Possibly logback is trying to write but cant.
The showTestOutput
simply redirects the output from sub processes (spawned threads) to the main process.
Setting showTestOutput=true
does not mean logging to files or the consoles is disabled, it simply means we redirect the output from the sub process to the parent process (i.e the process builder).
When showTestOutput=false
, this just means it does not redirect the output to the main process.
Let me run the project I pasted above on Jenkins (linux box) and will see if I can reproduce this.
@pagmoro
Just tried on Jenkins (running in docker on a Linux platform) and I cant reproduce this.
With showTestOutput = false
With showTestOutput = true
I was able to reproduce this on Windows though. I will investigate further.
Thanks.
@pagmoro This should now be fixed in version 5.9.0
Thats great! Will revert if any issues. Thank you.
Looks good to me - thank you !
When showTestOutput = false , TestSuite run hangs indefinitely , seen in both 5.8.1 and 5.8.0 versions Note: I only have 1 feature with 2 Scenarios which takes 7 seconds to execute when showTestOutput = true
Options:
Thread Dump of io.cucumber.core.cli.Main process: