Unit test a command line interface of an escript

I am writing a very basic escript.

I have no idea how to test the arguments parsing though, I never did it in any language.

Would anyone have some hint or could point me to some docs?

Is mocking stdout and stderr an option?

Thank you.

1 Like

There are two kind of tests,

  • smoke tests
  • API tests

smoke tests could be expensive to run, but still useful to have a few, and if your application is not that big it is not that much of a big deal, but they are expesive because you need to start the app for every test.

Here are a few examples.

In Elixir and Mix you can find smoke tests if you look for the word “smoke”.