shunit2 unitfile


shUnit2 is a xUnit unit test framework for Bourne based shell scripts, and it is designed to work in a similar manner to JUnit, PyUnit, etc.. If you have ever had the desire to write a unit test for a shell script, shUnit2 can do the job.

You can either run shunit2 directly from the commandline and specify the unit file or directly source the shunit2 executable.

If you directly execute shunit2 and don\(cqt specify a unitfile shunit2 assumes a empty testfile and will return without an error message.


Simple script to test if 1 equals 1

#! /bin/sh
  assertEquals 1 1

# load shunit2
. shunit2

Execute shUnit2 unit tests directly from the commandline

shunit2 /path/to/unit/file


shunit2 does not support any commandline options at all. You can either source shunit2 to execute your unit tests or directly run shunit2 as a commandline script.

RELATED TO shunit2…

For more information see or have a look at the installed documentation in /usr/share/doc/shunit2/


shunit2 was written by Kate Ward <[email protected]>. This manpage was written by Ulrich Dangel <[email protected]>.