shunit2

Unit testing framework for Bourne-based shell scripts

brewmacoslinux
Try with needOr install directly
Source

About

Unit testing framework for Bourne-based shell scripts

Commands

shunit2

Examples

Create a basic shell script test file$ cat > test_math.sh << 'EOF' #!/bin/bash source shunit2 testAdd() { result=$((2 + 2)) assertEquals 4 $result } . shunit2 EOF
Run tests from a shell script test file$ bash test_math.sh
Test a function with assertion$ cat > test_strings.sh << 'EOF' #!/bin/bash source shunit2 testStringEquals() { str="hello" assertEquals "hello" "$str" } . shunit2 EOF bash test_strings.sh