Java源码示例:io.qameta.allure.Attachment

示例1
@Attachment(value = "Video on Failure", type = "video/mp4")
private byte[] getVideo(URL videoCaptureURL) {
    try {
        return urlFetcher.fetchWithRetry(videoCaptureURL, 4);
    } catch (TimeoutException e) {
        logger.error("Failed fetching URL {}.", videoCaptureURL);
        return null;
    }
}
 
示例2
@Attachment(value = "Failed test screenshot", type = "image/png")
public static byte[] takeScreenshotToAttachOnAllureReport() {
    return ((TakesScreenshot) DriverManager.getDriver()).getScreenshotAs(OutputType.BYTES);
}
 
示例3
@Attachment(value = "Browser information", type = "text/plain")
public static String addBrowserInformationOnAllureReport() {
    return DriverManager.getInfo();
}
 
示例4
@Attachment(value = "{0} : {1}", type = "image/png")
public byte[] attachScreenShotToAllure(final String testName, final String errorMessage, final File screenShot) throws IOException {
    return Files.readAllBytes(screenShot.toPath());
}
 
示例5
@Attachment("Image attachment")
public byte[] addImgAttachment() throws IOException {
    File img = new File(getClass().getClassLoader().getResource("totally-open-source-kitten.jpeg").getFile());
    return Files.readAllBytes(img.toPath());
}
 
示例6
@Attachment(value = "String attachment", type = "text/plain")
public String addStringAttachment() {
    return Arrays.toString(new Throwable().getStackTrace());
}
 
示例7
@Attachment(type = "image/png", value = "{filename}", fileExtension = ".png")
public byte[] attachPNG(byte[] filedata, String filename)
{
    return filedata;
}
 
示例8
@Attachment(type = "text/plain", value = "{filename}")
public byte[] attachTxt(byte[] filedata, String filename)
{
    return filedata;
}
 
示例9
@Attachment(type = "image/png", value = "{filename}", fileExtension = ".png")
public static byte[] attachPNG(final String filename)
{
    return ((TakesScreenshot) Neodymium.getDriver()).getScreenshotAs(OutputType.BYTES);
}
 
示例10
@Attachment(value = "attachment", type = "text/plain")
public String attachment() {
    return "<p>HELLO</p>";
}
 
示例11
@Attachment(value = "attachment", type = "text/plain")
public String attachment() {
    return "<p>HELLO</p>";
}
 
示例12
@Attachment(value = "attachment", type = "text/plain")
public String attachment() {
    return "<p>HELLO</p>";
}
 
示例13
@Attachment(value = "attachment", type = "text/plain")
public String attachment() {
    return "<p>HELLO</p>";
}
 
示例14
@Attachment(value = "attachment", type = "text/plain")
public String attachment() {
    return "<p>HELLO</p>";
}
 
示例15
@Attachment(value = "attachment", type = "text/plain")
public String attachment() {
    return "<p>HELLO</p>";
}
 
示例16
@Attachment(value = "attachment", type = "text/plain")
public String attachment() {
    return "<p>HELLO</p>";
}
 
示例17
@Attachment(value = "attachment", type = "text/plain")
public String attachment() {
    return "<p>HELLO</p>";
}
 
示例18
@Attachment(value = "attachment", type = "text/plain")
public String attachment() {
    return "<p>HELLO</p>";
}