Methods Summary |
---|
private void | assertContentsInOrder(java.util.List actual, android.test.suitebuilder.ListTestCaseNames.TestDescriptor source)
TestDescriptor[] clonedSource = source.clone();
assertEquals("Unexpected number of items.", clonedSource.length, actual.size());
for (int i = 0; i < actual.size(); i++) {
TestDescriptor actualItem = actual.get(i);
TestDescriptor sourceItem = clonedSource[i];
assertEquals("Unexpected item. Index: " + i, sourceItem, actualItem);
}
|
private void | assertTestRunnerCalledWithExpectedParameters(java.lang.String expectedTestClassName, java.lang.String expectedTestMethodName)
Test test = mStubAndroidTestRunner.getTest();
assertContentsInOrder(ListTestCaseNames.getTestNames((TestSuite) test),
new TestDescriptor(expectedTestClassName, expectedTestMethodName));
assertTrue(mInstrumentationTestRunner.isStarted());
assertFalse(mInstrumentationTestRunner.isFinished());
|
private android.os.Bundle | createBundle(java.lang.String key, java.lang.String value)
Bundle bundle = new Bundle();
bundle.putString(key, value);
return bundle;
|
protected void | setUp()
super.setUp();
mStubAndroidTestRunner = new StubAndroidTestRunner();
mTargetContextPackageName = "android.test.suitebuilder.examples";
mInstrumentationTestRunner = new StubInstrumentationTestRunner(
new StubContext("com.google.foo.tests"),
new StubContext(mTargetContextPackageName), mStubAndroidTestRunner);
|
public void | testDelayParameter()
int delayMsec = 1000;
Bundle args = new Bundle();
args.putInt(InstrumentationTestRunner.ARGUMENT_DELAY_MSEC, delayMsec);
args.putString(InstrumentationTestRunner.ARGUMENT_TEST_CLASS,
PlaceHolderTest.class.getName() + "," +
PlaceHolderTest2.class.getName());
mInstrumentationTestRunner.onCreate(args);
Thread t = new Thread() { public void run() { mInstrumentationTestRunner.onStart(); } };
// Should delay three times: before, between, and after the two tests.
long beforeTest = System.currentTimeMillis();
t.start();
t.join();
assertTrue(System.currentTimeMillis() > beforeTest + delayMsec * 3);
assertTrue(mInstrumentationTestRunner.isStarted());
assertTrue(mInstrumentationTestRunner.isFinished());
assertTrue(mStubAndroidTestRunner.isRun());
|
public void | testMultipleTestClass()
String classArg = PlaceHolderTest.class.getName() + "," +
PlaceHolderTest2.class.getName();
mInstrumentationTestRunner.onCreate(createBundle(
InstrumentationTestRunner.ARGUMENT_TEST_CLASS, classArg));
Test test = mStubAndroidTestRunner.getTest();
assertContentsInOrder(ListTestCaseNames.getTestNames((TestSuite) test),
new TestDescriptor(PlaceHolderTest.class.getName(), "testPlaceHolder"),
new TestDescriptor(PlaceHolderTest2.class.getName(), "testPlaceHolder2"));
|
public void | testOverrideTestToRunWithClassAndMethodArgument()
String expectedTestClassName = PlaceHolderTest.class.getName();
String expectedTestMethodName = "testPlaceHolder";
String classAndMethod = expectedTestClassName + "#" + expectedTestMethodName;
mInstrumentationTestRunner.onCreate(createBundle(
InstrumentationTestRunner.ARGUMENT_TEST_CLASS, classAndMethod));
assertTestRunnerCalledWithExpectedParameters(expectedTestClassName,
expectedTestMethodName);
|
public void | testOverrideTestToRunWithClassArgument()
String expectedTestClassName = PlaceHolderTest.class.getName();
mInstrumentationTestRunner.onCreate(createBundle(
InstrumentationTestRunner.ARGUMENT_TEST_CLASS, expectedTestClassName));
assertTestRunnerCalledWithExpectedParameters(expectedTestClassName, "testPlaceHolder");
|
public void | testUseSelfAsTestSuiteProviderWhenNoMetaDataOrClassArgument()
TestSuite testSuite = new TestSuite();
testSuite.addTestSuite(PlaceHolderTest.class);
mInstrumentationTestRunner.setAllTestsSuite(testSuite);
mInstrumentationTestRunner.onCreate(null);
assertTestRunnerCalledWithExpectedParameters(
PlaceHolderTest.class.getName(), "testPlaceHolder");
|