Concordion > Commands > "run" >

Custom Runners

If you want to run tests that are not part of Concordion, you can write your own runner by implementing the org.concordion.api.Runner interface.

Using Full Class Name

You tell Concordion to use your alternative runner by specifying the full name of your runner class:

Example

<a concordion:run="com.example.MyRunner" href="link">link text</a>

Using Aliases (Recommended)

Using a full class name in the instrumentation can be less future-proof, so, instead, you can use an alias specified as a System parameter (concordion.runner.alias = full-class-name).

Example

Include the following command-line parameter for the JVM:

-Dconcordion.runner.myRunner = com.example.MyRunner

Then use the alias "myRunner":

<a concordion:run="myRunner" href="link">link text</a>

Worked Example

Given we have a custom runner (com.example.ExampleRunner) that returns the following results for different hrefs:

Href Matches Result to Return
Pass.* SUCCESS
Fail.* FAILURE
Except.* EXCEPTION
Ignore.* IGNORED
.* (No result. Throw an exception instead.)

And we've included an alias to it, on the JVM command-line:

-Dconcordion.runner.exampleRunner = com.example.ExampleRunner 

When we run the following instrumentation for different values of href:

<p>
   <a concordion:run="exampleRunner" href="href">My spec</a>
</p> 

We get the following outcomes:

Href Result Reported
PassingSpec.html SUCCESS
FailingSpec.html FAILURE
ExceptionSpec.html FAILURE
IgnoredSpec.html IGNORED
XXX.html EXCEPTION

Note that if the test runner returns a RunnerResult containing an exception this is reported as a failure, not as an exception. An exception is only reported if the runner itself throws an exception.