samedi 18 juillet 2015

How to test command line arguments processing

I have a Scala program that receives command line arguments using Argot. A simplified use case would be something like:

sbt "run -n 300 -n 50"

And imagine that the app should only accept (and print) numbers between 0 and 100, meaning it should discard 300 and print only 50.

What's the best approach to test it? Is unit testing appropriated? Instead of processing the arguments in the mainmaybe I should refactor a function and test the function?

Aucun commentaire:

Enregistrer un commentaire