Unit Testing bash scripts

后端 未结 16 734
暖寄归人
暖寄归人 2020-11-30 18:51

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

16条回答
  •  囚心锁ツ
    2020-11-30 19:17

    I got the following answer from a discussion group:

    it's possible to import (include, whatever) a procedure (function, whatever it's named) from an external file. That's the key to writing a testing script: you break up your script into independent procedures that can then be imported into both your running script and your testing script, and then you have your running script be as simple as possible.

    This method is like dependency injection for scripts, and sounds reasonable. Avoiding bash scripts and using more testable and less obscure language is preferable.

提交回复
热议问题