Originally, I wrote this script because I was teaching an exam prep class of 30 students. They had to do practice tests just about every week, and the school would ask for their marks almost immediately after each session. Fortunately, this was during the lockdown, and the class was online, so the students had to submit their answers in writing. The tests for receptive skills (Reading and Listening) were almost exclusively multiple choice, so I was able to script the process more or less easily. Later, when in similar situations, I would go back to the original script and make edits or additions, trying to make it more flexible and more portable, which served as a learning exercise as well.
One day, when teaching a different exam prep class, I went looking for my script, only to find that I must have accidentally deleted it. So I decided to rewrite it from memory (and hopefully improve it in the process). In they year or so since first writing this shell script, I had learned a few things about test-driven development, so I took this opportunity to try out the bats testing framework as well.