lundi 11 juillet 2016

How to Use `bats-mock` to Assert Against Calls to a Mocked Script in Bash Testing

I'm trying to use bats to test some critical shell scripts in a project I'm working on. I'd like to be able to mock scripts out in order to assert that a script calls another script with the correct arguments in a given situation. The bats-mock library seems like it should do the trick, but it hasn't been documented at all.

I've tried looking at the bats-mock code and several test helper scripts other people have created (like this one), but unfortunately I'm not comfortable enough with bash to be able to deduce how to correctly use the bats-mock library.

How can I use the bats-mock library to mock out a script and assert against calls to the mock?

Aucun commentaire:

Enregistrer un commentaire