Skip to content

Background outline#2

Open
dpakach wants to merge 3 commits into
masterfrom
Background-outline
Open

Background outline#2
dpakach wants to merge 3 commits into
masterfrom
Background-outline

Conversation

@dpakach
Copy link
Copy Markdown

@dpakach dpakach commented Jan 15, 2020

Add Support for Outline table in Background.
The Example table provided in the background will be used in all the Scenario outline in that feature unless it is overridden in the scenario outline itself

@api @skipOnOcV10.3
Feature: Users sync

  Background:
    Given these users have been created with default attributes and without skeleton files:
    | username |
    | user0    |
    | user1    |
  Examples:
    | ocs-api-version | http-status-code |
    | 1               | 200              |
    | 2               | 404              |

  @TestAlsoOnExternalUserBackend
  Scenario Outline: Trying to sync a user which does not exist
    Given using OCS API version "<ocs-api-version>"
    When the administrator tries to sync user "user10" using the OCS API
    Then the HTTP status code should be "<http-status-code>"
    And the OCS status code should be "404"
    And the OCS status message should be "User is not known in any user backend: user10"

  @TestAlsoOnExternalUserBackend
  Scenario: Trying to sync a user as another user which does not exist
    Given using OCS API version "1"
    When user "user20" tries to sync user "user1" using the OCS API
    Then the HTTP status code should be "401"
    And the OCS status code should be "997"
    And the OCS status message should be "Unauthorised"


  @TestAlsoOnExternalUserBackend
  Scenario Outline: Trying to sync a user by non admin user
    Given using OCS API version "<ocs-api-version>"
    When user "user0" tries to sync user "user1" using the OCS API
    Then the HTTP status code should be "<http-status-code>"
    And the OCS status code should be "<ocs-status-code>"
    And the OCS status message should be "Logged in user must be an admin"
    Examples:
      | ocs-api-version | ocs-status-code | http-status-code |
      | 1               | 403             | 200              |
      | 2               | 403             | 403              |

In the above example,

  • The first Scenario will use example table from the background as it is outline and it doesn't have its own example table.
  • The second Scenario will not use any example table as it is not a outline.
  • The third Scenario will use example table provided in the scenario itself as it is outline and it has its own example table.

@dpakach dpakach force-pushed the Background-outline branch 3 times, most recently from 8c78963 to 8890611 Compare January 15, 2020 10:28
@dpakach dpakach requested a review from a team January 15, 2020 10:39
@dpakach dpakach self-assigned this Jan 15, 2020
@dpakach dpakach added the enhancement New feature or request label Jan 15, 2020
@dpakach dpakach marked this pull request as ready for review January 15, 2020 10:40
@dpakach dpakach force-pushed the Background-outline branch from 8890611 to 7505014 Compare January 15, 2020 11:04
Copy link
Copy Markdown

@jasson99 jasson99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Copy Markdown

@jasson99 jasson99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread tests/Behat/Gherkin/Fixtures/features/background_with_outline_multi.feature Outdated
@dpakach dpakach force-pushed the Background-outline branch from 09ffcd4 to f85b54c Compare January 16, 2020 05:31
Comment thread src/Behat/Gherkin/Parser.php Outdated
@phil-davis
Copy link
Copy Markdown
Member

@dpakach we also need to think about the other PR Behat#161 that allows multiple examples tables with different tags. It should be possible to have multiple example tables in the background section, each having different tags.

Maybe make another demonstration PR, cherry-pick the code from Behat#161 then cherry-pick the code from this PR and make whatever adjustments are needed for the combination of both features. Then we will know that all is well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants