Git mirror for shunit2 project
Switch branches/tags
Nothing to show
Clone or download
Latest commit d318d1b Oct 31, 2011

  1. summary General information regarding the shUnit2 project.
  2. labels Featured

Table of Contents

Project Info

<wiki:toc max_depth="2"></wiki:toc>


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.

shUnit2 was originally developed to provide a consistent testing solution for log4sh, a shell based logging framework similar to log4j. During the development of that product, I repeatedly ran into the problem of having things work just fine under one shell (`/bin/bash` on Linux to be specific), and then not working under another shell (`/bin/sh` on Solaris). Although I had some simple tests that I ran, I finally decided to develop a more robust unit test framework after releasing multiple brown-bag releases.

Rather than reinvent the wheel again, I chose to base the shUnit2 framework as much as possible on JUnit. I wanted something that was both incredibly easy to use, but that was as well incredibly powerful. I knew that the code would be built only for log4sh at the start, but hoped that someday I could release the code as a separate project. Now that the code is stable and mature enough, I have done just that.

You might ask why I didn't just use the already existing ShUnit product. I took a look at it, but wasn't really happy with how it worked or how little it reflected the way JUnit and other unit test frameworks function. As such, I figured that it was probably better just to write my own.

shUnit2 has been developed under the Bourne Again Shell (`/bin/bash`) on Linux, but _great care_ has been taken to make sure it works under the other Unix shells to insure maximum compatibility. If you like what you see, or have any suggestions on improvements, please feel free to drop me an email.

_Supported Operating Systems_

  * [ Cygwin] (under Microsoft Windows XP)
  * [ FreeBSD] (user supported)
  * Linux ([ Ubuntu])
  * [ Mac OS X]
  * [ Solaris] 8-10 and [ OpenSolaris]

_Tested Shells_

  * Bourne Shell (*`sh`*)
  * [ BASH] – GNU Bourne Again SHell (*`bash`*)
  * [ DASH] (*`dash`*)
  * [ Korn Shell] (*`ksh`*)
  * [ pdksh] – the Public Domain Korn Shell (*`pdksh`*)
  * [ Zsh] - (*`zsh`*)


There are two current release series of shUnit2 available. The 2.0 series is the stable release, and it contains only bug fixes. The 2.1 series is meant for new features and is still under active development. The 2.1 series of shUnit2 has its own set of unit tests, and should be considered fine for daily use.

If you would like to verify the GPG signatures of the releases, please take a look at my GnuPG Info page.

2.0.x - Stable Releases

|| *Release* || *Date* || || 2.0.3 || Thu Jul 12 2007 || || 2.0.2 || Mon Apr 23 2007 || || 2.0.1 || Wed Feb 21 2007 || || 2.0.0 || Mon Feb 19 2007 ||

2.1.x - Development Releases

|| *Release* || *Date* || *Known Issues* || || 2.1.6 || Sun May 1 2011 || || || 2.1.5 || Wed Oct 29 2008 || || || 2.1.4 || Fri Jul 11 2008 || || || 2.1.3 || Sun May 10 2008 || Doesn't work with *`zsh`* versions prior to 4.0. || || 2.1.2 || Mon Dec 31 2007 || || || 2.1.1 || Fri Jul 13 2007 || || || 2.1.0 || Mon Apr 23 2007 || ||



HTML documentation is also included in the `doc` directory of each distribution. Links to the latest version in Subversion are provided below.

2.0 · 2.1

You might also be interested in our GeneralFaq page.


One case study for writing a function to convert a relative path to an absolute path (HOWTO_TestAbsolutePathFn).

Starting with the 2.1.x series, additional examples are included with the source code in the `examples` directory.

  * `` – demonstration of testing an existing Unix command (e.g. an already written shell script)

Mailing Lists

A mailing list now exists. Everyone is free to view the discussions or to subscribe.



shUnit2 is licensed under the GNU Lesser General Public License (LGPL). The contents and copyright of this site and all provided source code are owned by Kate Ward.


A list of contributors is provided with each release (found as `doc/contributors.txt`). Many thanks go out to each of these individuals for finding bugs and/or providing patches.

Hosting resources are gracefully provided by Google Code.