Skip to content

Commit

Permalink
Add new test for attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Bautin committed Jan 12, 2021
1 parent ed53bf5 commit f7ba03d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions allure-pytest-bdd/test/attachments_tests/attachment_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ def test_attachment_in_many_steps():
@scenario("attachments_features\\attachment_in_failed_step.feature", "Attachment in failed step")
def test_failed_step_with_attachment():
pass


@scenario("attachments_features\\attachment_in_called_fixture.feature", "Attachment in called fixture")
def test_attachment_in_called_fixture():
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Feature: Attachments

Scenario: Attachment in called fixture
Given example.feature with content:
"""
Feature: Feature Test
Scenario: My Scenario Test
Given passed step
When when-step use fixture, that have attachment
Then passed step
"""
And py file with name: example_test
And with imports: pytest, pytest_bdd, allure
And with passed steps
And with func:
"""
@pytest.fixture()
def fixture_with_attachment():
allure.attach('Attachment content', 'allure attachment', allure.attachment_type.TEXT)
"""
And with func:
"""
@pytest_bdd.when("when-step use fixture, that have attachment")
def step_with_attachment(fixture_with_attachment):
pass
"""
And test for My Scenario Test from example.feature
And py file saved

When run pytest-bdd with allure

Then attachment allure attachment must be in attachments
And this attachment with content:
"""
Attachment content
"""
And attachments must not be in When when-step use fixture, that have attachment

0 comments on commit f7ba03d

Please sign in to comment.