'Time limit for Android Benchmark library?
I am using Android Benchmark library from Google and something that I have seen is that apparently it times out for slow computations (e.g. parsing a lot of data). This is a sample test:
@get:Rule
val benchmarkRule = BenchmarkRule()
@Test
fun quickTest() {
benchmarkRule.measureRepeated {
Thread.sleep(10)
}
}
@Test
fun slowTest() {
benchmarkRule.measureRepeated {
Thread.sleep(100)
}
}
While quickTest
gives a result, slowTest
shows:
Timed out waiting for process (<package>) to appear on <device>.
Is it possible to extend or remove the timeout?
Solution 1:[1]
You can annotate your tests depending on how long they might be running.
If you know the test might take longer than 1000ms to complete, use @LargeTest
.
For tests that are likely shorter than 1000ms use @MediumTest
.
And tests that are very fast, less than 200ms use @SmallTest
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | keyboardsurfer |