https://github.com/z0mbix/bash-command-test
Testing a bash command with bats
https://github.com/z0mbix/bash-command-test
Last synced: 5 days ago
JSON representation
Testing a bash command with bats
- Host: GitHub
- URL: https://github.com/z0mbix/bash-command-test
- Owner: z0mbix
- License: mit
- Created: 2017-07-13T22:58:06.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-13T22:59:06.000Z (almost 9 years ago)
- Last Synced: 2025-03-24T10:33:35.325Z (over 1 year ago)
- Language: Shell
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Testing a bash command
This is an experiment in how to best test a command written in bash using the [Bash Automated Testing System (bats)](https://github.com/sstephenson/bats) framework.
## Example usage
```
» ./bin/run -p common -e staging
profile: common
environment: staging
```
```
» ./bin/run -h
usage:
-e --> environment
-p --> profile
-h --> help
```
## Example test output
```
» bats tests
✓ Test usage exit status
✓ Test check_opts message
✓ Test check_opts message without environment
✓ Test check_opts message without profile
✓ Test check_opts message with all options set
✓ Test check_opts without flag arguments
6 tests, 0 failures
```