Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: defalut value not covered by parameters passed through feature file #737

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yunxuo
Copy link

@yunxuo yunxuo commented Nov 8, 2024

Describe the bug
when given multi description for step as below code

@given('a user with username')
@given(parsers.parse('a user with username {username}'))
@given(parsers.parse('a user with username {username} and password {password}'))
def create_user(user, username="defaultuser", password='defaultpassword'):
    user['username'] = username
    user['password'] = password

and pass parameters from feature file in Scenario Outline

Scenario Outline: User login
    Given a user with username <username> and password <password>
    When the user logs in with username <username> and password <password>
    Then the login should be <result>

    Examples:
      | username | password    | result  |
      | testuser | password123 | success |

Parameters username, password parameters passed through feature file cannot take effect.
The default values in def are always used。
in above case, the result is

user = {
    'username': 'defaultuser',
    'password': 'defaultpassword'
}

see also:
#610 pr fix this problems
#512

Copy link
Collaborator

@jsa34 jsa34 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Can we add a test for this?

@yunxuo
Copy link
Author

yunxuo commented Nov 14, 2024

Thanks for the PR! Can we add a test for this?

yes!

@yunxuo yunxuo requested a review from jsa34 November 15, 2024 02:45
Copy link
Collaborator

@jsa34 jsa34 left a comment

Choose a reason for hiding this comment

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

I cannot see any changes? I was expecting the tests to be added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants