with the code below, the tests are not executed in the order I'd like. test_homescreen is executed before test_splashscreen.
I'd like to specify the tests to run and their order of execution. I believe I need to create a testsuite, but I don't know how to implement that.
package com.myapp.test;
import com.jayway.android.robotium.solo.Solo;
import android.test.ActivityInstrumentationTestCase2;
import com.myapp.R;
public class myTest extends ActivityInstrumentationTestCase2{
private static final String TARGET_PACKAGE_ID="com.myapp.test";
private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME="com.myapp.gui.SplashScreen";
private static Class launcherActivityClass;
static{
try
{
launcherActivityClass=Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
} catch (ClassNotFoundException e){
throw new RuntimeException(e);
}
}
public myTest ()throws ClassNotFoundException{
super(TARGET_PACKAGE_ID,launcherActivityClass);
}
private Solo solo;
@Override
protected void setUp() throws Exception{
solo = new Solo(getInstrumentation(),getActivity());
}
public void test_splashscreen() throws InterruptedException {
TextView splashAppVersion = (TextView) solo.getView(R.id.AppVersion);
assertTrue(splashAppVersion.isShown());
}
public void test_homescreen() throws InterruptedException {
ListView lv = (ListView) solo.getView(R.id.List);
assertTrue(lv.isShown());
}
@Override
public void tearDown() throws Exception {
try {
solo.finishOpenedActivities();
} catch (Throwable e) {
e.printStackTrace();
}
super.tearDown();
}
}
execute first test_splashscreen(), then test_homescreen()
execute only test_homescreen()
this post seems to be close to what I'd like but I have not been able to utilize it. too generic. Android Robotium - How to manage the execution order of testcases?