The issue I have with robolectric is that it doesn’t make real HttpRequests.
Could I replace the HttpClient implementation of robolectric using a real one actually making the calls to my local test server?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Jan Berkel submitted a pull request to Robolectric that was merged into master on March 8th. You can now call
Robolectric.getFakeHttpLayer().interceptHttpRequests(false);in the beginning of your test to bypass the mocked http layer in Robolectric.You can download the jar directly from Sonatype to include in your Eclipse Android project. If you are using Maven and 1.1 has not yet been released (check at the Sonatype url above) then you will need to add the sonatype snapshot repo and use robolectric 1.1-SNAPSHOT. You can do this by adding the following to your pom.xml
I am using this for integration test that run against a real server and it works well.