예제 #1
0
 @Override
 public void assertIsSatisfied(ResultSummary rs, FailFastException ffe) {
   if (rs.getFailureCount() + rs.getExceptionCount() == 0) {
     throw new ConcordionAssertionError(
         "Specification is expected to fail but has neither failures nor exceptions.", rs);
   }
 }
예제 #2
0
 @Override
 public ResultSummary convertForCache(ResultSummary rs) {
   try {
     assertIsSatisfied(rs, null);
     return new SingleResultSummary(Result.IGNORED, rs.getSpecificationDescription());
   } catch (ConcordionAssertionError cce) {
     return new SingleResultSummary(Result.FAILURE, rs.getSpecificationDescription());
   }
 }
예제 #3
0
 private void printResultSummary(
     Object fixture, ResultSummary resultSummary, String additionalInformation) {
   synchronized (System.out) {
     if (additionalInformation != null) {
       System.out.print(additionalInformation);
     }
     resultSummary.print(System.out, fixture);
     resultSummary.assertIsSatisfied(fixture);
   }
 }
 @Ignore
 @Test
 public void run() throws Exception {
   ResultSummary resultSummary =
       new ConcordionBuilder()
           .build()
           .process(
               new Resource(
                   "/specification/notification/subscription/forum/ForumSubscriptionScenariosNewEntry.html"),
               this);
   resultSummary.print(System.out, this);
   resultSummary.assertIsSatisfied(this);
 }
 @Test
 public void runScenario() throws Throwable {
   BasicConfigurator.configure();
   LogManager.getRootLogger().setLevel(Level.INFO);
   try {
     final Concordion concordion = createConcordion();
     final ResultSummary resultSummary = concordion.process(this);
     resultSummary.print(System.out, this);
     resultSummary.assertIsSatisfied(this);
   } finally {
     copyCustomCssIfDefined();
   }
 }
예제 #6
0
 @Override
 public void assertIsSatisfied(ResultSummary rs, FailFastException ffe) {
   if (ffe != null) {
     throw ffe;
   }
   if (rs.getFailureCount() > 0) {
     throw new ConcordionAssertionError(
         "Specification has failure(s). See output HTML for details.", rs);
   }
   if (rs.getExceptionCount() > 0) {
     throw new ConcordionAssertionError(
         "Specification has exception(s). See output HTML for details.", rs);
   }
 }
예제 #7
0
 @Override
 public void assertIsSatisfied(ResultSummary rs, FailFastException ffe) {
   List<String> list = new ArrayList<String>();
   addToList(list, rs.getSuccessCount(), "a success", "some successes");
   addToList(list, rs.getFailureCount(), "a failure", "some failures");
   addToList(list, rs.getExceptionCount(), "an exception", "some exceptions");
   if (list.size() > 0) {
     String s = list.get(0);
     if (list.size() > 1) {
       for (int i = 1; i < (list.size() - 1); i++) {
         s += ", " + list.get(i);
       }
       s += ", and " + list.get(list.size() - 1);
     }
     throw new ConcordionAssertionError(
         "Specification is supposed to be unimplemented, but is reporting " + s + ".", rs);
   }
 }
예제 #8
0
  public ResultSummary run(Object fixture) throws IOException {

    ConcordionRunOutput runOutput = cachedRunResults.startRun(fixture.getClass());
    ResultSummary actualResultSummary =
        runOutput == null ? null : runOutput.getActualResultSummary();

    ResultSummary postProcessedResultSummary =
        runOutput == null ? null : runOutput.getPostProcessedResultSummary();

    String additionalInformation = null;
    if (runOutput == null) {
      ConcordionBuilder concordionBuilder = new ConcordionBuilder().withFixture(fixture);
      fixtureExtensionLoader.addExtensions(fixture, concordionBuilder);

      try {
        actualResultSummary = concordionBuilder.build().process(fixture);
        // we want to make sure all the annotations are considered when storing the result summary

        postProcessedResultSummary =
            cachedRunResults.convertForCache(actualResultSummary, fixture.getClass());

        cachedRunResults.finishRun(
            fixture.getClass(), actualResultSummary, postProcessedResultSummary);

      } catch (RuntimeException e) {
        // the run failed miserably. Tell the cache that the run failed
        cachedRunResults.failRun(fixture.getClass());
        throw e;
      }

    } else {
      additionalInformation = "From cache: ";
    }

    printResultSummary(fixture, actualResultSummary, additionalInformation);

    return actualResultSummary.getMeaningfulResultSummary(fixture);
  }
예제 #9
0
 public long getExceptionCount() {
   return resultSummary.getExceptionCount();
 }
예제 #10
0
 public long getFailureCount() {
   return resultSummary.getFailureCount();
 }
예제 #11
0
 public long getSuccessCount() {
   return resultSummary.getSuccessCount();
 }