You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
since steps can be used across different Scenario/Features, probably an implementation needs to be generated per Scenario.
The text was updated successfully, but these errors were encountered:
riederm
changed the title
[ModelInferer] Make Features use methods to share step implementations instead of copying the AST
[ModelInferrer] Make Features use methods to share step implementations instead of copying the AST
Apr 29, 2017
Problem is that Steps can be shared across multiple Scenarios, if we want to extract the step into a common method it has to happen in the XXFeature.java class and not in the Scenario classes
Example :
Feature: SomeClassFeature
val a = 10
Scenario: Testing a feature reference
Given step
new SomeClass
Scenario: Referencing it
Given step
Another problem is a step can also be declared in a Background, however it is currently unusable from a scenario as it leads to generating the same method twice
I just realized that steps can even be shared across different features. Interesting is, that it not only pulls the implementation into the other feature, but it also pulls the fields (that may be used, or may not be used) into the new feature.
This produces some interesting situations. You can reference two steps from two different features that both use a member variable with the same name, but with different types.
Maybe we need some conceptual work first.
A more cleaner approach would be to have some well defined scopes of the member-fields pulled in by spec-references. I could think of things like:
pull in the variables and the implemention per feature, rename the variables to fully qualifying names.
dont declare fields as simple fields but generate a member-Class that holds all fields as public members. Each feature that uses these variables instantiates its own object. So withing the implementation you would refer this variables using "someClassFeatureMembers.a" instead of "a". Basically the same idea like 1 - just differently executed
A stepReference is implement in a way so the AST from the referenced step is copied.
Copying the AST introduces some problems (e.g. these elements have no Node-Model applied).
instead of generating two basically identical methods:
it should generate the the implementation into its own method, and only call from the single steps:
since steps can be used across different Scenario/Features, probably an implementation needs to be generated per Scenario.
The text was updated successfully, but these errors were encountered: