cbdq-io / testinfra-bdd

An interface between pytest-bdd and pytest-testinfra.
https://pypi.org/project/testinfra-bdd/
BSD 3-Clause "New" or "Revised" License
3 stars 2 forks source link

Given/When/Then Clauses Too Generic #74

Closed dallinb closed 1 year ago

dallinb commented 1 year ago

The GWT clauses are too generic and clash with other pytest-bdd test scenarios. This is because these other tests will have something similar to:

When the foo is bar

Which is interpreted by the step definitions of this project as a resource clause. The solution is to namespace the clauses. For example, change:

  Scenario: User Checks
    Given the host with URL "docker://sut" is ready
    When the user is "ntp"
    Then the user is present
    # Alternative method of checking the state of a resource.
    And the user state is present
    And the user group is ntp
    And the user uid is 101
    And the user gid is 101
    And the user home is /nonexistent
    And the user shell is /usr/sbin/nologin

to:

  Scenario: User Checks
    Given the Testinfra host with URL "docker://sut" is ready
    When the Testinfra user is "ntp"
    Then the Testinfra user is present
    # Alternative method of checking the state of a resource.
    And the Testinfra user state is present
    And the Testinfra user group is ntp
    And the Testinfra user uid is 101
    And the Testinfra user gid is 101
    And the Testinfra user home is /nonexistent
    And the Testinfra user shell is /usr/sbin/nologin

In other words change any occurrence of thewith the Testifnra. This is of course a breaking change so will need to bump to 3.0.0.

dallinb commented 1 year ago

Fixed in 3.0.0.