-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
RunCukesTest prevents the execution of other tests #304
Comments
Can you prove it in a way that doesn't involve random trial and error on our part? |
Yes, I cloned cucumber-jvm and reproduced the error in the java-helloworld example, here is the link: https://github.com/vitormcruz/cucumber-jvm/tree/master/examples/java-helloworld I investigate the problem a little more and cucumber isn't actually preventing JUnit to execute other tests, instead it is (apparently) preventing other tests to report its completion. The error stops from happening if I remove or comment the following snippet of code from RunCukesTest: @Cucumber.Options(format = {"pretty", "html:target/cucumber"}) This error only happens with test classes that are in a package different than the RunCukesTest. Test classes that are on the same package of the RunCukesTest executes normally. This was as far as I could get, hope I could help. :) |
It prevents other tests from reporting completion where to? Eclipse? IntelliJ Idea? Maven? Ant? Other? |
I tested on IntelliJ and Maven. It happened on both. |
Thanks for the details. I have managed to reproduce it now. |
It appears that using a format like This is very odd. It seems that as long as Cucumber formatters write to file everything is fine, but as soon as they write to STDOUT it messes up the IDE's junit reporting. I'm not sure if this is a JUnit bug, an IDE bug or a Cucumber bug... |
I tried to use JUnit directly, and the problem still happens. So we can say it is either a JUnit or a Cucumber bug. The outputs where: With conf on: JUnit version 4.10 With conf off: JUnit version 4.10 OK (5 tests) |
I'm not sure I understand how this output proves that the regular JUnit test is not running. Please turn off ANSI colouring with |
With conf on: E:\Projetos\cucumber-jvm\examples\java-helloworld\target>java -classpath junit-4.10.jar;.\test-classes;C:\Users\Vitor.m2\repository\info\cukes\cucumber-core\1.0.3\cucumber-core-1.0.3.jar;C:\Users\Vitor.m2\repository\info\cukes\cucumber-junit\1.0.3\cucumber-junit-1.0.3.jar;C:\Users\Vitor.m2\repository\info\cukes\gherkin\2.9.3\gherkin-2.9.3.jar;C:\Users\Vitor.m2\repository\info\cukes\cucumber-java\1.0.3\cucumber-java-1.0.3.jar;E:\Projetos\cucumber-jvm\examples\java-helloworld\target\classes;C:\Users\Vitor.m2\repository\info\cukes\cucumber-html\0.2.1\cucumber-html-0.2.1.jar org.junit.runner.JUnitCore cucumber.examples.java.helloworld.RunCukesTest cucumber.examples.java.test.ExampleTest E:\Projetos\cucumber-jvm\examples\java-helloworld\target> With conf off: E:\Projetos\cucumber-jvm\examples\java-helloworld\target>java -classpath junit-4.10.jar;.\test-classes;C:\Users\Vitor.m2\repository\info\cukes\cucumber-core\1.0.3\cucumber-core-1.0.3.jar;C:\Users\Vitor.m2\repository\info\cukes\cucumber-junit\1.0.3\cucumber-junit-1.0.3.jar;C:\Users\Vitor.m2\repository\info\cukes\gherkin\2.9.3\gherkin-2.9.3.jar;C:\Users\Vitor.m2\repository\info\cukes\cucumber-java\1.0.3\cucumber-java-1.0.3.jar;E:\Projetos\cucumber-jvm\examples\java-helloworld\target\classes;C:\Users\Vitor.m2\repository\info\cukes\cucumber-html\0.2.1\cucumber-html-0.2.1.jar org.junit.runner.JUnitCore cucumber.examples.java.helloworld.RunCukesTest cucumber.examples.java.test.ExampleTest OK (5 tests) E:\Projetos\cucumber-jvm\examples\java-helloworld\target> "I'm not sure I understand how this output proves that the regular JUnit test is not running." JUnitCore uses a TextListerner to print those last lines of the test (If you want I can paste the code here): Time: 0,104 OK (5 tests) It seams to me that when cucumber conf is on, it prevents this part of the code to be executed. The report completion problem seams related with this output problem. Since the output problem occurs on IDEA, Maven and JUnit, I can only assume that the reporting problem persists on JUnit execution... I don't know how can I prove that, perhaps by implementing a custom listener? Anyway, the problem could be with some RunListener implemented by cucumber? |
I think a custom |
I did more investigantion and was unable to determine the source of the problem... It is very odd what is happening.... |
I have run across this (or a similar) problem as well. I am not sure from the comment history if my issue is the same or a new/different issue than what the original author experienced. I am running cucumber-jvm tests from a main() class using JUnitCore.run(MyTest.class). (I have my reasons) After I run a cucumber test using the "pretty" formatter to display output on the console, all console output thereafter is lost to the abyss. It seems that what is happening is when the "pretty" formatter is used, after the test run is complete, the formatter.close() method is called to close the output stream(s) for the formatter. This effectively closes the Standard.out stream so that no additional output is written to the console from ANY output call for the rest of the program execution. When the formatter is closed, it should not close the default System.out output stream. This includes System.out and the log4j ConsoleAppender output, etc. Anything using System.out for output will not be printed to the console. This does not seem to affect JUnit itself, as it only seems to affect tests run using @RunWith(Cucumber.class), and furthermore it only affects those tests which have the "pretty" formatter specified. For example, if only HTML/JSON output formats are specified, this bug will not occur. For example: public class App { |
I've made quick and dirty patch which work well for me. |
Great! Any idea when this patch will make it to a release in the Maven repository? |
Understood, thanks again for the fix :) This will be VERY helpful for me! |
Hello, I also experienced in this bug Scenario: Say hello ←[90m# cucumber\examples\java\hello
Not sure for what happened here but when I tried removing this option "pretty" in Test class then everything is passed fine. |
+1 |
|
I get the following error when I run through CLI runner,
I get the following ouput, Also it just stops and doesn't execute the steps after that. I'm using Cucumber Core 1.1.2 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Tried on IntelliJ. When I have a project with both features and common unit tests, the features get executed, but the other tests don't. If I comment @RunWith(Cucumber.class) from the RunCukes, other tests run as usual.
The text was updated successfully, but these errors were encountered: