Android TestResult - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android TestResult class.

This code example shows how to use the following methods: errorCount, failureCount, runCount, wasSuccessful
    protected void printDefectTrace(TestFailure booBoo) {
        getWriter().print(BaseTestRunner.getFilteredTrace(booBoo.trace()));
    } 
 
    protected void printFooter(TestResult result) {
        if (result.wasSuccessful()) {
            getWriter().println();
            getWriter().print("OK");
            getWriter().println (" (" + result.runCount() + " test" + (result.runCount() == 1 ? "": "s") + ")");
 
        } else { 
            getWriter().println();
            getWriter().println("FAILURES!!!");
            getWriter().println("Tests run: "+result.runCount()+
                    ",  Failures: "+result.failureCount()+
                    ",  Errors: "+result.errorCount());
        } 
        getWriter().println();
    } 
 
 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addListener
 
    /** 
     * Creates the TestResult to be used for the test run. 
     */ 
    protected TestResult createTestResult() {
        return new TestResult();
    } 
 
    public TestResult doRun(Test test) {
        return doRun(test, false);
    } 
 
    public TestResult doRun(Test suite, boolean wait) {
        TestResult result= createTestResult();
        result.addListener(fPrinter);
        long startTime= System.currentTimeMillis();
        suite.run(result);
        long endTime= System.currentTimeMillis();
        long runTime= endTime-startTime;
        fPrinter.print(result, runTime);

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: errorCount, errors, failureCount, failures
     * 
     */ 
    public AllTests() { 
         
        TestFailure error;     
        TestResult results = new TestResult();
         
        // Execute the Tests 
        suite().run(results);
         
        // Print the run statistics 
        printHeader("Test Results", true); 
        System.out.println("Errors:     " + results.errorCount());        
        System.out.println("Failures:   " + results.failureCount());
        System.out.println("");
         
        // Print out errors 
        if (results.errorCount() > 0) {
            printHeader("Errors", false); 
            for (Enumeration errors = results.errors() ; errors.hasMoreElements() ;) {

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: errorCount, failureCount, runCount, wasSuccessful
	protected void printDefectTrace(TestFailure booBoo) {
		getWriter().print(BaseTestRunner.getFilteredTrace(booBoo.trace()));
	} 
 
	protected void printFooter(TestResult result) {
		if (result.wasSuccessful()) {
			getWriter().println();
			getWriter().print("OK");
			getWriter().println (" (" + result.runCount() + " test" + (result.runCount() == 1 ? "": "s") + ")");
 
		} else { 
			getWriter().println();
			getWriter().println("FAILURES!!!");
			getWriter().println("Tests run: "+result.runCount()+ 
				         ",  Failures: "+result.failureCount()+
				         ",  Errors: "+result.errorCount());
		} 
	    getWriter().println();
	} 
 
 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addListener
        try { 
            TestResult r = aTestRunner.start(args);
            if (!r.wasSuccessful())
                System.exit(FAILURE_EXIT);
            System.exit(SUCCESS_EXIT);
        } catch(Exception e) {
            System.err.println(e.getMessage());
            System.exit(EXCEPTION_EXIT);
        } 
    } 
 
    private static void printUsage() { 
        System.out.println("Usage: DeviceTestRunner <test_class> [-s device_serial] " +
                "[-p test_data_path]"); 
    } 
 
    /** 
     * Override parent to set DeviceTest data 
     */ 
    @Override 

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: errorCount, failureCount
     * @see junit.framework.Test#run(junit.framework.TestResult) 
     */ 
    public void run( TestResult result ) {
        result.startTest( this );
         
        TestResult r = new TestResult();
        test.run( r );
        if (r.failureCount() == 1) {
        	TestFailure failure= r.failures().nextElement();
        	String msg= failure.exceptionMessage();
        	if (msg != null && msg.startsWith("Method \"" + test.getName() + "\"")) {
        		result.addFailure(this, new AssertionFailedError(msg));
        	} 
        } 
        else if( r.errorCount() == 0 && r.failureCount() == 0 )
        { 
            String err = "Unexpected success"; //$NON-NLS-1$
            if( bugNum != -1 )
                err += ", bug #" + bugNum; //$NON-NLS-1$
            result.addFailure( this, new AssertionFailedError( err ) );
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: errorCount, failureCount
                    tearDown(); 
                } 
            } 
             
            private boolean hasErrorsOrFailures() { 
                return result.errorCount() > 0 || result.failureCount() > 0;
            } 
             
            @Override 
            public void run(TestResult result) {
                this.result = result;
                super.run(result);
            } 
 
            @Override 
            protected void runTest() { 
                runBehavior(behavior, this, result);
            } 
        }); 
    } 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: failureCount, failures, wasSuccessful
		InputStream inputStream = file.toURI().toURL().openStream();
		InputSource inputSource = new InputSource(inputStream);
        GeometryTestContainer container = parser.parseTestDefinition(inputSource);
        container.checkTestOverrides(name, excludes);                      
         
        TestResult tempResult = new TestResult();
        container.runAllTestCases( tempResult );
 
        // TODO: grab the error and print 
        assertTrue( "failures: "+tempResult.failureCount(), tempResult.wasSuccessful() ); 
        Enumeration enums = tempResult.failures();
        while (enums.hasMoreElements()) {
        	System.out.println("what");
        	AssertionFailedError failure = (AssertionFailedError) enums.nextElement();
        	assertTrue("--"+failure.toString(), tempResult.wasSuccessful());
        } 
	} 
 
    private static Properties findExclusions(File xmlFile) {
        try { 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: errorCount, errors, failureCount, failures
This code example shows how to use the following methods: errorCount, failureCount, runCount, wasSuccessful
    protected void printDefectTrace(TestFailure booBoo) {
        getWriter().print(BaseTestRunner.getFilteredTrace(booBoo.trace()));
    } 
 
    protected void printFooter(TestResult result) {
        if (result.wasSuccessful()) {
            getWriter().println();
            getWriter().print("OK");
            getWriter().println (" (" + result.runCount() + " test" + (result.runCount() == 1 ? "": "s") + ")");
 
        } else { 
            getWriter().println();
            getWriter().println("FAILURES!!!");
            getWriter().println("Tests run: "+result.runCount()+
                         ",  Failures: "+result.failureCount()+
                         ",  Errors: "+result.errorCount());
        } 
        getWriter().println();
    } 
 
 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android TestResult Questions & Answers:

See Code Examples for Android TestResult Methods: