Concordion > Extension >

ImplementationStatusModifier

An ImplementationStatusModifier allows a user to specify an example's ImplementationStatus at runtime. The status modifier can be injected via the concordion extensions. If provided, it will override a declared implementation status via c:status attribute. The user can create the conditional logic based on the example element (usually a <div>).

Example

An ImplementationStatusModifier is installed that sets the status of an example to IGNORED if the example name ends in Ignored, a @BeforeExample annotated fixture method which saves the example names in a list, and a @AfterExample annotated fixture method which saves the example names in a different list.

Running a specification containing:

<div concordion:example="aPassingExample">
    <span concordion:set="#char">a</span> == <span concordion:assert-equals="#char">a</span>
</div>
<div concordion:example="aFailingExample">
    <span concordion:set="#char">a</span> == <span concordion:assert-equals="#char">b</span>
</div>
<div concordion:example="expectedToFailExample" concordion:status="ExpectedToFail">
    <span concordion:set="#char">c</span> == <span concordion:assert-equals="#char">d</span>
</div>
<div concordion:example="expectedToFailExampleButIgnored" concordion:status="ExpectedToFail">
    <span concordion:set="#char">a</span> == <span concordion:assert-equals="#char">b</span>
</div>

Would result in

Example names which executed @BeforeExample method: [[Outer], aPassingExample, aFailingExample, expectedToFailExample]

Example names which executed @AfterExample method: [aPassingExample, aFailingExample, expectedToFailExample] (Note that although the @AfterExample annotated method was also called for [Outer] example this concordion assertion was evaluated prior to that call that's why it is not included in the list)