本文整理汇总了Java中ru.yandex.qatools.allure.annotations.Attachment类的典型用法代码示例。如果您正苦于以下问题:Java Attachment类的具体用法?Java Attachment怎么用?Java Attachment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Attachment类属于ru.yandex.qatools.allure.annotations包,在下文中一共展示了Attachment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveFullPageScreenshot
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment(value = "Entirepage Screenshot of {0}", type = "image/png")
public static byte[] saveFullPageScreenshot(String name,WebDriver driver)
{
try
{
BufferedImage image = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(1000)).takeScreenshot(driver).getImage();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
baos.flush();
byte[] imageInByte = baos.toByteArray();
baos.close();
return imageInByte;
}
catch (IOException e)
{
e.printStackTrace();
}
return "Unable to Get Screenshot.".getBytes();
}
示例2: getScreenShot
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment(value = "Page")
public byte[] getScreenShot()
{
ru.yandex.qatools.ashot.Screenshot s = new AShot().takeScreenshot(localDriver);
try
{
ByteArrayOutputStream stream = new ByteArrayOutputStream();
ImageIO.write(s.getImage(), "png", stream);
stream.flush();
byte[] image = stream.toByteArray();
stream.close();
return image;
}
catch (IOException e)
{
e.printStackTrace();
return null;
}
}
示例3: writeScreenshotToFile
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment(value = "Screenshot on failure", type = "image/png")
private byte[] writeScreenshotToFile(WebDriver driver, File screenshot) {
try {
FileOutputStream screenshotStream = new FileOutputStream(screenshot);
byte[] bytes = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.BYTES);
screenshotStream.write(bytes);
screenshotStream.close();
return bytes;
} catch (IOException unableToWriteScreenshot) {
System.err.println("Unable to write "
+ screenshot.getAbsolutePath());
unableToWriteScreenshot.printStackTrace();
}
return null;
}
示例4: fileToBytes
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment(value = "MS Excel - XLSX Attachment")
public static byte[] attachFileType_XLSX(String filePath) throws Exception
{
return fileToBytes(filePath);
}
示例5: print
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment("Request")
String print(FilterableRequestSpecification requestSpec, FilterableResponseSpecification responseSpec, FilterContext ctx) {
return RequestPrinter.print(requestSpec, requestSpec.getMethod().toString(), requestSpec.getURI(), LogDetail.ALL, System.out, true);
}
示例6: getVideo
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment(value = "Video on Failure", type = "video/mp4")
private static byte[] getVideo(URL videoCaptureURL)
throws TimeoutException, InterruptedException, ConnectException {
int i = 0;
while (i++ < 4) {
logger.debug("Download URL for Video Capture: " + videoCaptureURL);
Response response = RestAssured.get(videoCaptureURL);
if (response.getStatusCode() == HttpStatus.SC_OK) {
return response.asByteArray();
}
TimeUnit.SECONDS.sleep(2);
}
throw new TimeoutException();
}
示例7: attachScreenShotToAllure
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@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());
}
示例8: captureScreen
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment(value = "screencap", type = "image/png") public byte[] captureScreen(byte[] bs) {
return bs;
}
示例9: saveScreenshot
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment(value = "Page screenshot", type = "image/png")
public byte[] saveScreenshot(byte[] screenShot) {
return screenShot;
}
示例10: takeScreenShot
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment()
public byte[] takeScreenShot() {
return ((TakesScreenshot) getWrappedDriver()).getScreenshotAs(OutputType.BYTES);
}
示例11: attachLog
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment()
public byte[] attachLog() throws IOException
{
InputStream inputStream = new FileInputStream( new File( "./execution.log" ) );
return IOUtils.toByteArray( inputStream );
}
示例12: saveTextLog
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment( value = "{0}", type = "text/plain" )
public static String saveTextLog( String attachName, String message )
{
logger.info( message );
return message;
}
示例13: attachScreenShot
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment()
private static byte[] attachScreenShot() {
return ((TakesScreenshot) DriverFactory.getDriver()).getScreenshotAs(OutputType.BYTES);
}
示例14: attachmentWithNullValue
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment
public byte[] attachmentWithNullValue() {
return null;
}
示例15: attachmentWithoutTitle
import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment
public byte[] attachmentWithoutTitle() {
return new byte[]{};
}