Issue
I am facing a strange behaviour with Android Unit Tests. In my test package I have a collection of UnitTest classes. If I right-click one of these classes and let them run, all is good. But when I right-click the package and want to run all tests within this package, only one of the classes is executed. The other tests are ignored (see screenshot)
When I run gradlew test
, I get the following output for almost all test classes:
com.my.project.GalleriesTest > classMethod FAILED
java.lang.IllegalStateException
Any idea how I can run all my tests at once? Or any idea where to continue digging?
Solution
@Philip Sorry for not posting the answer yet. I ran the tests using by clicking on the gradle task in the "Gradle Tab" of Android Studio. For some reason this gave me more detailed output which led me to the solution. All my tests were extending a BaseTest class. In this class I started the MockWebServer without stopping it. That's why first test runs without problems, but all following tests could not run, because the MockWebServer was already started and could not be started a second time.
Answered By - muetzenflo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.