jeudi 2 juillet 2020

Gradle test task generating different results when run with Android Studio

I have a multi-module project. In the given example, I have an SDK module and an APP module. In SDK module I have declared an MyApiException class, which extends Exception. Then I have multiple classes which extends MyApiException and some of those have child as well. There are some MyException classes in APP module as well, which extend MyApiException. The SDK module is included in the gradle.build.

The problem: I have a unit test which generates type hierarchy from the given task. This is happening by using reflection. These tests are located in the APP module. I am running these tests with MyApiException::class.java, because I want to compare with expected type hierarchy. When I run those tests in AS, they pass without a problem and print out the expected type hierarchy in the console. When I run those tests with ./gradlew task test, they fail and the type hierarchy printed out only contains classes from the SDK module. Is there some configuration I need to include in build.gradle so the tests take in count classes from different modules ? Some testImplementation I am missing?





Aucun commentaire:

Enregistrer un commentaire