We use Robolectric
for UnitTests on our SDK, but there is one thing that I noticed that absolutely clogs the logs when we run our test (this is especially a problem on Jenkins
re almost 200 tests work).
An example of the beginning of all our tests is
@RunWith(RobolectricGradleTestRunner.class) @Config(constants = BuildConfig.class, emulateSdk=21) public class AppTest { private MainActivity activity; @Before public void setUp() throws Exception { activity = Robolectric.buildActivity(MainActivity.class).create().start().resume().visible().get(); } }
But when we run through the line,
activity = Robolectric.buildActivity(MainActivity.class).create().start().resume().visible().get();
We get it in our magazines,
18:56:02 W/InputEventReceiver: Attempted to consume batched input events but the input event receiver has already been disposed. 18:56:02 W/InputEventReceiver: Attempted to consume batched input events but the input event receiver has already been disposed. 18:56:02 W/InputEventReceiver: Attempted to consume batched input events but the input event receiver has already been disposed.
Three lines, over and over and over. Printing takes place deep inside source Android
, in android.view.InputEventReceiver:consumeBatchedInputEvents
,
public final boolean consumeBatchedInputEvents(long frameTimeNanos) { if (mReceiverPtr == 0) { Log.w(TAG, "Attempted to consume batched input events but the input event " + "receiver has already been disposed."); } else { return nativeConsumeBatchedInputEvents(mReceiverPtr, frameTimeNanos); } return false; }
Therefore, without figuring out how to suppress the registrar (which I would prefer not to do), I would like to find a way to prevent this from happening at the beginning of each test.
source share