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

Get rid of logs original test logs #105

Closed
zeekhuge opened this issue Jan 16, 2019 · 2 comments
Closed

Get rid of logs original test logs #105

zeekhuge opened this issue Jan 16, 2019 · 2 comments

Comments

@zeekhuge
Copy link

zeekhuge commented Jan 16, 2019

Hi, Thanks for such a cool plugin.
I use continuous mode while I am writing code, so I would like to get rid of the mostly-useless original logs that, I am guessing, are made by the android-plugin. Is there a way to configure test-logging so that it takes over the original logging ? or maybe I could set something manually to get this effect ?

That is, I want this to be the last few lines in the output

...
...
695 passing (3.8s)
1 pending
2 failing

And want this to not get logged.

698 tests completed, 2 failed, 1 skipped

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:testDebugUnitTest'.

There were failing tests. See the report at: file:///<.....>/app/build/reports/tests/testDebugUnitTest/index.html

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 4s
19 actionable tasks: 2 executed, 17 up-to-date

Waiting for changes to input files of tasks... (ctrl-d to exit)
<-------------> 0% WAITING

@radarsh
Copy link
Owner

radarsh commented Jan 16, 2019

You can omit the summary line (698 tests completed, 2 failed, 1 skipped) by setting showSummary to false in testlogger DSL. Will feedback about rest when I have more time for this project 🙂

@radarsh
Copy link
Owner

radarsh commented Feb 7, 2019

Thankfully Gradle outputs all that output that you don't want using stderr. So it's just a matter of redirecting stderr to /dev/null.

./gradlew clean test 2> /dev/null

Which prints for me:

com.adarshr.gradle.testlogger.TestResultWrapperSpec

    ✔ loggable returns true if result type SUCCESS is turned on
    ✔ loggable returns true if result type SKIPPED is turned on
    ✔ loggable returns true if result type FAILURE is turned on
    ✔ loggable returns true if result type SUCCESS is turned off but there are results of other types too
    ✔ loggable returns true if result type SKIPPED is turned off but there are results of other types too
    ✔ loggable returns true if result type FAILURE is turned off but there are results of other types too
    ✔ loggable returns false if result type SUCCESS is turned off
    ✔ loggable returns false if result type SKIPPED is turned off
    ✔ loggable returns false if result type FAILURE is turned off
    ✔ standardStreamLoggable returns true if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns false if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns true if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns false if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns true if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns false if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns false if loggable is false and showStandardStreams is true
    ✔ standardStreamLoggable returns false if loggable is true and showStandardStreams is false
    ✔ standardStreamLoggable returns false if loggable is false and showStandardStreams is false
    ✔ is too slow returns true if slow threshold is 10000
    ✔ is too slow returns true if slow threshold is 9999
    ✔ is too slow returns false if slow threshold is 10001
    ✔ is medium slow returns false if slow threshold is 20001
    ✔ is medium slow returns true if slow threshold is 20000
    ✔ is medium slow returns true if slow threshold is 10000
    ✔ get duration

  228 passing (5.6s)
  1 failing


> Task :test FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.2/userguide/command_line_interface.html#sec:command_line_warnings
8 actionable tasks: 8 executed

We can go one level further and silence those deprecations too by using

./gradlew clean test 2> /dev/null --warning-mode=none

Which now prints

com.adarshr.gradle.testlogger.TestResultWrapperSpec

    ✔ loggable returns true if result type SUCCESS is turned on
    ✔ loggable returns true if result type SKIPPED is turned on
    ✔ loggable returns true if result type FAILURE is turned on
    ✔ loggable returns true if result type SUCCESS is turned off but there are results of other types too
    ✔ loggable returns true if result type SKIPPED is turned off but there are results of other types too
    ✔ loggable returns true if result type FAILURE is turned off but there are results of other types too
    ✔ loggable returns false if result type SUCCESS is turned off
    ✔ loggable returns false if result type SKIPPED is turned off
    ✔ loggable returns false if result type FAILURE is turned off
    ✔ standardStreamLoggable returns true if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns false if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns true if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns false if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns true if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns false if loggable is true and showStandardStreams is true
    ✔ standardStreamLoggable returns false if loggable is false and showStandardStreams is true
    ✔ standardStreamLoggable returns false if loggable is true and showStandardStreams is false
    ✔ standardStreamLoggable returns false if loggable is false and showStandardStreams is false
    ✔ is too slow returns true if slow threshold is 10000
    ✔ is too slow returns true if slow threshold is 9999
    ✔ is too slow returns false if slow threshold is 10001
    ✔ is medium slow returns false if slow threshold is 20001
    ✔ is medium slow returns true if slow threshold is 20000
    ✔ is medium slow returns true if slow threshold is 10000
    ✔ get duration

  228 passing (5.6s)
  1 failing


> Task :test FAILED
8 actionable tasks: 8 executed

@radarsh radarsh closed this as completed Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants