There is an application/script that will write files and create directories. Depending on what path it takes (error, success, parameters). How could this be tested in a more automated fashion? I use find and wc -l and bash and eyeballs currently to validate the expected outcome for a suite of tests. Are there tools that are used for this type of testing?

I do not have a framework available for mocking i/o. Even with this though, mocking still is not quite the same.

2 Answers 2


Assuming this is on Linux you could run the program via strace and make it log the all open and opendir calls.

strace -e open,opendir command 

The program will run and whenever a file or directory is opened a log will be printed on stdout.

You can use this method to log any syscalls be adding them to the -e section.

You may need to add -f if the program forks or is loaded by a script.

If you want to mock IO there is a tool called FIO that will generate lots of different io patterns.

You could string it together with bats which provides a simple shell script based test framework


If your application assumes interactive input you can use expect program to supply parameters. Success can be checked by assessing $? special variable value, i.e. if it is 0 - previous command was successful, otherwise not.

If you are interested in metrics in terms of time taken or resources used - you can wrap your application in time command.

With regards to "framework" you can consider Apache JMeter which provides OS Process Sampler which can execute arbitrary commands and programs, evaluate output, measure time taken, run it with multiple users/threads, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.