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

REQ: Nested table templates #27

Closed
teunisnl opened this issue Nov 27, 2017 · 8 comments
Closed

REQ: Nested table templates #27

teunisnl opened this issue Nov 27, 2017 · 8 comments

Comments

@teunisnl
Copy link

What:

|table template|T1   |
|echo          |@{P3}|
|echo          |@{P1}|

|table template|T2   |
|T1                  |
|echo          |@{P2}|

|script|echo fixture|

|T2      |
|P1|P2|P3|
|1 |2 |3 |

Why:
Alot more flexible, and less maintaining of tests;
Downside would be that names have to be unique over multiple templates
(current main reason need to add products, but in other test I need to remove products too, would like reuse the adding part)

Current work around:

|table template|T1   |
|echo          |@{P3}|
|echo          |@{P1}|

|table template       |T2         |
|T1                  ;|@{P3}|@{P1}|
|echo                 |@{P2}      |

|script|echo fixture|

|T2      |
|P1|P2|P3|
|1 |2 |3 |
@fhoeben
Copy link
Owner

fhoeben commented Nov 27, 2017

I see why this can be useful. Would it be acceptable if:

  • order of table template definition is important (i.e. template used as nested has to be defined first)
  • call to nested table template must end with ';' (e.g. not T1 but T1;)
  • no explicit parameters are allowed

@fhoeben
Copy link
Owner

fhoeben commented Nov 27, 2017

I believe I can address this request. But I fear a FitNesse update is needed. See unclebob/fitnesse#1103

@fhoeben
Copy link
Owner

fhoeben commented Nov 27, 2017

Given the 3 limitations stated above I created a rough version of a fix
https://github.com/fhoeben/hsac-fitnesse-plugin/tree/tableTemplateNested

Test would work something like:

|table template|T0                  |
|check         |clone symbol|@{P0}|0|
|$P6=          |clone symbol|@{P1}  |

|table template|T1                  |
|check         |clone symbol|@{P3}|3|
|$P4=          |clone symbol|@{P1}  |
|T0;                                |

|table template|T2                |
|T1;                              |
|$P5=          |clone symbol|@{P2}|


|script|

|T2                     |
|P0|P1|P2|P3|P4?|P5?|P6?|
|0 |1 |2 |3 |1  |2  |1  |

Would that work?

@teunisv
Copy link
Contributor

teunisv commented Nov 28, 2017

This is for totally acceptable, an improvement would be to remove the limitation:

order of table template definition is important (i.e. template used as nested has to be defined first)

Is my assumption right that this also requires that the nested table templates would need to be defined in the same scenariolibrary ?

@fhoeben
Copy link
Owner

fhoeben commented Nov 28, 2017

I don't think I know straight away how to remove that limitation. I believe I need to determine the parameters when the table is parsed, which requires the 'called table' to be parsed before this one.

I don't think it has to be in the same scenario library. I believe a higher level scenario library (i.e. in a parent suite) would also work.

@teunisv
Copy link
Contributor

teunisv commented Nov 28, 2017

The current solution is enough for me;
if at another point the order limitation can be removed that would be an great improvement,
but for readability i think current required order is actually better.

@teunisv
Copy link
Contributor

teunisv commented Nov 28, 2017

I believe I can address this request. But I fear a FitNesse update is needed. See unclebob/fitnesse#1103

https://bintray.com/fitnesse/release/fitnesse/20171015 ?

@fhoeben
Copy link
Owner

fhoeben commented Nov 28, 2017

I implemented a workaround (by using some reflection) so the change is not REQUIRED.
But I believe a new release is around the corner...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants