|
Project Information
Featured
Downloads
Links
|
Loquacious DroidLoquacious Droid is a functional testing framework for the Android platform that uses a fluent DSL. This is the third implementation of the Loquacious testing framework. Thus, the DSL used is heavily based on Python's Loquacious-Snake and PHP's Loquacious-Elephant that were developed by the same authors. Inspired and built with parts of the Robotium project, it is intended to be used as an alternative to Robotium. An test example taken from a sample Projectpublic void testThatAnReminderCanBeDeletedByTheContextMenuBroughtByALongClickOnTheReminder() throws Throwable{
havingAlreadyAddedToHisReminders( aReminder()
.withThisTitle("Pick up the kids")
.andThisDescription("At school on friday")
.build()
);
aUserOfMyReminderAppGoesToTheHomePage();
aUserOfMyReminderApp.looksAtThisListView(R.id.list_of_my_reminders)
.andPressesForALongTimeTheElementThatContainsThisText("Pick up the kids")
.andThen()
.waitsForThisTextToAppear("Delete this reminder");
aUserOfMyReminderApp.clicksTheElementsContainingThisText("Delete this reminder");
aUserOfMyReminderApp.waitsForThisTextToDisappear("Delete this reminder")
.andThen()
.looksAtThisListView(R.id.list_of_my_reminders)
.andItShouldNotContainThisText("Pick up the kids");
}
How to get startedUsing IntelliJ Idea
Your first test class could look a little like this : public class SystemTests extends ActivityInstrumentationTestCase2<HomePageActivity> {
private AndroidUser anAndroidUser;
public SystemTests(){
super("com.package.to.your.homepage.activity", HomePageActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
anAndroidUser = new AndroidUser(getInstrumentation(),getActivity());
}
@Override
public void tearDown() throws Exception {
anAndroidUser.quits();
super.tearDown();
}
private String getString(int id){
return anAndroidUser.getActivity().getString(id);
}
public void testThatTheHomePageShowsAnAppropriateWelcomingMessage(){
anAndroidUser.looksAtThisTextView(R.id.welcoming_message)
.andItShouldContainThisText(getString(R.string.welcoming_message));
}
Notes :
Advantages over using InstrumentationTestCaseUsing Loquacious, you can write scenarios that span over as many activities as you wish. The syntax is written form the standpoint of the activities that the user will do with your software Advantages over using RobotiumTest are written using a fluent interface, meaning that the steps of a scenario can be read like a regular sentence. Scenarios implemented from the standpoint of the user will make it easier to integrate with Cucumber and the likes. |