@Test
  public void invalidCharacterTest() throws Exception {
    TestSuiteResult testSuiteResult = new TestSuiteResult().withName("somename");

    String titleWithInvalidXmlCharacter = String.valueOf(Character.toChars(0x0));
    testSuiteResult.setTitle(titleWithInvalidXmlCharacter);

    AllureResultsUtils.writeTestSuiteResult(testSuiteResult);

    Validator validator = AllureModelUtils.getAllureSchemaValidator();

    for (File each : listTestSuiteFiles(resultsDirectory)) {
      validator.validate(new StreamSource(each));
    }
  }
Esempio n. 2
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);
  }