aryaxt
aryaxt

Reputation: 77596

Android - UITesting with Robotium?

I am trying to use robotium to test my Activities. I used guice and roboguice for Dependency injection all over my code.

Is there anything I have to do to allow Injection while running my automation tests? or is robotium going to do that for me?

Please provide as much details as you can. Thanks

Upvotes: 2

Views: 812

Answers (1)

dmon
dmon

Reputation: 30168

Robotium doesn't have any knowledge of Roboguice, but you can use injection with anything that extends ActivityInstrumentationTestCase2. Before every test, you just have to "initialize your application" by getting the Application and retrieving the injector from there.

    YourApplication app = getApplication(); //YourApplication has to extend from RoboApplication
    app.setServiceModuleOverride(yourTestModule); //do this if you want to provide your overrides
    app.getInjector().injectMembers(this);

Upvotes: 3

Related Questions