commander

module
v1.0.0 Latest Latest
Warning

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

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

README

Build Status Go Report Card Maintainability Test Coverage Github All Releases

Commander

Commander is an alternative to bats and gotest.tools/icmd for testing cli apps.

  • It runs on windows, osx and linux
  • It is a self-contained binary - no need to install a heavy lib or language
  • It is easy and fast to write

asciicast

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

Installation

Linux and 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
     add      Automatically add a test to your 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

Misc

Heavily inspired by goss.

Similar projects:

Directories

Path Synopsis
cmd
commander command
pkg
app
cmd

Jump to

Keyboard shortcuts

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