Parse Student Code
Often you just want to make sure students successfully used a particular function/command/structure. The simplest way I have found to do this is just parse the student's code file and make sure what you are looking for is there.
The following example looks for the for
keyword and checks that the student has used a for loop at least 1 time.
Note: You may want to add more logic to this code if you heavily rely on it. I have it check if the for is on a line with a comment or in a puts statement but technically there are other ways for students to pass the code by putting a for somewhere.
Grading Test:
Last updated