commander

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2019 License: MIT

README

Build Status Go Report Card Maintainability Test Coverage Github All Releases

Commander

Define YAML based test suites for your command line applications.

Quick start

  • Install commander and add it to your path environment variable
  • Create a commander.yaml in your project root
  • Add a minimal test
  • Run ./commander test

For more information take a look at the manual, the examples or the integration tests.

Installation

Linux & osx
# Install latest version to /usr/local/bin
curl -fsSL https://raw.githubusercontent.com/SimonBaeumer/commander/master/install.sh | sh

# Install v0.1.0 version to ~/bin
curl -fsSL https://raw.githubusercontent.com/SimonBaeumer/commander/master/install.sh | COMMANDER_VER=v0.1.0 COMMANDER_DST=~/bin sh
Windows
  • Download the current release
  • Add the path to your path environment variable
  • Test it: commander --version

Example

You can find more examples in examples/

# Build the project
$ make build

# Execute test suite
Starting test file examples/commander.yaml...

✓ it should print hello world
✓ echo hello
✓ it should validate exit code
✓ it should fail

Duration: 0.005s
Count: 4, Failed: 0

Minimal test

tests:
    echo hello:
        stdout: hello
        exit-code: 0

Usage

NAME:
   Commander - CLI app testing

USAGE:
   commander [global options] command [command options] [arguments...]

COMMANDS:
     test     Execute the test suite
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Development

# Initialise dev env
$ make init

# Build the project binary
$ make build

# Unit tests
$ make test

# Coverage
$ make test-coverage

# Integration tests
$ make test-integration

# Add depdencies to vendor
$ make deps

Directories

Path Synopsis
cmd
commander command
pkg
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL