package com.junit5.allure2report_addattachment_l3.addvideo;
import io.qameta.allure.Allure;
import io.qameta.allure.Attachment;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
@DisplayName("allure2报告中添加视频")
public class Mp4Test {
@Test
@DisplayName("注解方式上传视频")
public void testMp4WithAn() throws IOException {
byte[] contents = Files.newInputStream(Paths.get("allure2.mp4")).readAllBytes();
attachMp4WithByte(contents,"allure报告录制");
}
@Attachment(value = "{mp4Name}",type = "video/mp4")
byte[] attachMp4WithByte(byte[] contents,String mp4Name){
System.out.println("mp4Name:"+mp4Name);
return contents;
}
@Test
@DisplayName("方法方式上传视频")
public void testMp4wWithMethod() throws IOException {
Allure.addAttachment("mp4方法","video/mp4",
Files.newInputStream(Paths.get("allure2.mp4")),
"mp4");
}
}
/**
* TEXT = ("text/plain", "txt")
* CSV = ("text/csv", "csv")
* TSV = ("text/tab-separated-values", "tsv")
* URI_LIST = ("text/uri-list", "uri")
*
* HTML = ("text/html", "html")
* XML = ("application/xml", "xml")
* JSON = ("application/json", "json")
* YAML = ("application/yaml", "yaml")
* PCAP = ("application/vnd.tcpdump.pcap", "pcap")
*
* PNG = ("image/png", "png")
* JPG = ("image/jpg", "jpg")
* SVG = ("image/svg-xml", "svg")
* GIF = ("image/gif", "gif")
* BMP = ("image/bmp", "bmp")
* TIFF = ("image/tiff", "tiff")
*
* MP4 = ("video/mp4", "mp4")
* OGG = ("video/ogg", "ogg")
* WEBM = ("video/webm", "webm")
*
* PDF = ("application/pdf", "pdf")
*/
评论