A collection of commands that can be used as a parameter to another command where they are executed through calls to the interpreter in any desired order and results handled in any way. This collection can be obtained from the context as shown here:

ArrayList<Object> params = (ArrayList<Object>) this.getOptionalObject("blockParam");


3 built in commands that use this functionality are:

1. Expect Failure
2. Ignore Errors
3. Repeat


Example for Expect Failure

A block that is used when there is supposed to be an exception thrown by a command. If an exception is thrown, the test will stop executing commands within the block but attempt to execute the remainder of the script. If an exception is not encountered, an ExpectFailureException is thrown instead. If the ExpectFailure is nested within another ExpectFailure, this exception will still be thrown (doesn’t count as an expected failure).

<test name="Nested Block Testing">
<automationValue>High</automationValue>
  <teststeps>
    <expectFailure>
      <FailHere/>
    </expectFailure>
    <block>
      <string name="name">test</string>
      <RandomGenerator method="string"  string="name"/>
    </block>
  </teststeps>
</test>

Example for Ignore Error

Surrounds a block of commands and, if an error is encountered, it will stop execution of that block but the rest of the script will continue. The exception is then thrown when the test is done executing.
<test name="Errors">
  <automationValue>High</automationValue>
  <teststeps>
    <ignoreErrors>
	  <FailHere/>
    </ignoreErrors>
  </teststeps>
</test>

Example for Repeat

Surrounds a block of commands and executes them the specified number of times.
<test name="Repeat">
  <automationValue>High</automationValue>
  <teststeps>
    <repeat iterations ="5">
      <string name="name">test</string>
      <RandomGenerator method="string"  string="name"/>    
    </repeat>
  </teststeps>
</test>