Index

bats

install
sudo apt install bats
running tests
bats [file]

syntax

simple test case testing script output
@test "verify script output" {
  result="$(sh [script] [args])"
  [ "$result" = "[expectation]" ]
}
test for exit code and message
@test "verify exit code and message" {
  run sh [script] [args]
  [ "$status" -eq 1 ]
  [ "$output" = "[expectation]" ]
}

documentation

https://github.com/sstephenson/bats