Java Code Examples for io.qameta.allure.Allure#addAttachment()

The following examples show how to use io.qameta.allure.Allure#addAttachment() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StaticMatrixTest.java    From sailfish-core with Apache License 2.0 6 votes vote down vote up
private void attachFiles() throws IOException {
    if (LOGGER.isInfoEnabled()) {
        LOGGER.info("Attaching files for matrix: {}", matrix.getCanonicalPath());
    }

    try(InputStream stream = new FileInputStream(matrix)) {
        String name = matrix.getName();
        Allure.addAttachment(name, Files.probeContentType(matrix.toPath()), stream, FilenameUtils.getExtension(name));
    }

    try(InputStream stream = new FileInputStream(services)) {
        Allure.addAttachment("Services.zip", Files.probeContentType(services.toPath()), stream, "zip");
    }

    if (LOGGER.isInfoEnabled()) {
        LOGGER.info("Attached files for matrix: {}", matrix.getCanonicalPath());
    }

}
 
Example 2
Source File: AllureHelper.java    From qa-automation-samples with MIT License 5 votes vote down vote up
private static void screenShot(String status, Scenario scenario) {
    byte[] screenshootBytes = ((TakesScreenshot) Page.getDriver()).getScreenshotAs(OutputType.BYTES);
    InputStream screenshootStream = new ByteArrayInputStream(screenshootBytes);
    Allure.addAttachment(scenario.getName() +" - "+ status, screenshootStream);
}
 
Example 3
Source File: ConfigDialogImpl.java    From bobcat with Apache License 2.0 5 votes vote down vote up
private void configure(ComponentConfiguration config) {
  Allure.addAttachment("Component configuration", config.toString());
  config.getTabs().forEach(tab -> {
    switchTab(tab.getTabName());
    setFields(config.getConfigurationForTab(tab.getTabName()));
  });
}
 
Example 4
Source File: AttachmentsTest.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@Test
public void testWithAttachment() {
    Allure.addAttachment("String attachment", "text/plain", "<p>HELLO</p>");
    Assert.assertTrue(true);
}
 
Example 5
Source File: ScreenshotExtension.java    From bobcat with Apache License 2.0 4 votes vote down vote up
private void takeScreenshot(WebDriver webDriver) throws IOException {
  File screenshotAs = ((TakesScreenshot) webDriver).getScreenshotAs(OutputType.FILE);
  Allure.addAttachment("Screenshot", new FileInputStream(screenshotAs));
}