Robotium BDD with Cucumber

0
0

I want to know if you guys know how to make BDD tests with Robotium.

As I research Robotium works with a different Virtual Machine (Dalvik) so I cannot run as Junit Test (Only with Android Junit Test). So I found a possible solution to run Robotium with Junit with RoboRemote https://github.com/groupon/robo-remote. But when i tried to integrate with cucumber the tests became unstable.

So you guys know some way to make BDD tests using Robotium?

  • You must to post comments
0
0

I have successfully integrated Robotium using Cucumber-JVM for Android.

For information about the now official cucumber-android module for Cucumber-JVM and the installation, have a look here. You can also find API-documentation and examples about Cucumber-JVM here: http://cukes.info/platforms.html.

In your test-module for your app, simply add the Robotium Solo jar-file as a dependency (Scope: Compile).

One of my test-classes looks like this:

public class CucumberSteps extends ActivityInstrumentationTestCase2<YourActivity> {
private Solo solo;
public CucumberSteps() {
super(YourActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Before
public void before() {
solo = new Solo(getInstrumentation(), getActivity());
}
@After
public void after() throws Throwable {
//clean up
solo.finalize();
}
@Override
protected void tearDown() throws Exception {
solo.finishOpenedActivities();
super.tearDown();
}
@Given("^step_given_description$")
public void step_given_description() throws Throwable {
final View testView = solo.getView(R.id.testView);
solo.waitForView(testView);
solo.clickOnView(testView);
// and so on
}
}

I hope this is enough information for anyone to get started. When this question was asked, cucumber-android didn’t exist yet. Keep in mind though, GUI tests are very often somewhat unstable! I managed to get a stable set of tests locally, but e.g. in Jenkins, usually some tests fail for unknown reasons.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website