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
Try bashtest. It`s simple way to test your scripts. For example, you have do-some-work.sh which change some config files. For example, add new line PASSWORD = 'XXXXX' to config file /etc/my.cfg.
You write bash commands line by line and then check output.
Install:
pip3 install bashtest
Create tests is a just writing bash commands.
File test-do-some-work.bashtest:
# run the script
$ ./do-some-work.sh > /dev/null
# testing that the line "PASSWORD = 'XXXXX'" is in the file /etc/my.cfg
$ grep -Fxq "PASSWORD = 'XXXXX'" /etc/my.cfg && echo "YES"
YES
Run tests:
bashtest *.bashtest
You can find some examples here and here