Does there exist an established standard for testing command line arguments? -


i developing command line utility has lot of flags. typical command looks this:

mycommand --foo=a --bar=b --jar=c --gnar=d --binks=e 

in cases, 'success' message printed still want verify against other sources external database ensure actual success.

i'm starting create integration tests , unsure of best way this. main concerns are:

  1. there many many flag combinations, how know combinations test? if math 10+ flags can used together...
  2. is necessary test permutations of flags?
  3. how build framework capable of automating tests , verifying results.
  4. how keep track of large number of flags , providing order easy tell combinations have been implemented , has not.

the thought of manually writing out individual cases , verifying results in unit-test format daunting.

does know of pattern can used automate type of test? perhaps software attempts solve problem? how did people working on gnu commandline tools test software?

i think specific application.

first, how determine success of execution of application? result code? printed console?

for question 2, depends how parse flags in application. of time, order of flags isn't important, there cases is. hope don't need test permutations of flags, because add lot of cases test.

in general case, should analyse impact of each flag. possible flag doesn't interfere others, , need tested once. case flags meant used alone (--help or --version, example). need analyse values should test each flag. usually, want try each kind of possible valid value, , each kind of possible invalid values.

i think simple bash script written perform tests, or scripting language, python. using nested loops, try, each flag, possibles values, including tests invalid values , case flag isn't set. produce multidimensional matrix of results, should analysed see if results conform expected.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -