/** * @return a user-understandable label for the test */ public String getTestHeader() { return fDescription.getDisplayName(); }
@Override public String toString() { return getDisplayName(); }
/** * @return a user-understandable label for the test */ public String getTestHeader() { return fDescription.getDisplayName(); }
@Override public String toString() { return getDisplayName(); }
public int compare(Description o1, Description o2) { return o1.getDisplayName().compareTo(o2.getDisplayName()); } };
@Override public String getTestId() { return description.getDisplayName(); }
@Override public String describe() { return String.format("Method %s", desiredDescription.getDisplayName()); } };
@Override public String describe() { return String.format("Method %s", desiredDescription.getDisplayName()); } };
@Override public void testRunStarted(Description description) { System.err.println("Installing aggressive uncaught exception handler"); oldDefaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler(); Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> { StringWriter errorText = new StringWriter(256); errorText.append("Uncaught exception in OkHttp thread \""); errorText.append(thread.getName()); errorText.append("\"\n"); throwable.printStackTrace(new PrintWriter(errorText)); errorText.append("\n"); if (lastTestStarted != null) { errorText.append("Last test to start was: "); errorText.append(lastTestStarted.getDisplayName()); errorText.append("\n"); } System.err.print(errorText.toString()); synchronized (exceptions) { exceptions.put(throwable, lastTestStarted.getDisplayName()); } }); }
public JUnit4SpockMethod(Description description) { super((Method)null); this.declaringClass = description.getTestClass(); this.description = description.getDisplayName(); }
private RepeatStatement( int times, Statement statement, Description testDescription ) { this.times = times; this.statement = statement; this.testName = testDescription.getDisplayName(); }
@Override public void testIgnored(Description description) throws Exception { ignored.add(description.getDisplayName()); } }
@Override public void testRunStarted(Description description) { if (description != null) { System.out.println("testRunStarted " + String.valueOf(description.getClassName()) + " " + String.valueOf(description.getDisplayName()) + " " + String.valueOf(description.toString())); } }
@Override public void testStarted(Description description) throws Exception { started.add(description.getDisplayName()); }
@Override public void testFinished(Description description) throws Exception { finished.add(description.getDisplayName()); }
@Override public void evaluate() throws Throwable { Throwable caughtThrowable = null; for (int i = 0; i < retryCount; i++) { try { base.evaluate(); return; } catch (Throwable t) { caughtThrowable = t; System.err.println(description.getDisplayName() + ": run " + (i + 1) + " failed"); int n = sleep; if (backoff && i != 0) { n = n * (2 << i); } Thread.sleep(n); } } System.err.println(description.getDisplayName() + ": giving up after " + retryCount + " failures"); throw caughtThrowable; } }
Test createTest(Description description) { if (description.isTest()) { return new JUnit4TestCaseFacade(description); } else { TestSuite suite = new TestSuite(description.getDisplayName()); for (Description child : description.getChildren()) { suite.addTest(asTest(child)); } return suite; } }
Test createTest(Description description) { if (description.isTest()) { return new JUnit4TestCaseFacade(description); } else { TestSuite suite = new TestSuite(description.getDisplayName()); for (Description child : description.getChildren()) { suite.addTest(asTest(child)); } return suite; } }
@Override public Statement apply( Statement base, Description description ) { testName = description.getDisplayName(); logger = Logger.getLogger( description.getTestClass().getName() ); logger.setLevel( level ); return super.apply( base, description ); }
private void printThreadDump() { System.err.println( String.format( "=== Test %s timed out, dumping more information ===", currentTestDescription.getDisplayName() ) ); if ( !additionalParameters.isEmpty() ) { System.err.println( "=== Requested additional parameters: ===" ); for ( VerboseTimeoutBuilder.FailureParameter<?> additionalParameter : additionalParameters ) { System.err.println( additionalParameter.describe() ); } } System.err.println( "=== Thread dump ===" ); System.err.println( DumpUtils.threadDump() ); } }