vincentjames501
vincentjames501

Reputation: 2131

RoboGuice 2.0 and Robolectric 1.1 Testing RoboAsyncTask

I am currently using both RoboGuice 2.0 and Robolectric 1.1 in my Android application. I've noticed that the RoboLooperThread is gone in 2.0 and I'm having difficulties having any RoboAsyncTask's be invoked. When the main test thread calls .execute() on the RoboAsyncTask, the RoboAsyncTask's call() method is never called. My question is how can I force the test thread to switch to and from the UI thread so that way the task can be executed?

Thanks,

Vince

Upvotes: 3

Views: 498

Answers (1)

vincentjames501
vincentjames501

Reputation: 2131

I've found a working solution. The RoboAsyncTask appears to be put on Robolectric's UiThreadScheduler and can be invoked via Robolectric.runUiThreadTasksIncludingDelayedTasks();

Upvotes: 3

Related Questions