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

后端 未结 16 1072
隐瞒了意图╮
隐瞒了意图╮ 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:31

    As a follow up to Shubham's great answer I like to suggest using enum values instead of strings. Please take a look at the documentation of the TestLogging class.

    import org.gradle.api.tasks.testing.logging.TestExceptionFormat
    import org.gradle.api.tasks.testing.logging.TestLogEvent
    
    tasks.withType(Test) {
        testLogging {
            events TestLogEvent.FAILED,
                   TestLogEvent.PASSED,
                   TestLogEvent.SKIPPED,
                   TestLogEvent.STANDARD_ERROR,
                   TestLogEvent.STANDARD_OUT
            exceptionFormat TestExceptionFormat.FULL
            showCauses true
            showExceptions true
            showStackTraces true
        }
    }
    

提交回复
热议问题