Examples of EachTestNotifier


Examples of org.junit.internal.runners.model.EachTestNotifier

            maybeExecuteTests();
        } catch(Exception e) {
            throw new Error(e);
        }
       
        EachTestNotifier eachNotifier= new EachTestNotifier(notifier, t.describe());
        eachNotifier.fireTestStarted();
        try {
            log.debug("Running test {}", t.describe());
            t.run();
        } catch (AssumptionViolatedException e) {
            eachNotifier.addFailedAssumption(e);
        } catch (Throwable e) {
            eachNotifier.addFailure(e);
        } finally {
            eachNotifier.fireTestFinished();
        }
    }
View Full Code Here

Examples of org.junit.internal.runners.model.EachTestNotifier

    public void run( RunNotifier notifier ) {
         for(Scenario scenario : scenarios) {
             Description childDescription = Description.createTestDescription(getClass(),
                    scenario.getName());
             descr.addChild(childDescription);
            EachTestNotifier eachNotifier = new EachTestNotifier( notifier, childDescription );
            try {
                eachNotifier.fireTestStarted();
                ScenarioRunner runner = new ScenarioRunner( ksession );
                runner.run( scenario );
                if ( !scenario.wasSuccessful() ) {
                    StringBuilder builder = new StringBuilder();
                    for ( String message : scenario.getFailureMessages() ) {
                        builder.append( message ).append( "\n" );
                    }
                    eachNotifier.addFailedAssumption( new AssumptionViolatedException( builder.toString() ) );
                }
            } catch ( Throwable t ) {
                eachNotifier.addFailure( t );
            } finally {
                // has to always be called as per junit docs
                eachNotifier.fireTestFinished();
            }       
      }
    }
View Full Code Here

Examples of org.junit.internal.runners.model.EachTestNotifier

    public void run( RunNotifier notifier ) {
        for ( Scenario scenario : scenarios ) {
            Description childDescription = Description.createTestDescription( getClass(),
                                                                              scenario.getName() );
            descr.addChild( childDescription );
            EachTestNotifier eachNotifier = new EachTestNotifier( notifier,
                                                                  childDescription );
            try {
                eachNotifier.fireTestStarted();

                //If a KieSession is not available, fail fast
                if ( ksession == null ) {
                    throw new NullKieSessionException( "Unable to get a Session to run tests. Check the project for build errors." );

                } else {

                    final ScenarioRunner runner = new ScenarioRunner( ksession,
                                                                      maxRuleFirings );
                    runner.run( scenario );
                    if ( !scenario.wasSuccessful() ) {
                        StringBuilder builder = new StringBuilder();
                        for ( String message : scenario.getFailureMessages() ) {
                            builder.append( message ).append( "\n" );
                        }
                        eachNotifier.addFailedAssumption( new AssumptionViolatedException( builder.toString() ) );
                    }
                }
            } catch ( Throwable t ) {
                eachNotifier.addFailure( t );
            } finally {
                // has to always be called as per junit docs
                eachNotifier.fireTestFinished();
            }
        }
    }
View Full Code Here

Examples of org.junit.internal.runners.model.EachTestNotifier

    /**
     * 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();
        }
    }
View Full Code Here

Examples of org.junit.internal.runners.model.EachTestNotifier

        return description;
    }

    @Override
    public void run(final RunNotifier notifier) {
        EachTestNotifier testNotifier = new EachTestNotifier(notifier,
                getDescription());
        try {
            Statement statement = classBlock(notifier);
            statement.evaluate();
        } catch (AssumptionViolatedException e) {
            testNotifier.addFailedAssumption(e);
        } catch (StoppedByUserException e) {
            throw e;
        } catch (Throwable e) {
            testNotifier.addFailure(e);
        }
    }
View Full Code Here

Examples of org.junit.internal.runners.model.EachTestNotifier

  /**
   * 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();
    }
  }
View Full Code Here

Examples of org.junit.internal.runners.model.EachTestNotifier

    return description;
  }

  @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);
    }
  }
View Full Code Here

Examples of org.junit.internal.runners.model.EachTestNotifier

   * except that tests are determined to be <em>ignored</em> by
   * {@link #isTestMethodIgnored(FrameworkMethod)}.
   */
  @Override
  protected void runChild(FrameworkMethod frameworkMethod, RunNotifier notifier) {
    EachTestNotifier eachNotifier = springMakeNotifier(frameworkMethod, notifier);
    if (isTestMethodIgnored(frameworkMethod)) {
      eachNotifier.fireTestIgnored();
      return;
    }

    eachNotifier.fireTestStarted();
    try {
      methodBlock(frameworkMethod).evaluate();
    }
    catch (AssumptionViolatedException e) {
      eachNotifier.addFailedAssumption(e);
    }
    catch (Throwable e) {
      eachNotifier.addFailure(e);
    }
    finally {
      eachNotifier.fireTestFinished();
    }
  }
View Full Code Here

Examples of org.junit.internal.runners.model.EachTestNotifier

   * compatibility clashes that were introduced in JUnit between versions 4.5,
   * 4.6, and 4.7.
   */
  private EachTestNotifier springMakeNotifier(FrameworkMethod method, RunNotifier notifier) {
    Description description = describeChild(method);
    return new EachTestNotifier(notifier, description);
  }
View Full Code Here

Examples of org.junit.internal.runners.model.EachTestNotifier

   * except that tests are determined to be <em>ignored</em> by
   * {@link #isTestMethodIgnored(FrameworkMethod)}.
   */
  @Override
  protected void runChild(FrameworkMethod frameworkMethod, RunNotifier notifier) {
    EachTestNotifier eachNotifier = springMakeNotifier(frameworkMethod, notifier);
    if (isTestMethodIgnored(frameworkMethod)) {
      eachNotifier.fireTestIgnored();
      return;
    }

    eachNotifier.fireTestStarted();
    try {
      methodBlock(frameworkMethod).evaluate();
    }
    catch (AssumptionViolatedException e) {
      eachNotifier.addFailedAssumption(e);
    }
    catch (Throwable e) {
      eachNotifier.addFailure(e);
    }
    finally {
      eachNotifier.fireTestFinished();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.