Package ru.yandex.qatools.allure.model

Examples of ru.yandex.qatools.allure.model.Attachment


     *
     * @param step to change
     */
    @Override
    public void process(Step step) {
        Attachment attachment = writeAttachmentSafely(getAttachment(), getTitle(), getType());
        step.getAttachments().add(attachment);
    }
View Full Code Here


     */
    @Override
    public void process(Step context) {
        Iterator<Attachment> iterator = context.getAttachments().listIterator();
        while (iterator.hasNext()) {
            Attachment attachment = iterator.next();
            if (pattern.matcher(attachment.getSource()).matches()) {
                deleteAttachment(attachment);
                iterator.remove();
            }
        }

View Full Code Here

            return writeAttachment(message.getBytes(CONFIG.getAttachmentsEncoding()), title);
        } catch (Exception e) {
            e.addSuppressed(throwable);
            LOGGER.error(String.format("Can't write attachment \"%s\"", title), e);
        }
        return new Attachment();
    }
View Full Code Here

                try (FileOutputStream fos = new FileOutputStream(file)) {
                    fos.write(attachment);
                }
            }
        }
        return new Attachment().withTitle(title).withSource(source).withType(type).withSize(attachment.length);
    }
View Full Code Here

        assertThat(testSuite.getTestCases(), hasSize(1));
        assertEquals(testSuite.getTestCases().get(0), testCase);

        Step parentStep = fireStepStart();
        Attachment firstAttach = fireMakeAttachment();

        assertThat(parentStep.getAttachments(), hasSize(1));
        assertEquals(parentStep.getAttachments().get(0), firstAttach);

        Step nestedStep = fireStepStart();
        Attachment secondAttach = fireMakeAttachment();

        assertFalse(firstAttach == secondAttach);

        assertThat(nestedStep.getAttachments(), hasSize(1));
        assertTrue(nestedStep.getAttachments().get(0) == secondAttach);

        fireStepFinished();

        assertThat(parentStep.getSteps(), hasSize(1));
        assertEquals(parentStep.getSteps().get(0), nestedStep);

        fireStepFinished();

        Attachment testCaseAttachment = fireMakeAttachment();

        fireTestCaseFinished();

        assertThat(testCase.getSteps(), hasSize(1));
        assertEquals(testCase.getSteps().get(0), parentStep);
View Full Code Here

        int attachmentsCount = lastStep.getAttachments().size();

        Allure.LIFECYCLE.fire(new MakeAttachmentEvent("some.attach.title".getBytes(UTF_8), "attach.body", ""));

        assertThat(lastStep.getAttachments().size(), is(attachmentsCount + 1));
        Attachment attachment = lastStep.getAttachments().get(attachmentsCount);
        assertNotNull(attachment);

        return attachment;
    }
View Full Code Here

        AllureResultsUtils.setResultsDirectory(resultsDirectory);
    }

    @Test
    public void typeTest() throws Exception {
        Attachment attachment = AllureResultsUtils.writeAttachment(bytes, TITLE);
        assertThat(attachment.getTitle(), is(TITLE));
        assertThat(resultsDirectory, contains(attachment.getSource()));
        assertThat(attachment.getType(), is(type));
        assertThat(attachment.getSize(), is(bytes.length));
    }
View Full Code Here

        AllureResultsUtils.setResultsDirectory(resultsDirectory);
    }

    @Test
    public void saveAndDeleteTest() throws Exception {
        Attachment first = save(ATTACHMENT);

        assertNotNull(first);
        String firstSource = first.getSource();
        assertNotNull(firstSource);

        assertThat(resultsDirectory, contains(firstSource));

        deleteAttachment(first);
View Full Code Here

TOP

Related Classes of ru.yandex.qatools.allure.model.Attachment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.