Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 20295

Unit test fail when I run "gradle test" but run in Intellij successfully

$
0
0

Ran into this issue as well. Works fine from IntelliJ running a single test or all tests in a class but fails when I try to build with gradle (e.g. gradlew clean build).

Found that setting forkEvery=1 allows the build to complete successfully. This is a work around to having some leaky tests. (https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:forkEvery)

test {
    forkEvery = 1
}

For debugging why it’s happening, I’ve setup a junit test suite to run multiple test classes in a row from within IntelliJ. https://github.com/junit-team/junit4/wiki/Aggregating-tests-in-suites


Viewing all articles
Browse latest Browse all 20295

Trending Articles