Here is some sample test code from the Radical Art Template
It uses Android Studio to run the code and perform page turns.
package radical.art.template; import android.test.ActivityInstrumentationTestCase2; /** * A class to perform page turns on your emulator or phone of the Radical Art Template. */ public class PageTurnTests extends ActivityInstrumentationTestCase2<MainActivity> { private MainActivity mainActivity; public PageTurnTests() { super(MainActivity.class); } protected void setUp() throws Exception { super.setUp(); mainActivity = getActivity(); } /** * You can adjust the number of turns the application will perform as well as the speed that it performs them. */ public void testRightTurn() { // set the number of page turns to perform final int TURNS = 100; // set the speed at which the pages turn to test if it will work final int SPEED = 50; //check the position of the current image position int before = mainActivity.common.currentImagePosition; getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mainActivity.RightArrowClick(null); } }); // the actual position should have changed int actual = mainActivity.common.currentImagePosition; assertTrue(actual != before); //perform the same page turns in a loop for (int i = 0; i < TURNS; i++) { try { Thread.sleep(SPEED); } catch (InterruptedException e) { e.printStackTrace(); } before = mainActivity.common.currentImagePosition; getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mainActivity.RightArrowClick(null); } }); actual = mainActivity.common.currentImagePosition; assertTrue(actual != before); } } /** * You can adjust the number of turns the application will perform as well as the speed that it performs them. */ public void testLeftPageTurns() { // set the number of page turns to perform final int TURNS = 100; // set the speed at which the pages turn to test if it will work final int SPEED = 100; //check the position of the current image position int before = mainActivity.common.currentImagePosition; getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mainActivity.LeftArrowClick(null); } }); // the actual position should have changed int actual = mainActivity.common.currentImagePosition; assertTrue(actual != before); //perform the same page turns in a loop for (int i = 0; i < TURNS; i++) { try { Thread.sleep(SPEED); } catch (InterruptedException e) { e.printStackTrace(); } before = mainActivity.common.currentImagePosition; getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { mainActivity.LeftArrowClick(null); } }); actual = mainActivity.common.currentImagePosition; assertTrue(actual != before); } } }