Reputation: 1
I am using Concordion to test some java components. I will write something like
<pre concordion:execute="someFunction(#TEXT, #a)">
{
id:123,
name:<span concordion:echo="#b"/>
}
</pre>
I want to value of #b is calculated and substituted dynamically. But instead of value #b in someFunction comes an empty string. Similarly, if use
name:<span concordion:execute="getBValue()"/>
If someone has done something like this, could you please help.
Thanks.
Upvotes: 0
Views: 1015
Reputation: 287
I think Concordion was not design for the purpose of this use case. It is not a template engine. You can transfer the text elements of your specification as input into your automated tests. Additionally, you can use the values inside your specifications as reference to compare the actual outputs of the system under test.
When you want to transfer the result of some method getBValue() into another method someFunction() you have probably several option:
<pre concordion:execute="someFunction(#TEXT, #a, #b)">
{
id:123,
name:placeholder-for-value-b
}
</pre>
Then inside of someFunction() you could replace the placeholder:
public void someFunction(String text, String aValue, String bValue) {
text.replace("placeholder-for-value-b", bValue);
//continue logic of someFunction
}
Upvotes: 1
Reputation: 287
Could your problem be related with the html structure? When you are using nested elements such as
<pre concordion:execute=...> <span concordion:assert-equals=...>...</span> <span concordion:set=...>...</span> </pre>
Concordion uses the following execution order:
This is the way Concordion handles unusual sentence structures.
What about putting the execute-command inside a dedicated span-tag?
<pre> <span concordion:execute=...>...</span> <span concordion:echo=...></span> </pre>
Upvotes: 0
Reputation: 287
you could use the execute command to initialize the variable #name:
<span concordion:execute="#name=getBValue()"/>
followed by the echo command:
name: <span concordion:echo="name" />
or have you tried to call your method directly within the echo command?
name: <span concordion:echo="getBValue()" />
Upvotes: 0