RemoteAndroidTestRunnerTestpublic class RemoteAndroidTestRunnerTest extends TestCase Tests RemoteAndroidTestRunner. |
Fields Summary |
---|
private RemoteAndroidTestRunner | mRunner | private MockDevice | mMockDevice | private static final String | TEST_PACKAGE | private static final String | TEST_RUNNER |
Methods Summary |
---|
private void | assertStringsEquals(java.lang.String str1, java.lang.String str2)Assert two strings are equal ignoring whitespace.
String strippedStr1 = str1.replaceAll(" ", "");
String strippedStr2 = str2.replaceAll(" ", "");
assertEquals(strippedStr1, strippedStr2);
| protected void | setUp()
mMockDevice = new MockDevice();
mRunner = new RemoteAndroidTestRunner(TEST_PACKAGE, TEST_RUNNER, mMockDevice);
| public void | testRun()Test the basic case building of the instrumentation runner command with no arguments.
mRunner.run(new EmptyListener());
assertStringsEquals(String.format("am instrument -w -r %s/%s", TEST_PACKAGE, TEST_RUNNER),
mMockDevice.getLastShellCommand());
| public void | testRunWithAddInstrumentationArg()Test the building of the instrumentation runner command with extra argument added.
final String extraArgName = "blah";
final String extraArgValue = "blahValue";
mRunner.addInstrumentationArg(extraArgName, extraArgValue);
mRunner.run(new EmptyListener());
assertStringsEquals(String.format("am instrument -w -r -e %s %s %s/%s", extraArgName,
extraArgValue, TEST_PACKAGE, TEST_RUNNER), mMockDevice.getLastShellCommand());
| public void | testRunWithLog()Test the building of the instrumentation runner command with log set.
mRunner.setLogOnly(true);
mRunner.run(new EmptyListener());
assertStringsEquals(String.format("am instrument -w -r -e log true %s/%s", TEST_PACKAGE,
TEST_RUNNER), mMockDevice.getLastShellCommand());
| public void | testRunWithMethod()Test the building of the instrumentation runner command with method set.
final String className = "FooTest";
final String testName = "fooTest";
mRunner.setMethodName(className, testName);
mRunner.run(new EmptyListener());
assertStringsEquals(String.format("am instrument -w -r -e class %s#%s %s/%s", className,
testName, TEST_PACKAGE, TEST_RUNNER), mMockDevice.getLastShellCommand());
| public void | testRunWithPackage()Test the building of the instrumentation runner command with test package set.
final String packageName = "foo.test";
mRunner.setTestPackageName(packageName);
mRunner.run(new EmptyListener());
assertStringsEquals(String.format("am instrument -w -r -e package %s %s/%s", packageName,
TEST_PACKAGE, TEST_RUNNER), mMockDevice.getLastShellCommand());
|
|