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

Adding validaton for data in PyString. #1432

Open
lasotaartur opened this issue May 17, 2023 · 3 comments
Open

Adding validaton for data in PyString. #1432

lasotaartur opened this issue May 17, 2023 · 3 comments

Comments

@lasotaartur
Copy link

Does it possible to add validation for a data in PyString format in behat step?
For example when some records are prepared for scenario (given) then, it will be worth validating that some fields are required in PyString for this behat step.

@stof
Copy link
Member

stof commented May 17, 2023

there is no builtin way to do that. You need to do it inside the implementation of your step.

@lasotaartur
Copy link
Author

Yes, I know, but it could be good feature in behat.

@uuf6429
Copy link

uuf6429 commented Mar 3, 2024

@lasotaartur that's unlikely to happen since it is very, very, specific to your individual use-case.

Even the implementation is very specific and subjective:

  • is it about some simple validation ("value required", "must be numeric"..) or more complex ("must be between X and Y", "must match an IP address"..)
  • in either case, it probably makes sense to use an external library for validation
  • how would you trigger/define the validation?
    • by an external schema? attached with a gherkin attribute?
    • by matching the table header name with a list (columnName => validations) list configured somewhere?
    • in case of simple validation, by special formatting on the column name? (e.g. name* = value required, xx id = must be a number...)
  • it's very unlikely that a lot of people would actually use this feature
  • the very simple approach, as stof mentioned, is to do it in your step definitions (which isn't something that behat does automatically for you anyway)

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

No branches or pull requests

3 participants