You should build your activity that will be easily work with integrations tests.
For this you have to build your modules separately with no dependencies between them.
For example, if you have Activity that relay on some data that fetched from the server, your components should look something like this:
public class AppActivity extends Activity {
private DataFetcher fetcher;
public AppActivity() {
//use this for real
fetcher = new ServerDataFetcher();
//or use this for tests
fetcher = new MockDataFetcher();
//you can even select it using DI frameworks
}
}
public interface DataFetcher {
public Data fetchData();
}
public class ServerDataFetcher implement DataFetcher{
public Data fetchData() {
//get your data from server
}
}
public class MockDataFetcher implement DataFetcher{
public Data fetchData() {
//return a pre-fetched data
}
}