Open brucetrask opened 7 years ago
Perhaps the same question applies to script tables calling Decision Tables. For some reason it is not obvious to me how that would work. I understand from searching the archives:
"Your first steps in the script table may yield to scenario tables, decision tables, or whatever you have. "
But as far as I can tell, script and scenario tables can only yield to function type calls within their respective tables. In other words it is not possible to add an query or setup table to a script or scenario table proper. Or am I missing something?
As an trivial example. Let's take the ShouldIBuyMilkDecisionTable from the example in Fitnesse. I would (for various reasons) like to call it from either a script or a scenario table.
E.g. This is the normal decision table and an attempt to call it from a script which calls a scenario table.
This is it called directly from a script
Both calls from the scenario or from the script fail to see it as a Decision Table within.
I don't see what you try to do there. With regards to script tables, I usually end up with something like this:
|SetUp table| <-- this is the portion of the decision table where just the setters get called |rows & columns|
|script|Some Script Table| <-- this is doing some stuff based upon the former initialization in the SetUp table |do something|
|query|Some Query Table| <-- This checks stuff |some query|
Put this all together in one wiki page, and the different tables interact with the system.
+++
When it comes to scenarios where you want to reuse code from decision tables, you may end up with a scenario like that (note, it only works for a single row in a decision table): |scenario|buy some milk|@cashInWallet||@creditCard| |set cash in wallet|@cashInWallet| |set credit card|@creditCard| |execute|
Best Markus
Save our Scrum: http://leanpub.com/saveourscrum -- Dipl.-Inform. Markus Gaertner Author of ATDD by Example - A Practical Guide to Acceptance Test-Driven Development
http://www.shino.de/blog http://www.mgaertne.de http://www.it-agile.de Twitter: @mgaertne
On Mon, Jan 23, 2017 at 11:40 PM, brucetrask notifications@github.com wrote:
As an trivial example. Let's take the ShouldIBuyMilkDecisionTable from the example in Fitnesse. I would (for various reasons) like to call it from either a script or a scenario table.
E.g. [image: script1] https://cloud.githubusercontent.com/assets/10885119/22226090/e7120392-e192-11e6-8cd4-c6ef768b0abd.png [image: script2] https://cloud.githubusercontent.com/assets/10885119/22226100/ef3131ba-e192-11e6-90d9-162b11453c24.png [image: script3] https://cloud.githubusercontent.com/assets/10885119/22226109/f2085e2c-e192-11e6-914d-57f97419be2a.PNG [image: script4] https://cloud.githubusercontent.com/assets/10885119/22226112/f4a508e2-e192-11e6-870a-bd58ddc5f003.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/unclebob/fitnesse/issues/1026#issuecomment-274641076, or mute the thread https://github.com/notifications/unsubscribe-auth/AAC7wP0egzzSMXg7USRv8Pr-56VLlwY2ks5rVSxJgaJpZM4Lrj0E .
Thanks @mgaertne. Sorry if I am not clear. What I am trying to do is parameterize a decision table. At the extreme I would like to parameterize an entire story which has mulitple tables including a decision table (e.g. parameterizing the sequence of tables you have above in your response). Another way to put it. I am trying to do what is accomplished in http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.AcceptanceTestPatterns.ParameterizedIncludes but using tables instead of variables. The case I am thinking about is "If I vary a few parameters along different values does a predefined story still function as expected?" This is possible in FitLibrary with DefinedActions where I can "call" an arbitrary set of tables with some parameters. But for a some other reasons I am trying to stay within the capabilities of Slim but it looks like I am constrained to the one liners you talked about versus including a full blown decision table within a Scenario.
I coded up an example in FitLibrary and did with Defined Actions what I am hoping to do with Slim scenarios. You can ignore the silliness of the example, the mechanics are the same in any case: parameterize a decision table from another table of values. This accomplishes in tables what is done a bit more verbosely in http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.AcceptanceTestPatterns.ParameterizedIncludes. But my goal here is to do the below in Slim with scenarios.
I have a defined action which uses a Decision Table:
And it is called from a table that provides the parameterization for the defined action (which get forwarded to the decision table)
When run, this results in the following:
I know I can call a Scenario Table from a Decision Table but can I put a Decision Table into a Scenario table?