Bash_unit – bash unit testing framework

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • bash_unit

    bash unit testing enterprise edition framework for professionals

  • git-pretty-pull-request

  • I used bats a while ago to test a homemade CLI to open github pull-requests, it worked well enough for me (https://github.com/williamdclt/git-pretty-pull-request if you're looking for an example, although I did not maintain the tests out of laziness so they are very red).

    Cannot compare it to bash_unit, but I'm happy there's alternatives!

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • shellspec

    A full-featured BDD unit testing framework for bash, ksh, zsh, dash and all POSIX shells

  • If you fancy more BDD-style testing with a Gherkin-like syntax, there is also Shellspec https://shellspec.info / https://github.com/shellspec/shellspec

  • sharness

    Shell library to test your tools like Git does

  • The definition of a unit in the context of this framework doesn't seem to be some internal interface but rather whatever can be expressed externally via the CLI.

    Projects that make use of this kind of testing include git[1], Donenfeld's pass[2], and anything else that uses sharness[3].

    [1]: https://git.kernel.org/pub/scm/git/git.git/tree/t

    [2]: https://git.zx2c4.com/password-store/tree/tests

    [3]: https://github.com/chriscool/sharness#projects-using-sharnes...

  • babashka

    Native, fast starting Clojure interpreter for scripting

  • In a similar vein, there's also babashka for these "bash+" use-cases: https://github.com/babashka/babashka

  • bash-specs

    A BDD testing framework for Bash inspired by Jasmine and roundup.

  • I've built a Bash testing framework myself, and my realization was that Bash is a bad language for this.

    https://github.com/helpermethod/bash-specs

  • Install-SqlServer

    Powershell script to install MS SQL Server unattended

  • We have tones of PowerShell and it works like a charm, although we have some experienced posh devs

    We also test REST backend in PowerShell using Pester.

    PowerShell is preferred in this house because

    a) you can run it on any Windows OS on the spot and modify it in ad hoc manner, you can even debug it with breakpoints etc easily Also our Linux machines have it.

    b) its powerful, you can do anything in it with few lines of code (one case: we did 10 million SOAP requests per day for entire country)

    c) many Windows toolsets use it like SqlServer, IIS etc. which makes management way easier (for example we use [1] to install sql server on all dev/prod machines)

    d) we find it way easier to keep CI/CD vars in PowerShell hashtables then in yaml, so our yaml fiels are one liners and everything works locally.

    ---

    [1] https://github.com/majkinetor/Install-SqlServer

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • au-packages

    Chocolatey packages by majkinetor

  • I am only using chocolatey to install stuff and I regularly create packages for it. I worked hard to make what I need stable and not depend on their existence - [2] for examples releases packages on GH and there is a handy script to install from there. I also created AU for it [3] and managed to convince people to embed software in packages so packages always work (you can cache them on your own via file system, artifactory, nexus etc). You can also host your own gallery in number of different ways. So, in short, there is escape plan. TBH, it looks like choco is going better then ever. And you can't simply find any better repository for sw, its better and more up to date then most linux package repos (on par with Arch).

    > I am not that into the way MS is doing the winget thing,

    That is years away IMO, no scripting there too, and it moves like a snail. I would really be embarrassed if I were leading that team.

    > I see a lot of manual scripts for installing things on Windows CI systems

    Yeah, most people suck, like their scripts :-) There is literary 0 chance for you to make reliable installation script in general that works in any context.

    > I really like chocolatey but I am worried it will disappear soon.

    Just use it. I don't work for them. I maintain core team repo [2]. Its great tool now. What will happen tomorrow nobody knows but like I said, you have escape plan and even if they go down your CI will still work for decades if you want if you set it up properly.

    ---

    [1] https://github.com/majkinetor/au-packages

    [2] https://github.com/chocolatey-community/chocolatey-coreteamp...

    [3] https://github.com/majkinetor/au

  • ShellCheck

    ShellCheck, a static analysis tool for shell scripts

  • > I am not aware that ShellCheck actually checks POSIX compliance; I am pretty sure it just checks for common errors in your bash/sh scripts

    Bashisms are errors if you specify #!/bin/sh. If you want to try it out, you can load random examples on https://www.shellcheck.net/ until you get a #!/bin/sh. Then you'll get warnings such as "SC3010: In POSIX sh, [[ ]] is undefined."

    To go back to the discussion: if you want to use Bash features, you're better off switching to Python.

  • bashcov

    Code coverage tool for Bash

  • I have successfully used https://github.com/infertux/bashcov in the past.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts