Chapter 16
Testing Command-Line Applications
with Aruba

Command-line applications are the bread and butter of many programming tasks. Any programmer is familiar with common command-line applications like ls/dir, cp/copy, and cd. If you are a Linux or OS X user, you probably use them a lot—ps and kill for process management; grep, sed, and awk for file manipulation; and so on. Even cucumber is a command-line application.

You have probably written a couple of command-line applications or scripts yourself. Even a Rake task is an example of a command-line script. A command-line application usually starts its life as a small script, but often it evolves into a more elaborate program. While many people end up testing the internal logic of a command-line application with unit tests, it is less common to test the whole stack of the application by interacting with it as a user would, through the command-line interface—the user interface of the application.

In this chapter, you’ll learn how a Cucumber plug-in called Aruba lets you test your own (and other people’s) command-line applications. Before we dive in, let’s first look at some characteristics that all command-line applications have in common.

Aslak says:
Aslak says:
How Aruba Was Born

The Aruba gem was born on the island of Aruba in the Caribbean while David Chelimsky (project lead for RSpec) and I were at a conference called SpeakerConf. Open source contributors get to go to warm places!

RSpec and Cucumber are both command-line applications themselves, and both projects have a set of Cucumber tests that their developers use when they’re working on the code. There were a lot of similarities between the two sets of Cucumber tests, so we extracted a library of common step definitions and called it Aruba. Both frameworks now use Aruba for their own acceptance tests.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.21.152