Google released a new UI automation framework called Espresso, which I think is much better than Robotium after using it for few months. It will be great if cucumber-android can also support it. I've tried and it's actually a very simple change. Just make CucumberInstrumentation to extend Espresso's GoogleInstrumentationTestRunner, and move super.onCreate() call from the first line in onCreate() to the last line, and remove the start() in onCreate().
We may not want to have Espresso dependencies if the user isn't using it, so maybe the best way to do it is to create another Instrumentation like CucumberEspressoInstrumentation.
I was thinking about that already. I like your idea. Can you provide a pull request?
I really want to, and that's a really easy two liner change. I have that done on my local machine. However, my company has strict policy on contribution to open source projects, so I can't without first going through the complicated review process. So hopefully someone else can do that. It's really quite simple, just two lines of code change.
@SierraGolf @K76154 I took a stab at enabling Espresso support in #667 (without introducing a dependency on Espresso, since it does not look officially available through Maven). Comments are more than welcome.
@brasmusson That's exactly what I was thinking. Just don't understand what those public static final fields are for. Thanks for making the pull request.
@K76154 I don't understand the public fields either. CucumberInstrumentation.TAG is used in the before and after hooks in example/andriod-test. There might be some advantage of being able to group logs from the step definitions in the same tag as the other logs from Cucumber-Android, but both CucumberInstrumentation.REPORT_VALUE_ID and CucumberInstrumentation.REPORT_KEY_NUM_TOTAL looks as if they should have been private.
I kept them as public in CucumberInstrumenatation just to be very sure not to break someone current use of Cucumber-Android. Maybe especially CucumberInstrumentation.REPORT_VALUE_ID and CucumberInstrumentation.REPORT_KEY_NUM_TOTAL should at least be made deprecated in the PR.
Take a look at the source of Instrumentation.java and InstrumentationTestRunner.java to understand the existence of these fields.
Unfortunately InstrumentationTestRunner is not designed for inheritance, that is why CucumberInstrumentation had to copy a lot of code from this class. Since copying code and making very minor modifications is even worse than just copying code 1:1, the code went into CucumberInstrumentation as is. Plus, for an external user, CucumberInstrumentation should feel and behave just like the real InstrumentationTestRunner.