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

UnitTestSuiteBuilderTest

public class UnitTestSuiteBuilderTest extends TestCase

Fields Summary
private UnitTestSuiteBuilder
unitTestSuiteBuilder
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.UnitTestSuiteBuilderTest$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();
        unitTestSuiteBuilder = new UnitTestSuiteBuilder(getClass());
    
public voidtestShouldExcludeIntrumentationTests()

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

        TestSuite testSuite = unitTestSuiteBuilder.build();
        Assert.assertEquals(0, ListTestCaseNames.getTestCaseNames(testSuite).size());

        SuiteExecutionRecorder recorder = runSuite(unitTestSuiteBuilder);

        assertFalse(recorder.saw("InstrumentationTest.testInstrumentation"));
        assertTrue(recorder.testsSeen.isEmpty());