I started to learning about Android lately. Now i'm trying to test some random Application with Robotium with Black-box testing method with no sources code or ID. The app i tried to test: https://play.google.com/store/apps/details?id=com.zing.zalo&hl=en . Just some simple function like: Open the app, login, log out. I implented External Jar "robotium" in the JUnit test project, build path is checked with robotium and everything else. I struggled with Pkg name, and activity name, then i saw some adb platform-toll "adb shell dumpsys activity" in the site below to get the name from my phone. ADB - Android - Getting the name of the current activity And many hours i read and searched from many sites this is the code i came up with:
public class LoginZalo extends ActivityInstrumentationTestCase2 {
public static Class LauncherActivityFullClass;
public Solo solo;
String pkg = "com.zing.zalo";
private static String launcher_activity_full_class = "/.ui.ZaloLauncherActivity";//login interface
static{
try {
LauncherActivityFullClass = Class.forName(launcher_activity_full_class);
} catch (Exception e) {
throw new RuntimeException();
}
}
public LoginZalo()
{
super(LauncherActivityFullClass);
}
protected void setUp() throws Exception {
solo = new Solo(getInstrumentation(),getActivity());
}
public void ZaloLogin()
{
solo.clickOnButton("LOGIN");
//also tried solo.clickOnButton(0); or solo.clickOnButton(1); or even clickOnText("LOGIN");
}
@Override
protected void tearDown() throws Exception {
// TODO Auto-generated method stub
solo.finishOpenedActivities();
}
}
AndroidManifest add target package.
<instrumentation
android:name="android.test.InstrumenttationTestRunner"
android:targetPackage="com.zing.zalo" />
But i only got a red error "Test run failed: No test results"in the console. I saw there is an comment on Robotium GitHub said Robotium can't do Black-box testing. I tried so many things from many site for many hours but getting nowhere. So i wonder, can Robotium Eclipse can do Black-box testing ? Maybe i did something wrong, because on Github site, they said Robotium can do black-box testing. Or i have to do it with Android Studio + Robotium Recorder ? Or maybe i should try something else like Appium ?