Information

This site will undergo a brief period of maintenance on Friday, 18 December at 12:30 AM Central/12:00 PM IST. During a 30 minute window, site availability may be intermittent.

Default language.

If – Source Reference


The If <If> element is a Composite element that is used for executing part of a test scenario only when its condition is met. The component can contain subcomponents like the Iterate and the Scope elements. The If element can be used to, for example, make environment dependent test Scenarios and test scenarios that react on responses from components and execute different tests depending on the result.

Syntax

The syntax of the If element is:

<If name="<name>" expression="<expression>">
--- elements ---
</If>

The name attribute is used to show the If element in the UI and to print out in the execution log. The expression attribute contains the javascript expression to be evaluated. This must evaluate to true or false when being executed. The expression can refer to referenceable data defined earlier in the test scenario.

Example
The example below shows an If element that check that the customer variable has a field ‘important’ that is equal true, and if this is true, then it uses a Log element to log it to the execution log and then it executes the component XARISCAL.

<If name="If customer is important"
expression="customer.important == true &amp;&amp; customer.account&gt;1000">
    <Log>Customer is important</Log>
  <Component label="XARISCAL" moduleName="XARISCAL"
     programExitVerify="value &lt; 8" rollback="false">
  <Data>
<import>
<customer>
  <age>11</age>
</customer>
</import>
<export>
<risc expected="22" />
</export>
  </Data>
 </Component>
</If>

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC AMI DevX Workbench for Eclipse 23.07