我试着用各种方法在Allure Report插件中嵌入一段试运行视频。如果我们在Allure报告文件夹中添加一个视频文件夹,并在诱惑力描述中添加视频路径,就可以做到这一点。然后,Allure在描述部分显示并播放视频。
然而,我想用Allure Jenkins插件来实现同样的效果。你可以让我知道,如果有任何方法嵌入和播放的诱惑力报告使用诱惑力jenkins插件生成的视频。
我在you tube上看到了视频,他们在jenkins的Allure报告中播放视频。但不确定他们是如何设置的。请帮帮忙?https://www.youtube.com/watch?v=74zD5q9DKTw
发布于 2021-02-19 14:26:57
似乎与"jenkins plugin“无关,你可以重写testngListener,并添加带有"Attachement”的视频
@Override
public void onTestFailure(ITestResult result) {
super.onTestFailure(result);
String mp4 = store + "\\" + sessionId + ".mp4";
File file = new File(mp4);
if (file.exists()) {
attachRecord(mp4);
}
}
@Attachment(value = "record screen", type = "video/mp4")
private byte[] attachRecord(String mp4) {
System.out.println("mp4 -->" + mp4);
Path content = Paths.get(mp4);
InputStream is = null;
try {
is = Files.newInputStream(content);
} catch (IOException e) {
e.printStackTrace();
}
return is2ByeteArray(is);
}
public static byte[] is2ByeteArray(InputStream is) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buff = new byte[100];
int rc = 0;
while (true) {
try {
if (!((rc = is.read(buff, 0, 100)) > 0)) break;
} catch (IOException e) {
e.printStackTrace();
}
baos.write(buff, 0, rc);
}
return baos.toByteArray();
}https://stackoverflow.com/questions/49066938
复制相似问题