/rcomp

Simple output testing for command line applications

Primary LanguageRubyMIT LicenseMIT

RComp Code Climate Build Status

RComp is a simple framework for testing command line application output. It works by passing a specified command tests (files) by argument and comparing the result with expected output.

Installation

$ gem install rcomp

Usage

$ rcomp
Tasks:
  rcomp generate     # Generate expected output for all tests
  rcomp help [TASK]  # Describe available tasks or one specific task
  rcomp init         # Setup rcomp test directory
  rcomp test         # Run all tests
  rcomp version      # Prints RComp's version information

Setup

In your project root directory, run:

$ rcomp init

Then create some tests in rcomp/tests

Structure

After running rcomp init the following directories are created by default:

.
|--rcomp
|----tests
|----expected
|----results

tests

Stores test files. All subdirectories will be searched for tests.

expected

Stores the expected output of tests. Format is testname.out for stdout and testname.err for stderr.

results

Managed by RComp. Stores the results of your most recent test suite run.


A simple RComp suite might look like:

.
|--rcomp
|----tests
|------test1.test
|------dir
|--------test2.test
|----expected
|------test1.out
|------dir
|--------test2.out
|--------test2.err

Configuration

All custom configuration is stored in .rcomp as YAML

SettingConfigDefaultDescription
command command: [COMMAND] Command RComp will run tests with
directory directory: [DIRECTORY] rcomp Directory RComp will store tests, results and expected in
ignore ignore: - [PATTERN] List of patterns RComp will ignore when finding tests
timeout timeout: [TIMEOUT] 5 Test execution time limit (seconds)

Aliases

TaskAlias
test t
generate g
version -v--version

Copyright

Copyright (c) 2012 Chris Knadler. See LICENSE for details.