Writing a semi-public test? #844
-
Hi there! Pretty new to using otter-grader, but I wanted to write a test that my students could run in order to determine whether they got the answer correct or not, but without leaking the actual solution (this specific question asks a student to select all correct options from a list of 11 statements, and place all correct options in an array). My initial stab at the test looked something like: // Check if the hash of answer_5a matches the correct hash student_hash == correct_hash However, I found that when the student answers incorrectly, it'll actually show the contents of the test, line by line. My next try looked something like this: import hashlib student_hash == correct_hash I also added one other test checking to see if the type of the answer was a numpy array. Is this the best way to write semi-public tests? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, this is probably the best way to write public tests that check for correctness without giving away the answer. Since the public test files are available to students (even if the output of the test failure didn't print their contents), hashing is the only way that I can think of to include the correct answer without revealing it. |
Beta Was this translation helpful? Give feedback.
Yes, this is probably the best way to write public tests that check for correctness without giving away the answer. Since the public test files are available to students (even if the output of the test failure didn't print their contents), hashing is the only way that I can think of to include the correct answer without revealing it.