5

It was working before. But now it doesn't anymore. The IDE just shows "Instantiating tests...". But when I wait for 10 minutes, then all of a sudden it does work? The machine is a Macbook Pro, Mid 2015. The problem only occurs on androidTest, the test directory works fine.

@LargeTest
@RunWith(AndroidJUnit4::class)
class SomeTestClass {

    @get:Rule
    var activityTestRule = ActivityTestRule(
            NavigationActivity::class.java, false, false)

    @Before
    fun before() {
        Timber.d("When debugging, this triggers only after about 10 minutes.")
    }

    @Test
    fun testContents() {
        Assert.assertEquals(0, 0)
    }    
}

The log keeps outputting this:

D/EZIO_NLOG: watchdog_routine executed!
D/EZIO_NLOG: check1 
    check1 
    check2 
    check2 

Tried the following things:

  1. File, Invalidate Cache / Restart
  2. Tried this answer. But it seems to be outdated.
  3. Edit Configurations..., Selected "All in Package", "Class" and "Method". None of them work.
  4. When I wait really long, like 10 minutes, then all of a sudden it triggers and works.

enter image description here enter image description here

Jim Clermonts
  • 1,694
  • 8
  • 39
  • 94

1 Answers1

0

Android Tests are slow and on top of that debugger adds more load to it. I have faced the same problem and I agree that using a debugger with Android Tests is a pain.

Below is something I found here Espresso detects when the main thread is idle, so it is able to run your test commands at the appropriate time, improving the reliability of your tests.

and on top of that when a debugger is added it makes it more slow.

You can try running the tests on a real device it should be bit faster(I am assuming)

cdevansh
  • 268
  • 1
  • 10