I'm not aware of any sample program that demonstrates all that you want to do. I use NI's TestStand to do things like you describe so if you want to avoid a lot of the headaches associated with creating your own test executive, I would recomend that you check it out.
OpenG was working on an open source test executive but I'm unsure of it's status. The basics of loading text files is pretty simple and you coud use Read From Spreadsheet File to create arrays of commands and responses. The difficult part is making your program flexible enough to handle the looping, pass/fail conditions, data logging, report generation, etc. and where you don't hve to modify the basic test exec when you have a new product. I got tired
of doing all of that and that's the main reason I use TestStand.