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
  • [Source Code (GitHub)][https://github.com/bats-core/bats-core]
  • [Documentation][https://bats-core.readthedocs.io/]

Published: October 23 2021

blog comments powered by Disqus