Hi guys,
First all I'm falling in love with Robolectric is just pure awesome...
so far the best way TDD Android apps IMO
I've already done serveral successful tests, in most of them using
mocks with EasyMock in other stubs and fakes, and some of them using
Shadows... all of them work wonderful even the JSON integration tests
using the org.json library.
Second again me, with another problem, looking for help n_n
The problem now is with DefaultHttpClient, I'm doing an integration
test that as unit with mocks works awesome
But now I want to test with a real implementation so far resuming a
lot is something like the following dumb test:
@RunWith(RobolectricTestRunner.class)
public class HttpClientExecutorIntegrationTest {
@Test
public final void testDummyGet() {
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response;
try {
response = httpclient.execute(new HttpGet("
http://google.com/"));
assertNotNull(response);
assertTrue(response.getStatusLine().getStatusCode() == 200);
} catch (ClientProtocolException e) {
fail("ClientProtocolException");
e.printStackTrace();
} catch (IOException e) {
fail("IOException");
e.printStackTrace();
}
}
}
The problem is that as JUnit 4 test (obviously removing
@RunWith(RobolectricTestRunner.class)) works OK and I get green but as
Robolectric test doesn't work even linking the HttpClient jars and
dependencies just assertNotNull(response); always fails and
httpclient.execute(new HttpGet("
http://google.com/")); always returns
null
Any ideas, suggestion or experience with this?
Thanks!