Bash and Test-Driven Development

前端 未结 8 1538
礼貌的吻别
礼貌的吻别 2020-12-04 15:33

When writing more than a trivial script in bash, I often wonder how to make the code testable.

It is typically hard to write tests for bash code, due to the fact tha

相关标签:
8条回答
  • 2020-12-04 16:15

    If you code a bash program large enough to require TDD, you are using the wrong language.

    I suggest you to read my previous post on best practices in bash programming, you will probably find something useful to make your bash program testable, but my statement above stays.

    Design patterns or best practices for shell scripts

    0 讨论(0)
  • 2020-12-04 16:15

    take a look at Outthentic framework - it is designed to create scenarios which runs any Bash code and then analyze the stdout using formal DSL, it's pretty easy to build any Tdd/blackbox tests suite upon this tool.

    0 讨论(0)
提交回复
热议问题