Concordion > Extension >

Listeners

The execution of Concordion commands can be observed using listeners. Listeners have access to the HTML element with which the command is associated, and can modify the output HTML.

Example

An extension is installed that listens to assertEquals, assertTrue, assertFalse and execute commands. When the following instrumentation:

<p concordion:execute="#result=sqrt(#num)">The square root of <span concordion:set="#num">4.0</span> is <span concordion:assertEquals="#result">2.0</span></p>

<p concordion:execute="#result=sqrt(#num)">The square root of <span concordion:set="#num">16.0</span> is <span concordion:assertEquals="#result">3.0</span></p>

<p><span concordion:set="#num">3</span>
is <span concordion:assertTrue="isPositive(#num)">is positive</span>
</p>

<p><span concordion:set="#num">-4</span>
is <span concordion:assertTrue="isPositive(#num)">is positive</span>
</p>

<p><span concordion:set="#num">-5</span>
is <span concordion:assertFalse="isPositive(#num)">is not positive</span>
</p>

<p><span concordion:set="#num">6</span>
is <span concordion:assertFalse="isPositive(#num)">is not positive</span>
</p>

is run with a fixture that performs the arithmetical operations, the logged events are:

Event
Set #num = '4.0'
Execute 'The square root of 4.0 is 2.0'
Success '2.0'
Set #num = '16.0'
Execute 'The square root of 16.0 is 3.0'
Failure expected:'3.0' actual:'4.0'
Set #num = '3'
Success 'is positive'
Set #num = '-4'
Failure expected:'is positive' actual:'== false'
Set #num = '-5'
Success 'is not positive'
Set #num = '6'
Failure expected:'is not positive' actual:'== true'

Other listeners

Command Listeners

Processing Listeners

See the processing listeners specification for examples.

Further Details