Exemple #1
0
  /**
   * Process MakeAttachmentEvent. Attachment will be written to results directory, and information
   * about it stored to current step.
   *
   * @param event to process
   */
  public void fire(MakeAttachmentEvent event) {
    Step step = stepStorage.getLast();
    Attachment attachment =
        resultsHelper.writeAttachmentSafely(
            event.getAttachment(), event.getTitle(), event.getType());
    step.getAttachments().add(attachment);
    event.process(step);

    notifier.fire(event);
  }
Exemple #2
0
  /**
   * Process TestCaseFinishedEvent. Add steps and attachments from top step from stepStorage to
   * current testCase, then remove testCase and step from stores. Also remove attachments matches
   * removeAttachments config.
   *
   * @param event to process
   */
  public void fire(TestCaseFinishedEvent event) {
    TestCaseResult testCase = testCaseStorage.get();
    event.process(testCase);

    Step root = stepStorage.pollLast();

    if (Status.PASSED.equals(testCase.getStatus())) {
      new RemoveAttachmentsEvent(config.getRemoveAttachmentsPattern()).process(root);
    }

    testCase.getSteps().addAll(root.getSteps());
    testCase.getAttachments().addAll(root.getAttachments());

    stepStorage.remove();
    testCaseStorage.remove();

    notifier.fire(event);
  }