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

Decouple parameter type discovery from step definitions modules #15

Open
kieran-ryan opened this issue Mar 17, 2024 · 0 comments
Open
Labels
⚡ enhancement Request for new functionality

Comments

@kieran-ryan
Copy link
Owner

kieran-ryan commented Mar 17, 2024

🤔 What's the problem you're trying to solve?

Discovery of parameter types and step definitions is currently defined through Behave alphabetically crawling Python modules in the steps directory of an environment, and evaluating each as they are encountered.

As step definitions can be discovered before their referenced parameter types, an UndefinedParameterTypeError can occur - and is more likely when defined in separate modules (alphabetically dependent) compared to in the same modules (hierarchical reference dependent).

However, this may be valid behaviour and there may be performance tradeoffs to consider compared to functionality which is supported as per alternatives defined below.

✨ What's your proposed solution?

The following are potential solutions to this problem:

  1. Discover parameter types first before discovering step definitions
  2. Discover step definitions first, then parameter types; and then evaluate parameter types referenced in step definition patterns
  3. Discover parameter types and step definitions as they are encountered; and then evaluate parameter types referenced in step definition patterns

⛏ Have you considered any alternatives or workarounds?

The following are existing mitigations:

  1. Define parameter types in separate modules and import them into the step definition modules which reference them.
  2. Define parameter types in separate modules, named such that they take alphabetical precedence over modules containing step definitions that reference these parameter types.
  3. Within step definitions modules, define parameter types before any step definitions which reference them.

📚 Any additional context?

No response

@kieran-ryan kieran-ryan added the ⚡ enhancement Request for new functionality label Mar 17, 2024
@kieran-ryan kieran-ryan changed the title Decouple parameter type discovery from step definitions Modules Decouple parameter type discovery from step definitions modules Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡ enhancement Request for new functionality
Projects
None yet
Development

No branches or pull requests

1 participant