A full-featured BDD unit testing framework for bash, ksh, zsh, dash, and all POSIX shells.
ShellSpec is a behavior-driven development (BDD) unit testing framework built for shell scripting. It allows developers to write structured, readable tests for bash, ksh, zsh, dash, and other POSIX shells, solving the problem of unreliable and untested shell scripts in cross-platform environments.
Shell script developers, DevOps engineers, and system administrators who write or maintain cross-platform shell scripts and need a robust testing framework to ensure reliability.
Developers choose ShellSpec for its comprehensive feature set—including mocking, coverage, and parallel execution—coupled with a clean DSL that integrates seamlessly with shell syntax, making it the most modern and full-featured testing tool for POSIX shells.
A full-featured BDD unit testing framework for bash, ksh, zsh, dash and all POSIX shells
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports dash, bash, ksh, zsh, and all POSIX-compliant shells, with CI-tested workflows on Linux, macOS, Windows, and BSD systems, as shown by the extensive platform badges in the README.
Includes mocking, code coverage with kcov, parallel execution, parameterized tests, and sandbox mode, providing a comprehensive toolkit for shell script testing beyond basic assertions.
Offers a clean, readable syntax that integrates with shell script grammar, enabling behavior-driven tests without leaving the shell environment, as demonstrated in the tutorial examples.
Quick initialization with 'shellspec --init' creates necessary files like .shellspec and spec_helper.sh, lowering the barrier to entry for new projects.
Relies on kcov for code coverage and several POSIX commands (e.g., ps, od), which may not be available in all environments, adding setup complexity and potential portability issues.
The custom BDD syntax and advanced features like mocking and intercepts require learning curve for developers unfamiliar with behavior-driven testing or shell-specific frameworks.
Version 0.28.0 introduced breaking changes requiring a migration guide, indicating the framework is still maturing and may necessitate updates to existing test suites.