I am developing an Android project on Eclipse, and I\'m trying to switch from running tests on the emulator/device (which is very slow) to Robolectric.
I re
We have had the same problems in the past. What works for us is extending RoboletricTestRunner and providing it a RoboletricConfig instance that is aware of our Project's location. This way I don't have to tinker with any run configurations with eclipse, it just works.
package ...;
import java.io.File;
import org.junit.runners.model.InitializationError;
import com.xtremelabs.robolectric.RobolectricConfig;
import com.xtremelabs.robolectric.RobolectricTestRunner;
public class TestRunner extends RobolectricTestRunner {
public static final string MAIN_PROJECT_PATH = "../path_to_android_project";
public TestRunner(Class> testClass) throws InitializationError {
super(testClass, new RobolectricConfig(new File(MAIN_PROJECT_PATH)));
}
}