当前位置: 首页>>代码示例>>Java>>正文


Java Attachment类代码示例

本文整理汇总了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();
}
 
开发者ID:GladsonAntony,项目名称:WebAutomation_AllureParallel,代码行数:20,代码来源:AllureAttachments.java

示例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;
    }
}
 
开发者ID:crazycabo,项目名称:testable-testsuite-ui,代码行数:21,代码来源:Screenshot.java

示例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;
}
 
开发者ID:jvanderwee,项目名称:bootstrapium,代码行数:17,代码来源:ScreenshotListener.java

示例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);
}
 
开发者ID:GladsonAntony,项目名称:WebAutomation_AllureParallel,代码行数:6,代码来源:AllureAttachments.java

示例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);
}
 
开发者ID:dins-heisenbug-2016,项目名称:piggymetrics,代码行数:5,代码来源:AccountServiceTest.java

示例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();
}
 
开发者ID:Frameworkium,项目名称:frameworkium-core,代码行数:15,代码来源:VideoCapture.java

示例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());
}
 
开发者ID:WileyLabs,项目名称:teasy,代码行数:5,代码来源:Screenshoter.java

示例8: captureScreen

import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment(value = "screencap", type = "image/png") public byte[] captureScreen(byte[] bs) {
    return bs;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:4,代码来源:MarathonTestProvider.java

示例9: saveScreenshot

import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment(value = "Page screenshot", type = "image/png")
public byte[] saveScreenshot(byte[] screenShot) {
    return screenShot;
}
 
开发者ID:SpaceHead1C,项目名称:module-template,代码行数:5,代码来源:MyTestListener.java

示例10: takeScreenShot

import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment()
public byte[] takeScreenShot() {
    return ((TakesScreenshot) getWrappedDriver()).getScreenshotAs(OutputType.BYTES);
}
 
开发者ID:hemano,项目名称:cucumber-framework-java,代码行数:5,代码来源:BaseSteps.java

示例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 );
}
 
开发者ID:hemano,项目名称:cucumber-framework-java,代码行数:7,代码来源:StartingSteps.java

示例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;
}
 
开发者ID:hemano,项目名称:cucumber-framework-java,代码行数:7,代码来源:RestUtil.java

示例13: attachScreenShot

import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment()
private static byte[] attachScreenShot() {
    return ((TakesScreenshot) DriverFactory.getDriver()).getScreenshotAs(OutputType.BYTES);
}
 
开发者ID:hemano,项目名称:cucumber-framework-java,代码行数:5,代码来源:UpdateAssert.java

示例14: attachmentWithNullValue

import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment
public byte[] attachmentWithNullValue() {
    return null;
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:5,代码来源:Allure1AttachAspectsTest.java

示例15: attachmentWithoutTitle

import ru.yandex.qatools.allure.annotations.Attachment; //导入依赖的package包/类
@Attachment
public byte[] attachmentWithoutTitle() {
    return new byte[]{};
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:5,代码来源:Allure1AttachAspectsTest.java


注:本文中的ru.yandex.qatools.allure.annotations.Attachment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。