imedo Development Blog

there is no charge for awesomeness

Archive for the ‘output formatter’ tag

CI output formatter update for Cucumber 0.3.9x

without comments

In the 0.3.9x releases of Cucumber the output generation has been changed in a way which prevents our output formatter from marking scenarios with undefined steps as pending.

Here’s the updated code: imedo_ci_formatter.rb

Popularity: 1% [?]

Written by ehartung

August 10th, 2009 at 3:47 pm

CI output formatter for Cucumber 0.3

without comments

Not long ago we presented our output formatter for Cucumber (see Cucumber output formatter for continuous integration ). Meanwhile Cucumber 0.2 and 0.3 have been released and the API for output formatters has been changed, so that it was necessary to upgrade our formatter for feature tests on continuous-integration systems.

Here is the code. For information on using it see Cucumber output formatter for continuous integration or the Cucumber wiki.

The code:imedo_ci_formatter.rb

Popularity: 1% [?]

Written by ehartung

April 28th, 2009 at 4:26 pm

Cucumber output formatter for continuous integration

without comments

After presenting a way of analyzing the features of a web application and determining the to-be value for feature tests (see model-driven feature testing) here is a little piece of code that may help you with the controlling of your feature tests.

We are using Cucumber to run our feature tests and in order to have up-to-date test results for our latest code we created a task in our continuous integration system which runs all feature tests once a day.

The only problem was that the output formatters included in Cucumber do not give much information about the results of the scenarios. But these are the numbers we are interested in since scenarios are the actual feature tests. Hence we wrote our own output formatter. It evaluates the executed scenarios and not the steps and it dismisses the fancy colors since it is meant to be used with a continuous integration sytem which only knows black and white.

To use our output formatter save it in features/support/ and run it by adding the format option to the Cucumber command line, e.g.:


CUCUMBER_OPTS="--format ImedoCiFormatter" cucumber features/

Below is the source code for our Cucumber output formatter. It first initializes arrays for error messages, passed scenarios, failed scenarios, and pending scenarios as well as flags to mark scenarios as failed or pending. When executing a feature the name of this feature is printed out. Afterwards all of its scenarios are executed. Therefore each scenario is checked whether it contains steps when it is started. If not, the scenario is marked as pending. If it does contain steps, they are executed.

In case one step failed the current scenario is marked as failed and the error message ist stored. If one step is pending the whole scenario is marked as pending, too.
At the end of each scenario the result is evaluated and printed out.

After all feature tests have been executed the pending scenarios, error messages, and stats of feature tests are dumped in a summary.

The code: imedo_ci_formatter.rb

Popularity: 1% [?]

Written by ehartung

April 16th, 2009 at 2:00 pm