I would like to test/fuzz my program, aba.py, which in several places asks for user input via the input() function. I have a file, test.txt, with the sample user inputs (1,000+) with each input on a new line. I wish to run the program with these inputs passed to the aba.py and record the response i.e. what it prints out and if an error is raised. I started to solve this with:
os.system("aba.py < test.txt")
This is only a half solution as it runs until an error is encountered and doesn't record the response in a separate file. What would be the best solution to this problem? Thank you for your help.
bash$ python aba.py < test.txt > output.txt 2> errors.txtnot work? If in python is a requirement, then you should try usingsubprocess(docs.python.org/3/library/subprocess.html) instead ofos.system, which lets youcheck_output