Bats

A TAP-compliant testing framework for Bash.

Usage

Write tests into *.bats files like:

#!/usr/bin/env bats

@test "addition using bc" {
  result="$(echo 2+2 | bc)"
  [ "$result" -eq 4 ]
}

Then run the test:

$ bats test.bats
 ✓ addition using bc

1 test, 0 failures

Published: October 23 2021

blog comments powered by Disqus