Ensure scenarios invoked from scripts use the ScriptTable class of the calling script #507
Conversation
ScriptTable scriptTable = new ScriptTable(newTable, id, testContext); | ||
protected ScriptTable createChild(ScenarioTestContext testContext, SlimTable parentTable, Table newTable) { | ||
ScriptTable scriptTable; | ||
if (parentTable instanceof ScriptTable && !parentTable.getClass().equals(ScriptTable.class)) { |
amolenaar
Aug 20, 2014
Collaborator
Why this differency in table creation? Shouldn't ScriptTable be created the same way as it's customised sub class?
Why this differency in table creation? Shouldn't ScriptTable be created the same way as it's customised sub class?
fhoeben
Aug 20, 2014
Author
Collaborator
When a DecisionTable creates a scenario the parent table is not a script.
When a ScriptTable (not a subclass is used) I avoided reflection, so no reflection was needed at all. Maybe it's premature optimization.
When a DecisionTable creates a scenario the parent table is not a script.
When a ScriptTable (not a subclass is used) I avoided reflection, so no reflection was needed at all. Maybe it's premature optimization.
Last commit is not really for making the ScenarioTable create custom subclasses, but the change was so small a separate branch seems wasted effort |
amolenaar
added a commit
that referenced
this pull request
Aug 23, 2014
Ensure scenarios invoked from scripts use the ScriptTable class of the calling script
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
When a custom subclass of ScriptTable is used and a scenario is invoked from the script. Currently the ScenarioTable class will always convert its contents into assertions using the standard ScriptTable class.
To me it seems more natural/expected that the ScenarioTable would use the table-class of the calling script. This view seems to be supported by the documentation (FitNesse.UserGuide.WritingAcceptanceTests.SliM.ScenarioTable) which states: "They are macros, not programs. They are constructed via text substitution." which to me indicates the type of script table used should not change when replacing lines of script with a scenario call.