- summary General information regarding the shUnit2 project.
- labels Featured
<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_
* [http://www.cygwin.com/ Cygwin] (under Microsoft Windows XP) * [http://www.freebsd.org/ FreeBSD] (user supported) * Linux ([http://www.ubuntu.com/ Ubuntu]) * [http://www.apple.com/macosx/ Mac OS X] * [http://www.sun.com/software/solaris/ Solaris] 8-10 and [http://www.opensolaris.org/ OpenSolaris]
_Tested Shells_
* Bourne Shell (*`sh`*) * [http://www.gnu.org/software/bash/ BASH] – GNU Bourne Again SHell (*`bash`*) * [http://gondor.apana.org.au/~herbert/dash/ DASH] (*`dash`*) * [http://www.kornshell.com/ Korn Shell] (*`ksh`*) * [http://web.cs.mun.ca/~michael/pdksh/ pdksh] – the Public Domain Korn Shell (*`pdksh`*) * [http://www.zsh.org/ 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.
|| *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 ||
|| *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.
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.
* `mkdir_test.sh` – demonstration of testing an existing Unix command (e.g. an already written shell script)
A shunit2-users@googlegroups.com 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.