Skip to content

Instantly share code, notes, and snippets.

@davidmigloz
Created January 28, 2016 12:33
Show Gist options
  • Save davidmigloz/8dabbdd012fbdb92838f to your computer and use it in GitHub Desktop.
Save davidmigloz/8dabbdd012fbdb92838f to your computer and use it in GitHub Desktop.
Basic template for Robotium testing.
package com.davidmiguel.taxsystem;
import junit.framework.Test;
import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite(AllTests.class.getName());
suite.addTest(TestSuite.createTest(ExampleTest.class, "testXXX"));
// Add here more test cases...
return suite;
}
}
package com.davidmiguel.taxsystem;
import android.test.ActivityInstrumentationTestCase2;
import com.davidmiguel.taxsystem.activities.EmployeesList;
import com.robotium.solo.Solo;
public class ExampleTest extends ActivityInstrumentationTestCase2<EmployeesList> {
private Solo solo;
public AddEmployeeTest() {
super(EmployeesList.class);
}
public void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
public void tearDown() throws Exception {
solo.finishOpenedActivities();
}
public void testXXX() throws Exception {
// Unlock the screen if it is locked
solo.unlockScreen();
// Write your test here...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment