Next: , Previous: What does black-box mean?, Up: Black-box tests

2.2.2 How do I write a black-box test?

Writing a black-box test is very easy.

1) Run your program with the normal command line flags on an input audio file. I would suggest to use one of the files in the marsyas/src/tests/black-box/input directory if possible. To test the waveform generation functionality of sound2png I ran it with the following flags:

     sound2png -m waveform marsyas/src/tests/black-box/input/right.wav waveform.png

2) Copy the output file to the marsyas/src/tests/black-box/output directory

     cp waveform.png marsyas/src/tests/black-box/output

3) Add a section to marsyas/src/tests/black-box/CMakeLists.txt for your new test:

     set( ARGUMENTS
     	-m waveform
     black-box_explicit(sound2png_waveform right.wav waveform.png sound2png "${ARGUMENTS}")

The first section “ARGUMENTS” are where you should put all the command line arguments for your program. “black-box_explicit” is a test MACRO that we've written to help make it easy to write tests like this, and it takes 5 arguments:


REG_NAME is the name of your test. Each test must be named differently, if not, the duplicate tests won't be run.

REG_INPUT is the input file for your test. In our case this was “right.wav”

REG_OUTPUT is the output file for your test. In our case this was “waveform.png”

REG_COMMAND is the command to run, “sound2png” in this example.

REG_ARGS are the command line arguments to REG_COMMAND.