Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining the Gradle test execution order

Tags:

gradle

I was wondering whether it's possible to obtain information about test execution order somehow.

I have a project in Maven and all the tests are passing. After I migrated the project to Gradle, one of the tests started failing. The test itself is working: when I execute gradle test -Dtest.single=..., it passes. However, when I run the tests for the whole project, the test fails.

It's possible that some tests that run before the failing test do not release resources correctly and therefore the test fails. But I need to somehow find out which tests are causing this problem.

like image 248
Matthew Lowe Avatar asked Sep 30 '22 03:09

Matthew Lowe


2 Answers

Tell Gradle to log more events about test processing. There is a documentation how to do that http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.logging.TestLoggingContainer.html

like image 73
Radim Avatar answered Oct 05 '22 12:10

Radim


The beforeTest method can be used to output details about each test before it is run, based on a TestDescriptor for each test:

test {
    beforeTest { testDescriptor ->
        println "${testDescriptor.className} > ${testDescriptor.name} STARTED"
    }
}
like image 21
Hakanai Avatar answered Oct 05 '22 12:10

Hakanai