Android TestFailure - 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 TestFailure class.

This code example shows how to use the following methods:failedTest
        } 
    } 
 
    protected void printDefectHeader(TestFailure failure, int count) {
        getWriter().println(count + ") " +
                            failure.failedTest().getClass().getName() + ":");
    } 
 
    public void printVersionInfo() { 
        if (printedVersion) {
            return; 
        } 
        else { 
            printedVersion = true;
        } 
 
        PrintStream writer = getWriter();
 
        Version.printInfo(writer);
 
6
CodeRank
This code example shows how to use the following methods:thrownException
    } 
 
    public void setCurrentError(TestFailure value) {
        currentError = value;
        if(currentError != null) {
            exception = currentError.thrownException();
            //AK: doesn't compile 
            // error = new WOExceptionParser(exception); 
            // error = WOExceptionParser.parseException(exception); 
         } 
    } 
 
    /** logging support */ 
    public static final Logger log = Logger.getLogger(ERXWOTestResult.class); 
 
    public String errorMessage;
    public ERXTestResult testResult;
    public TestFailure currentError;
    public int currentErrorIndex;
    public long runTime;
6
CodeRank
This code example shows how to use the following methods:failedTest
    } 
 
    protected void printDefectHeader(TestFailure booBoo, int count) {
        // I feel like making this a println, then adding a line giving the throwable a chance to print something 
        // before we get to the stack trace. 
        getWriter().print(count + ") " + booBoo.failedTest());
    } 
 
    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();
6
CodeRank
This code example shows how to use the following methods:exceptionMessage
         
        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 ) );
        } 
         
        result.endTest( this );
    } 
5
CodeRank
This code example shows how to use the following methods:failedTest
	} 
 
	protected void printDefectHeader(TestFailure booBoo, int count) {
		// I feel like making this a println, then adding a line giving the throwable a chance to print something 
		// before we get to the stack trace. 
		getWriter().print(count + ") " + booBoo.failedTest());
	} 
 
	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();
5
CodeRank
This code example shows how to use the following methods:exceptionMessage, failedTest, isFailure
			JList list, Object value, int modelIndex, 
			boolean isSelected, boolean cellHasFocus) {
	 
		    Component c= super.getListCellRendererComponent(list, value, modelIndex, isSelected, cellHasFocus);
			TestFailure failure= (TestFailure)value;
			String text= failure.failedTest().toString();
			String msg= failure.exceptionMessage();
			if (msg != null) 
				text+= ":" + BaseTestRunner.truncate(msg); 
	  
			if (failure.isFailure()) { 
				if (fFailureIcon != null)
		    		setIcon(fFailureIcon);
			} else { 
		    	if (fErrorIcon != null)
		    		setIcon(fErrorIcon);
		    } 
			setText(text);
			setToolTipText(text);
			return c;
5
CodeRank
This code example shows how to use the following methods:failedTest
    } 
 
    protected void printDefectHeader(TestFailure booBoo, int count) {
        // I feel like making this a println, then adding a line giving the throwable a chance to print something 
        // before we get to the stack trace. 
        getWriter().print(count + ") " + booBoo.failedTest());
    } 
 
    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();
5
CodeRank
This code example shows how to use the following methods:failedTest
		if (index == -1)
			return null; 
			 
		ListModel model= fFailureList.getModel();
		TestFailure failure= (TestFailure)model.getElementAt(index);
		return failure.failedTest();
	} 
	 
	public void activate() { 
		testSelected(); 
	} 
	 
	public void addTab(JTabbedPane pane) {
		JScrollPane scrollPane= new JScrollPane(fFailureList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
		Icon errorIcon= TestRunner.getIconResource(getClass(), "icons/error.gif");
		pane.addTab("Failures", errorIcon, scrollPane, "The list of failed tests");
	} 
		 
	public void revealFailure(Test failure) {
		fFailureList.setSelectedIndex(0);
5
CodeRank
This code example shows how to use the following methods:failedTest
		if (index == -1)
			return null; 
			 
		ListModel model= fFailureList.getModel();
		TestFailure failure= (TestFailure)model.getElementAt(index);
		return failure.failedTest();
	} 
	 
	public void activate() { 
		testSelected(); 
	} 
	 
	public void addTab(JTabbedPane pane) {
		JScrollPane scrollPane= new JScrollPane(fFailureList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
		Icon errorIcon= TestRunner.getIconResource(getClass(), "icons/error.gif");
		pane.addTab("Failures", errorIcon, scrollPane, "The list of failed tests");
	} 
		 
	public void revealFailure(Test failure) {
		fFailureList.setSelectedIndex(0);
5
CodeRank
This code example shows how to use the following methods:failedTest
     * @param count the count 
     */ 
    protected void printDefectHeader(TestFailure booBoo, int count) {
        // I feel like making this a println, then adding a line giving the throwable a chance to print something 
        // before we get to the stack trace. 
        getWriter().print(count + ") " + booBoo.failedTest());
    } 
 
    /** 
     * Prints the stack trace. 
     * @param booBoo the failure 
     */ 
    protected void printDefectTrace(TestFailure booBoo) {
        getWriter().print(BaseTestRunner.getFilteredTrace(booBoo.trace()));
    } 
 
    /** 
     * Prints the footer. 
     * @param result the test result. 
     */ 
4
CodeRank
See Code Examples for Android TestFailure Methods: