Skip to content

mrtazz/minibashtest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minibashtest

Build Status Packagecloud Code Climate MIT license

Overview

This is the most simple unit testing framework I could come up with. The intention here is to serve as an example of how easy it can be to get started with unit testing, even for something like bash that traditionally has less of a unit testing culture. It's heavily inspired by minunit.

Usage

#!/usr/bin/env bash

source 'minibashtest.sh'

function test_one_is_one {
  assert "[ 1 -eq 1 ]" "failed to assert that 1 equals 1"
}

function test_one_is_not_two {
  assert "[ 1 -neq 2 ]" "failed to assert that 1 is not 2"
}

run_test_suite

Setup/TearDown

If you define functions called setup or tear_down, they will be called before and after each test function respectively.

Advanced Testing

Fortunately a lot of people have given unit testing in bash some thoughts in the past. So if you want something more than just basic assertions, check thosse out:

About

simplest unit testing framework for bash

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published