Code Monkey home page Code Monkey logo

Comments (8)

radarsh avatar radarsh commented on July 4, 2024 1

Hmm, that's not a nice behaviour from the plugin. Let me see what I can do. Thanks for reporting this.

from gradle-test-logger-plugin.

molexx avatar molexx commented on July 4, 2024 1

I've investigated what's happening: System.exit(5) is being called.

I guess this is somewhat unexpected behaviour for JUnit tests but I have seen several StackOverflow posts suggest that as a way to abort the rest of the test suite so as to not waste when a fatal error has happened.

Would it be right for gradle-test-logger-plugin to catch the VM's non-zero exit code, treat that as a failed test and show the output?

Thanks.

from gradle-test-logger-plugin.

radarsh avatar radarsh commented on July 4, 2024

Hi @molexx, would you be able to provide an sscce for this so that I can provide an accurate fix? Thanks.

from gradle-test-logger-plugin.

radarsh avatar radarsh commented on July 4, 2024

Interesting. Would be good to find out what Gradle would do without the test logger plugin applied and with a configuration like this:

test {
    testLogging {
        showStandardStreams = true
    }
}

from gradle-test-logger-plugin.

radarsh avatar radarsh commented on July 4, 2024

Hi @molexx, could you share a bit more detail about this please? Where is System.exit(5) being called from? Is it in a setup method? Also what happens when you try this? Thanks. This info will be quite invaluable.

from gradle-test-logger-plugin.

molexx avatar molexx commented on July 4, 2024

Behaviour is the same for @Test and @Before methods which do some output before calling System.exit(5):

Without gradle-test-logger applied and without the above test{ testLogging { showStandardStreams=true}} the stdout/stderr messages are not shown.

Without gradle-test-logger applied but with the above test{ testLogging { showStandardStreams=true}} the stdout/stderr messages are shown.

With gradle-test-logger applied the test is reported as SKIPPED (in yellow), then the expected behaviour happens: if testLogger's showStandardStreams and showSkippedStandardStreams are true the messages are seen.
I don't think it should be detected as SKIPPED though, as the test suite's VM aborted without the test completing and with status 5 (which gradle notices and reports as in the first post).

@BeforeClass methods are similar without gradle-test-logger - with test{ testLogging { showStandardStreams=true}} the outputs show.

But with gradle-test-logger applied, even with all options set to true:

testlogger {
	showStandardStreams true
	
	showPassedStandardStreams true
	showSkippedStandardStreams true
	showFailedStandardStreams true
}

the System.out and System.err in the @BeforeClass method are not seen.

from gradle-test-logger-plugin.

radarsh avatar radarsh commented on July 4, 2024

I don't think it should be detected as SKIPPED though, as the test suite's VM aborted without the test completing and with status 5 (which gradle notices and reports as in the first post).

Unfortunately, there is nothing the plugin can do about this as this is Gradle's internal behaviour. I have fixed the missing system out issue though. It was a genuine bug, thanks for reporting it and the detailed analysis 👍

from gradle-test-logger-plugin.

molexx avatar molexx commented on July 4, 2024

Ah ok seeing the messages is the main thing, thanks! :-)

from gradle-test-logger-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.