2. Extension Attributes

XML Calabash supports several extension attributes.

2.1. cx:depends-on

The cx:depends-on attribute provides finer grained control over the dependencies between steps. Consider the following example:

Because step “C” depends on steps “A” and “B”, you can be sure that step “C” will run after “A” and “B”. (If Calabash was a multi-threaded, streaming implementation, the constraint would be weaker.) But what about steps “A” and “B”?

Because neither step depends (directly or indirectly) on the output of the other, there is no guarantee about the order in which they will be evaluated.

If step “B” relies on some side effect of step “A” (perhaps “A” calls a web service or writes a document to disk and “B” relies on this having already happened for its correct operation), then you need a way to force the ordering.

It's best if this can be accomplished by establishing an input/output dependency, reading an output of “A” in the evaluation of “B”.

However, if you can't easily arrange an input/output dependency and you're not concerned about introducing an implementation dependency into your pipeline, you can establish the relationship directly by adding

cx:depends="A"

as an extension attribute on “B”. That informs XML Calabash that the evaluation of “A” must precede the evaluation of “B”. The value of cx:depends is a space-separated list of step names.

It is an error if the use of cx:depends introduces a circular dependency into the pipeline.

2.2. cx:message

As of version 1.1.11, you can add a cx:message attribute to any step. The message will be printed when the step begins running.

2.3. cx:logstyle

The cx:logstyle attribute can only be used on the p:log element. It controls how the logged document(s) will be written. There are four options:

plain

Document(s) will be written to the specified file, one after another with no separation. The resulting file will not be well-formed XML if more than one document is logged.

wrapped

The specified file will contain a px:document-sequence. Each document written will be wrapped in a px:document element. The resulting file will be well-formed XML.

directory

The specified location must be a directory. Each logged document will be written to its own file.

off

Does nothing. This is the equivalent of removing the p:log element.