FileDocCategorySizeDatePackage
InstrumentationTestSuiteBuilderTest.javaAPI DocAndroid 1.5 API4028Wed May 06 22:42:02 BST 2009android.test.suitebuilder

InstrumentationTestSuiteBuilderTest

public class InstrumentationTestSuiteBuilderTest extends TestCase

Fields Summary
private InstrumentationTestSuiteBuilder
instrumentationTestSuiteBuilder
Constructors Summary
Methods Summary
private static java.lang.StringpackageFor(java.lang.Class clazz)

        String className = clazz.getName();
        return className.substring(0, className.lastIndexOf('."));
    
private android.test.suitebuilder.InstrumentationTestSuiteBuilderTest$SuiteExecutionRecorderrunSuite(TestSuiteBuilder builder)

        TestSuite suite = builder.build();
        SuiteExecutionRecorder recorder = new SuiteExecutionRecorder();
        TestResult result = new TestResult();
        result.addListener(recorder);
        suite.run(result);
        return recorder;
    
protected voidsetUp()

        super.setUp();
        instrumentationTestSuiteBuilder = new InstrumentationTestSuiteBuilder(getClass());
    
public voidtestShouldIncludeIntrumentationTests()

        instrumentationTestSuiteBuilder.includePackages(packageFor(InstrumentationTest.class));

        SuiteExecutionRecorder recorder = runSuite(instrumentationTestSuiteBuilder);

        assertEquals(1, recorder.testsSeen.size());
        assertTrue(recorder.saw("InstrumentationTest.testInstrumentation"));
    
public voidtestShouldOnlyIncludeIntrumentationTests()

        TestSuite testSuite = new OuterTest()
                .buildTestsUnderHereWith(instrumentationTestSuiteBuilder);
        List<String> testCaseNames = getTestCaseNames(testSuite);
        assertEquals(1, testCaseNames.size());
        assertEquals("testInstrumentation", testCaseNames.get(0));