Methods Summary |
---|
protected void | addSingleTestMethod(java.lang.Class clazz, java.lang.String method)
if (!(mFilter.accept(clazz))) {
throw new RuntimeException("Test class must be derived from UiAutomatorTestCase");
}
try {
TestCase testCase = (TestCase) clazz.newInstance();
testCase.setName(method);
mTestCases.add(testCase);
} catch (InstantiationException e) {
mTestCases.add(error(clazz, "InstantiationException: could not instantiate " +
"test class. Class: " + clazz.getName()));
} catch (IllegalAccessException e) {
mTestCases.add(error(clazz, "IllegalAccessException: could not instantiate " +
"test class. Class: " + clazz.getName()));
}
|
public void | addTestClass(java.lang.String className)Adds class to test by providing class name in string.
The class name may be in "#" format
int hashPos = className.indexOf('#");
String methodName = null;
if (hashPos != -1) {
methodName = className.substring(hashPos + 1);
className = className.substring(0, hashPos);
}
addTestClass(className, methodName);
|
public void | addTestClass(java.lang.String className, java.lang.String methodName)Adds class to test by providing class name and method name in separate strings
Class<?> clazz = mClassLoader.loadClass(className);
if (methodName != null) {
addSingleTestMethod(clazz, methodName);
} else {
Method[] methods = clazz.getMethods();
for (Method method : methods) {
if (mFilter.accept(method)) {
addSingleTestMethod(clazz, method.getName());
}
}
}
|
public void | addTestClasses(java.util.List classNames)Adds classes to test by providing a list of class names in string
The class name may be in "#" format
for (String className : classNames) {
addTestClass(className);
}
|
private UiAutomatorTestCase | error(java.lang.Class clazz, java.lang.String message)
UiAutomatorTestCase warning = new UiAutomatorTestCase() {
protected void runTest() {
fail(message);
}
};
warning.setName(clazz.getName());
return warning;
|
public java.util.List | getTestCases()Gets the list of added test cases so far
return Collections.unmodifiableList(mTestCases);
|