Gradle: How to Display Test Results in the Console in Real Time?

后端 未结 16 1067
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 00:39

I would like to see test results ( system.out/err, log messages from components being tested ) as they run in the same console I run:

gradle test
         


        
16条回答
  •  日久生厌
    2020-11-28 01:34

    Disclaimer: I am the developer of the Gradle Test Logger Plugin.

    You can simply use the Gradle Test Logger Plugin to print beautiful logs on the console. The plugin uses sensible defaults to satisfy most users with little or no configuration but also offers a number of themes and configuration options to suit everyone.

    Examples

    Standard theme

    Mocha theme

    Usage

    plugins {
        id 'com.adarshr.test-logger' version ''
    }
    

    Make sure you always get the latest version from Gradle Central.

    Configuration

    You don't need any configuration at all. However, the plugin offers a few options. This can be done as follows (default values shown):

    testlogger {
        // pick a theme - mocha, standard, plain, mocha-parallel, standard-parallel or plain-parallel
        theme 'standard'
    
        // set to false to disable detailed failure logs
        showExceptions true
    
        // set to false to hide stack traces
        showStackTraces true
    
        // set to true to remove any filtering applied to stack traces
        showFullStackTraces false
    
        // set to false to hide exception causes
        showCauses true
    
        // set threshold in milliseconds to highlight slow tests
        slowThreshold 2000
    
        // displays a breakdown of passes, failures and skips along with total duration
        showSummary true
    
        // set to true to see simple class names
        showSimpleNames false
    
        // set to false to hide passed tests
        showPassed true
    
        // set to false to hide skipped tests
        showSkipped true
    
        // set to false to hide failed tests
        showFailed true
    
        // enable to see standard out and error streams inline with the test results
        showStandardStreams false
    
        // set to false to hide passed standard out and error streams
        showPassedStandardStreams true
    
        // set to false to hide skipped standard out and error streams
        showSkippedStandardStreams true
    
        // set to false to hide failed standard out and error streams
        showFailedStandardStreams true
    }
    

    I hope you will enjoy using it.

提交回复
热议问题