本文整理汇总了Java中ru.yandex.qatools.allure.model.TestSuiteResult类的典型用法代码示例。如果您正苦于以下问题:Java TestSuiteResult类的具体用法?Java TestSuiteResult怎么用?Java TestSuiteResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestSuiteResult类属于ru.yandex.qatools.allure.model包,在下文中一共展示了TestSuiteResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fire
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
/**
* 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(AllureModelUtils.createProgrammingLanguageLabel());
writeTestSuiteResult(testSuite);
notifier.fire(event);
}
示例2: allureClearStorageTest
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
@Test
public void allureClearStorageTest() {
String suiteUid = UUID.randomUUID().toString();
TestSuiteResult testSuite = fireTestSuiteStart(suiteUid);
TestCaseResult testCase = fireTestCaseStart(suiteUid);
assertThat(testSuite.getTestCases(), hasSize(1));
assertEquals(testSuite.getTestCases().get(0), testCase);
Step parentStep = fireStepStart();
Step nestedStep = fireStepStart();
fireStepFinished();
assertThat(parentStep.getSteps(), hasSize(1));
assertTrue(parentStep.getSteps().get(0) == nestedStep);
fireStepFinished();
fireClearStepStorage();
assertThat(testCase.getSteps(), hasSize(0));
fireClearTestStorage();
TestCaseResult afterClearing = Allure.LIFECYCLE.getTestCaseStorage().get();
assertFalse(testCase == afterClearing);
checkTestCaseIsNew(afterClearing);
}
示例3: invalidCharacterTest
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
@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));
}
}
示例4: configure
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
@Override
protected void configure() {
bind(File[].class).annotatedWith(ResultDirectories.class).toInstance(inputDirectories);
bind(ClassLoader.class).annotatedWith(PluginClassLoader.class).toInstance(classLoader);
bind(new TypeLiteral<Reader<TestSuiteResult>>() {
}).to(TestSuiteReader.class);
bind(new TypeLiteral<Reader<TestCaseResult>>() {
}).to(TestCaseReader.class);
bind(new TypeLiteral<Reader<Environment>>() {
}).to(EnvironmentReader.class);
bind(new TypeLiteral<Reader<AttachmentInfo>>() {
}).to(AttachmentReader.class);
bind(PluginLoader.class).to(DefaultPluginLoader.class);
bind(AttachmentsIndex.class).to(DefaultAttachmentsIndex.class);
bind(TestCaseConverter.class).to(DefaultTestCaseConverter.class);
}
示例5: shouldNotLoseEventsFromTestWithTimeout
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
@Test
public void shouldNotLoseEventsFromTestWithTimeout() throws Exception {
TestSuiteResult result = JAXB.unmarshal(
listTestSuiteFiles(resultsDirectory).iterator().next(),
TestSuiteResult.class
);
assertThat(result.getTestCases(), not(empty()));
assertThat(
String.format(
"Result should contains title '%s'",
TestWithTimeoutAnnotation.NAME
),
result.getTestCases().iterator().next().getTitle(),
is(TestWithTimeoutAnnotation.NAME)
);
}
示例6: validateTestSuiteResult
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
private void validateTestSuiteResult(TestSuiteResult testSuiteResult) {
String brokenMethod = testSuiteResult.getName().replace(SUITE_PREFIX, "config");
for (TestCaseResult result : testSuiteResult.getTestCases()) {
String methodName = result.getName();
Status status = result.getStatus();
Status expectedStatus = Status.CANCELED;
if (brokenMethod.startsWith(methodName)) {
expectedStatus = Status.BROKEN;
}
if (brokenMethod.contains("After") && methodName.equalsIgnoreCase("test")) {
expectedStatus = Status.PASSED;
}
assertThat(String.format("Wrong status for test <%s>, method <%s>", brokenMethod, methodName),
status, equalTo(expectedStatus));
}
}
示例7: shouldUnmarshalSuiteFiles
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
@Test
public void shouldUnmarshalSuiteFiles() throws Exception {
TestSuiteResult first = new TestSuiteResult().withName("first");
TestSuiteResult second = new TestSuiteResult().withName("second");
File folder = this.folder.newFolder();
File firstFile = new File(folder, "first-testsuite.xml");
JAXB.marshal(first, firstFile);
File secondFile = new File(folder, "second-testsuite.xml");
JAXB.marshal(second, secondFile);
List<TestSuiteResult> suites = AllureFileUtils.unmarshalSuites(folder);
assertThat(suites, hasSize(2));
assertThat(suites, containsInAnyOrder(first, second));
}
示例8: xmlFiles
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
private Stream<TestSuiteResult> xmlFiles(final Path source) {
try {
return AllureUtils.listTestSuiteXmlFiles(source)
.stream()
.map(this::readXmlTestSuiteFile)
.filter(Optional::isPresent)
.map(Optional::get);
} catch (IOException e) {
LOGGER.error("Could not list allure1 xml files", e);
return Stream.empty();
}
}
示例9: jsonFiles
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
private Stream<TestSuiteResult> jsonFiles(final Path source) {
try {
return AllureUtils.listTestSuiteJsonFiles(source)
.stream()
.map(this::readJsonTestSuiteFile)
.filter(Optional::isPresent)
.map(Optional::get);
} catch (IOException e) {
LOGGER.error("Could not list allure1 json files", e);
return Stream.empty();
}
}
示例10: readXmlTestSuiteFile
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
private Optional<TestSuiteResult> readXmlTestSuiteFile(final Path source) {
try (InputStream is = Files.newInputStream(source)) {
return Optional.of(xmlMapper.readValue(is, TestSuiteResult.class));
} catch (IOException e) {
LOGGER.error("Could not read result {}: {}", source, e);
}
return Optional.empty();
}
示例11: readJsonTestSuiteFile
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
private Optional<TestSuiteResult> readJsonTestSuiteFile(final Path source) {
try (InputStream is = Files.newInputStream(source)) {
return Optional.of(jsonMapper.readValue(is, TestSuiteResult.class));
} catch (IOException e) {
LOGGER.error("Could not read result {}: {}", source, e);
return Optional.empty();
}
}
示例12: marshalTestSuite
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
/**
* Marshal {@link ru.yandex.qatools.allure.model.TestSuiteResult} to specified file
* uses {@link BadXmlCharactersFilterWriter}. Name of file generated uses
* {@link #generateTestSuiteXmlName()}
*
* @param testSuite to marshal
*/
public static void marshalTestSuite(TestSuiteResult testSuite, Path file) {
try (Writer writer = new BadXmlCharactersFilterWriter(file)) {
marshaller(TestSuiteResult.class).marshal(
new ObjectFactory().createTestSuite(testSuite),
writer
);
} catch (Exception e) {
LOGGER.error("Error during marshalling testSuite", e);
}
}
示例13: shouldMarshalTestSuite
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
@Test
public void shouldMarshalTestSuite() throws Exception {
Path outputDir = folder.newFolder().toPath();
TestSuiteResult result = randomTestSuiteResult();
String testSuiteXmlName = generateTestSuiteXmlName();
marshalTestSuite(result, outputDir.resolve(testSuiteXmlName));
assertThat(outputDir, contains(testSuiteXmlName));
}
示例14: shouldValidateTestSuite
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
@Test
public void shouldValidateTestSuite() throws Exception {
Path outputDir = folder.newFolder().toPath();
TestSuiteResult result = randomTestSuiteResult();
String testSuiteXmlName = generateTestSuiteXmlName();
marshalTestSuite(result, outputDir.resolve(testSuiteXmlName));
validateResults(outputDir);
}
示例15: run
import ru.yandex.qatools.allure.model.TestSuiteResult; //导入依赖的package包/类
/**
* Mark unfinished test cases as interrupted for each unfinished test suite, then write
* test suite result
* @see #createFakeTestcaseWithWarning(ru.yandex.qatools.allure.model.TestSuiteResult)
* @see #markTestcaseAsInterruptedIfNotFinishedYet(ru.yandex.qatools.allure.model.TestCaseResult)
*/
@Override
public void run() {
for (Map.Entry<String, TestSuiteResult> entry : testSuites) {
for (TestCaseResult testCase : entry.getValue().getTestCases()) {
markTestcaseAsInterruptedIfNotFinishedYet(testCase);
}
entry.getValue().getTestCases().add(createFakeTestcaseWithWarning(entry.getValue()));
Allure.LIFECYCLE.fire(new TestSuiteFinishedEvent(entry.getKey()));
}
}