» Home » Robolectric » Page 1
Robolectric: SAXParser in Android vs SAXParser in Java (robolectric) : difference in localname vs qname
by HokieGeek in Java

I used to run my unit tests using Android Unit Test but switched to Java Unit Test using Robolectric. I noticed a difference in using the SaxParser DefaultHandler. Basically, the Android sax parser would populate "localName" but when run under Robolectric using the Java VM localName is empty, and qname seems to contain the value I should use.

Here is the method I am refering too:<

Robolectric and IntentServices
by Pug in Programming Languages

Using Robolectric, how would one go about testing an IntentService that broadcasts intents as a response?

Assuming the following class:

class MyService extends IntentService {
protected void onHandleIntent(Intent intent) {
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("action"));

Robolectric & testing startActivityForResult
by IHateMyJob2004 in Programming Languages

I have troubles with my Robolectric unit test.

I can assert without problem that a click started a new activity when the listener uses the method startActivity( Intent )

But it seems Robolectric has trouble when a new activity is started with the method startActivityForResult(Intent, int) : putting some breaks in the code made me figured that t

Robolectric Customizing ShadowSQLiteOpenHelper
by Dandor in Programming Languages

Started using Robolectric a while ago and I'm currently running in some issues creating my own shadow objects. I've written some code that tests the behavior of my customized SQLiteOpenHelper class which basically only calls the onCreate methods of my database tables.

public class SharedDatabaseHelperTest {
private Sha

Robolectric: how to test a SherlockActivity
by sdifox in Programming Languages

I'm trying to run tests on an Activity which extends SherlockActivity. I read everything I could find about the solutions for testing activities with ActionBarSherlock and also tried following https://github.com/passy/absshadow-sample

this is what I'm currently doing:

custom test runner:

public class CustomTestRunner extends RobolectricTestRunner {

How to test an IntentService with Robolectric?
by Asif in Programming Languages

I'm trying to test the onHandleIntent() method of an IntentService using Robolectric.

I'm starting the service with:

Activity activity = new Activity();
Intent intent = new Intent(activity, MyService.class);
ShadowActivity shadowActivity = Robolectric.shadowOf(activity);
Intent s

Robolectric: Testing with ormlite
by vi edit in Programming Languages

I'm trying to test ORMLite DAOs with robolectric, but database behaviour is not the same as when it's used from my android app. My DAOs are working perfectly well on the android application.

Reading about robolectric shadows and debugging code, I encountered ShadowSQLiteOpenHelper (code here).

Does anyone know if this Shadow is enough to test ormlite daos? Or I have to c

Action Bar Sherlock + Robolectric
by AnthonyC in Programming Languages

We use Robolectric for our test cases at work which seems to not work well Action Bar Sherlock.

Problem is that I get a No implementations match configuration message, because the Build.VERSION.SDK_INT == 0 when run via robolectric.

If anyone has ideas on the best way of getting ABS working nice with Robolectric, I'd love to know. If I find out

can jmockit and robolectric coexist?
by Simon Capewell in Programming Languages

I'm trying to implement a unit test using Robolectric to replace the stubbed methods in android.jar while also using jMockit to mock an Android class (Fragment, in my case). However, I can't seem to get it to work. If I annotate the test class with @RunWith(RobolectricTestRunner.class), I get:

java.lang.IllegalStateException: JMockit wasn't properly initialized; che

Robolectric print Log or Console messages
by Mike in Programming Languages

I wrote a small test using Robolectric. There is an issue - no messages are written to the test console. In the tested code there is a lot of code like




but anyway, there is no output.


Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .