Recipe 2Generate an RTF Report with a Custom Formatter

Problem

You need the results of your tests to be in a specific format that’s not one of the ones built into Cucumber. For instance, you might need everything typeset in a word processing document or sent to a network service.

Ingredients

  • A Ruby 1.9--compatible update to an old RTF generation library, called clbustos-rtf[16]

  • A word processor for viewing your report

Solution

In situations where you need a specific kind of output, you can write a custom formatter,[17] which is a simple Ruby class that generates the output format you need. All of Cucumber’s built-in formatters—such as HTML and PDF—use the same technique.

This recipe will show you how to write a formatter to generate a minimal ...

Get Cucumber Recipes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.