示例#1
0
  /**
   * Process StepStartedEvent. New step will be created and added to stepStorage.
   *
   * @param event to process
   */
  public void fire(StepStartedEvent event) {
    Step step = new Step();
    event.process(step);
    stepStorage.put(step);

    notifier.fire(event);
  }
示例#2
0
  /**
   * Process RemoveAttachmentsEvent. Remove
   *
   * @param event to process
   */
  public void fire(RemoveAttachmentsEvent event) {
    Step step = stepStorage.getLast();
    resultsHelper.deleteAttachments(step, event.getPattern());

    event.process(step);
    notifier.fire(event);
  }
示例#3
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);
  }
示例#4
0
  /**
   * Process TestCaseStartedEvent. New testCase will be created and added to suite as child.
   *
   * @param event to process
   */
  public void fire(TestCaseStartedEvent event) {
    // init root step in parent thread if needed
    stepStorage.get();

    TestCaseResult testCase = testCaseStorage.get();
    event.process(testCase);

    synchronized (TEST_SUITE_ADD_CHILD_LOCK) {
      testSuiteStorage.get(event.getSuiteUid()).getTestCases().add(testCase);
    }

    notifier.fire(event);
  }
示例#5
0
  /**
   * Process TestSuiteFinishedEvent. Using event.getUid() to access testSuite. Then remove this
   * suite from storage and marshal testSuite to xml using AllureResultsUtils.writeTestSuiteResult()
   *
   * @param event to process
   */
  public void fire(TestSuiteFinishedEvent event) {
    String suiteUid = event.getUid();

    TestSuiteResult testSuite = testSuiteStorage.remove(suiteUid);
    if (testSuite == null) {
      return;
    }
    event.process(testSuite);

    testSuite.setVersion(getVersion());
    testSuite.getLabels().add(AllureUtils.createProgrammingLanguageLabel());

    resultsHelper.writeTestSuite(testSuite);

    notifier.fire(event);
  }
示例#6
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);
  }
示例#7
0
 /**
  * Experimental. Can be removed in next releases.
  *
  * <p>Add specified listener to notifier.
  *
  * @param listener to add
  * @see ru.yandex.qatools.allure.experimental.LifecycleListener
  * @since 1.4.0
  */
 public void addListener(LifecycleListener listener) {
   notifier.addListener(listener);
 }
示例#8
0
  /**
   * This method just clear current testCase context.
   *
   * @param event will be ignored
   */
  @SuppressWarnings("unused")
  public void fire(ClearTestStorageEvent event) {
    testCaseStorage.remove();

    notifier.fire(event);
  }
示例#9
0
  /**
   * This method just clear current step context.
   *
   * @param event will be ignored
   */
  @SuppressWarnings("unused")
  public void fire(ClearStepStorageEvent event) {
    stepStorage.remove();

    notifier.fire(event);
  }
示例#10
0
  /**
   * Process TestSuiteEvent. You can use this method to change current testSuite context. Using
   * event.getUid() to access testSuite.
   *
   * @param event to process
   */
  public void fire(TestSuiteEvent event) {
    TestSuiteResult testSuite = testSuiteStorage.get(event.getUid());
    event.process(testSuite);

    notifier.fire(event);
  }
示例#11
0
  /**
   * Process TestCaseEvent. You can change current testCase context using this method.
   *
   * @param event to process
   */
  public void fire(TestCaseEvent event) {
    TestCaseResult testCase = testCaseStorage.get();
    event.process(testCase);

    notifier.fire(event);
  }
示例#12
0
  /**
   * Process StepFinishedEvent. Change last added to stepStorage step and add it as child of
   * previous step.
   *
   * @param event to process
   */
  public void fire(StepFinishedEvent event) {
    Step step = stepStorage.adopt();
    event.process(step);

    notifier.fire(event);
  }
示例#13
0
  /**
   * Process any StepEvent. You can change last added to stepStorage step using this method.
   *
   * @param event to process
   */
  public void fire(StepEvent event) {
    Step step = stepStorage.getLast();
    event.process(step);

    notifier.fire(event);
  }