Methods Summary |
---|
public junit.framework.TestSuite | getTestSuite()
return getTopTestSuite();
|
private junit.framework.TestSuite | getTestSuiteToBrowse()Subclasses will override this method and return the TestSuite specific to their .apk.
When this method is invoked due to an intent fired from
{@link #onItemClick(android.widget.AdapterView, android.view.View, int, long)} then get the
targeted TestSuite from the intent.
Intent intent = getIntent();
if (Intent.ACTION_RUN.equals(intent.getAction())) {
String testClassName = intent.getData().toString();
try {
Class<Test> testClass = (Class<Test>) getClassLoader().loadClass(testClassName);
return TestCaseUtil.createTestSuite(testClass);
} catch (ClassNotFoundException e) {
Log.e("TestBrowserActivity", "ClassNotFoundException for " + testClassName, e);
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
Log.e("TestBrowserActivity", "IllegalAccessException for " + testClassName, e);
throw new RuntimeException(e);
} catch (InstantiationException e) {
Log.e("TestBrowserActivity", "InstantiationException for " + testClassName, e);
throw new RuntimeException(e);
}
} else {
// get test classes to browwes from subclass
return getTopTestSuite();
}
|
public abstract junit.framework.TestSuite | getTopTestSuite()
|
protected void | onCreate(android.os.Bundle savedInstanceState)
super.onCreate(savedInstanceState);
getListView().setOnItemClickListener(this);
mTestBrowserController = ServiceLocator.getTestBrowserController();
mTestBrowserController.setTargetPackageName(getPackageName());
mTestBrowserController.registerView(this);
mTestBrowserController.setTargetBrowserActivityClassName(this.getClass().getName());
// Apk paths used to search for test classes when using TestSuiteBuilders.
String[] apkPaths = {getPackageCodePath()};
ClassPathPackageInfoSource.setApkPaths(apkPaths);
|
public void | onItemClick(android.widget.AdapterView parent, android.view.View v, int position, long id)
Intent intent = mTestBrowserController.getIntentForTestAt(position);
intent.putExtra(BUNDLE_EXTRA_PACKAGE, getPackageName());
startActivity(intent);
|
protected void | onStart()
super.onStart();
TestSuite testSuite = getTestSuiteToBrowse();
mTestBrowserController.setTestSuite(testSuite);
String name = testSuite.getName();
if (name != null) {
setTitle(name.substring(name.lastIndexOf(".") + 1));
}
|
public void | setTestNames(java.util.List testNames)
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,
R.layout.test_list_item, testNames);
setListAdapter(arrayAdapter);
|