private void addMultipleFailureException(MultipleFailureException mfe) { for (Throwable each : mfe.getFailures()) { addFailure(each); } }
private void addMultipleFailureException(MultipleFailureException mfe) { for (Throwable each : mfe.getFailures()) { addFailure(each); } }
private void retry(final Description description, final EachTestNotifier notifier, final Statement statement, final Throwable currentThrowable) { Throwable caughtThrowable = currentThrowable; while (retryCount > failedAttempts) { try { System.out.println(description + " Caught: " + (currentThrowable == null ? "exception" : currentThrowable.getMessage()) + ". Retrying test " + failedAttempts + "/" + retryCount); statement.evaluate(); return; } catch (Throwable t) { failedAttempts++; caughtThrowable = t; } } notifier.addFailure(caughtThrowable); } }
@Override public void run(final RunNotifier notifier) { EachTestNotifier testNotifier = new EachTestNotifier(notifier, getDescription()); try { Statement statement = classBlock(notifier); statement.evaluate(); } catch (AssumptionViolatedException e) { testNotifier.fireTestIgnored(); } catch (StoppedByUserException e) { throw e; } catch (Throwable e) { testNotifier.addFailure(e); } }
/** * Runs a {@link Statement} that represents a leaf (aka atomic) test. */ protected final void runLeaf(Statement statement, Description description, RunNotifier notifier) { EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description); eachNotifier.fireTestStarted(); try { statement.evaluate(); } catch (AssumptionViolatedException e) { eachNotifier.addFailedAssumption(e); } catch (Throwable e) { eachNotifier.addFailure(e); } finally { eachNotifier.fireTestFinished(); } }
/** * Runs a {@link Statement} that represents a leaf (aka atomic) test. */ protected final void runLeaf(Statement statement, Description description, RunNotifier notifier) { EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description); eachNotifier.fireTestStarted(); try { statement.evaluate(); } catch (AssumptionViolatedException e) { eachNotifier.addFailedAssumption(e); } catch (Throwable e) { eachNotifier.addFailure(e); } finally { eachNotifier.fireTestFinished(); } }
@Override public void run(final RunNotifier notifier) { EachTestNotifier testNotifier = new EachTestNotifier(notifier, getDescription()); testNotifier.fireTestSuiteStarted(); try { Statement statement = classBlock(notifier); statement.evaluate(); } catch (AssumptionViolatedException e) { testNotifier.addFailedAssumption(e); } catch (StoppedByUserException e) { throw e; } catch (Throwable e) { testNotifier.addFailure(e); } finally { testNotifier.fireTestSuiteFinished(); } }
@Override protected void runChild(JSONObject child, RunNotifier notifier) { EachTestNotifier eachNotifier = new EachTestNotifier(notifier, describeChild(child)); eachNotifier.fireTestStarted(); try { new TestCaseRunner(child).run(); eachNotifier.fireTestFinished(); } catch (Exception | AssertionError e) { eachNotifier.addFailure(e); } }
private void addMultipleFailureException(MultipleFailureException mfe) { for (Throwable each : mfe.getFailures()) { addFailure(each); } }
@Override public void run(final RunNotifier notifier) { EachTestNotifier testNotifier = new EachTestNotifier(notifier, getDescription()); try { Statement statement = classBlock(notifier); statement.evaluate(); } catch (AssumptionViolatedException e) { testNotifier.fireTestIgnored(); } catch (StoppedByUserException e) { throw e; } catch (Throwable e) { testNotifier.addFailure(e); } }
/** * Runs a {@link Statement} that represents a leaf (aka atomic) test. */ protected final void runLeaf(Statement statement, Description description, RunNotifier notifier) { EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description); eachNotifier.fireTestStarted(); try { statement.evaluate(); } catch (AssumptionViolatedException e) { eachNotifier.addFailedAssumption(e); } catch (Throwable e) { eachNotifier.addFailure(e); } finally { eachNotifier.fireTestFinished(); } }
@Override public void runChild(final FrameworkMethod method, final RunNotifier notifier) { final Description description = describeChild(method); if (this.isIgnored(method)) { notifier.fireTestIgnored(description); } else { final EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description); eachNotifier.fireTestStarted(); boolean ignored = false; try { this.methodBlock(method).evaluate(); } catch (AssumptionViolatedException ave) { eachNotifier.addFailedAssumption(ave); } catch (Throwable e) { if (validateForGraphComputer(e)) { eachNotifier.fireTestIgnored(); logger.info(e.getMessage()); ignored = true; } else eachNotifier.addFailure(e); } finally { if (!ignored) eachNotifier.fireTestFinished(); } } }
@Override public void run(RunNotifier notifier) { registerRunNotifierListener(notifier); Description description = getDescription(); enableRateRunner = isRateRunnerEnabled(); EachTestNotifier testNotifier = new EachTestNotifier(notifier, description); try { Statement statement = classBlock(notifier); statement.evaluate(); } catch (AssumptionViolatedException e) { testNotifier.fireTestIgnored(); } catch (StoppedByUserException e) { throw e; } catch (Throwable e) { testNotifier.addFailure(e); } }
/** * Clients may override this method to add additional behavior when a {@link Throwable} is raised. * * @param notifier the notifier * @param e the error */ protected void whenThrowableIsRaised(final EachTestNotifier notifier, final Throwable e) { notifier.addFailure(e); }
private void addMultipleFailureException(MultipleFailureException mfe) { for (Throwable each : mfe.getFailures()) { addFailure(each); } }
private void addFailure(Result result) { Throwable error = result.getError(); if (error == null) { error = new PendingException(); } failedStep = true; stepNotifier.addFailure(error); executionUnitNotifier.addFailure(error); }
private void addMultipleFailureException(MultipleFailureException mfe) { for (Throwable each : mfe.getFailures()) { addFailure(each); } }
private void handleHook(Result result) { if (result.getStatus().equals(Result.FAILED) || (strict && isPending(result.getError()))) { executionUnitNotifier.addFailure(result.getError()); } else if (isPending(result.getError())) { ignoredStep = true; } }
private void handleHook(Result result) { if (result.getStatus().equals(Result.FAILED) || (strict && isPending(result.getError()))) { executionUnitNotifier.addFailure(result.getError()); } else if (isPending(result.getError())) { ignoredStep = true; } }
@Override public void run(RunNotifier notifier) { Description childDescription = Description.createTestDescription(getClass(), "Test"); desc.addChild(childDescription); EachTestNotifier singleNotifier = new EachTestNotifier(notifier, childDescription); singleNotifier.addFailedAssumption(new AssumptionViolatedException("Test 2")); singleNotifier.addFailedAssumption(new AssumptionViolatedException("Test 1")); singleNotifier.addFailure(new IllegalArgumentException("Test")); } };