[Templates] Conditional generation using tags


hi !

Is it possible to customize file generation according tag presence or value ?

For exemple :

  • If exist(TagName) then […]
  • If valueOf(tagName) = TagValue then […]

Thanks a lot for your response.

Best regards,
Eric Leconte.



In fact, this should be possible using hiptest-publisher template override system.

For example, if you want to check if a tag exist on a scenario template, you can use this syntax:

{{#if_includes rendered_children.tags "TagName"}}

Is it really what you were seeking?



It’s great to check if a simple tag “TagName” or if a couple Tag/Value “TagName:TagValue” is present .

But is it possible to check if a Tag key is present or if a tag value is present for a specific key and get this value ?

I want for example to do this kind of things working with tags :

For a tag “Context:App”

{{#if_includes rendered_children.tags “Context”}}
Do something whith {{{ tag_value “Context” }}}


key/value tags are rendered as a string using this format “key-value”.
You can of course test a key/value presence but more advanced conditions
are going to be complicated to implement in a template override

I am starting to think there is a better way to achieve your goal.
Maybe handling this behaviour in the test implementation is a better path.

May I ask you to describe your needs ? Can I have some examples ?




The first goal is to call external libraries before “Shared Actionwords” are implemented or waiting some features not implemented in this beta.

With a tag “Context:App” I can call an external context in behat with :
$this->getContext({{{ tag.value }}+‘Context’)->AnAction()
If a tag “Context” is present.

But we can also customize class génération according tag keys or values.