Unit Testing bash scripts

nimcap picture nimcap · Aug 27, 2009 · Viewed 75.4k times · Source

We have a system that has some bash scripts running besides Java code. Since we are trying to Test Everything That Could Possibly Break, and those bash scripts may break, we want to test them.

The problem is it is hard to test bash scripts.

Is there a way or a best practice to test bash scripts? Or should we quit using bash scripts and look for alternative solutions that are testable?

Answer

ire_and_curses picture ire_and_curses · Aug 27, 2009

There is actually a shunit2, an xUnit based unit test framework for Bourne based shell scripts. I haven't used it myself, but it might be worth checking out.

Similar questions have been asked before: