I see in the documentation the following sentence: Additionally, if you check the Template debugging checkbox you will get to see in the output web page each of the complete programs that gets run during a question submission.
What does "to see in the output web page each of the complete programs"?
What is the debugging model for grading templates? For example I have marked "Template debugging" to TRUE.
But when I try to "check" the question, I get only the error in red saying that: Your code must pass to earn any marks, try again.
I don't see any debug information anywhere.
I wondered whether the "Check" button might do something different than "Save changes" button.
So I attached a file to the answer on the question editing page, and clicked on "Validate on save".
Unfortunately I still don't see any debugging information anywhere. In fact the message in red indicates that the test failed, and that for more detailed information I should save the question with "Validate on save" unchecked and test manually.
It is not at all clear to me how to rest manually, since I haven't yet figured out what is being run. That's basically what I'm trying to debug.
"Debugging a template" means debugging the code that processes and grades the student answer. You would use it when you were trying to work out what was going wrong in that processing/marking.
When you click that 'Template debugging' option in the template question authoring form, then save the question, then preview+put in answer+click check you will see the code that is actually going to be run 'under the hood' to mark the student's response.
In particular, you see that code after the TWIG stuff has happened (ie, instead of seeing the TWIG placeholders for the student answer, test code, etc, you see what has been put in for those placeholders).
I suggest that the best way to see what should be happening, in general, is to take one of the built-in question types, make a question based on that type (or use an example one from the provided examples in the docs), click the customise box to customise that individual question and then click for template debugging and untick validate on save. Then save the question, preview it, put in some kind of answer, and click check.
As I say, that will show you what you could expect to see (based on that particular question type) and that might help you in working out why you are not seeing something equivalent for your particular question.
Thanks Jenny, that's helpful information. I don't know what you mean by prievew+put etc.
What do you mean exactly by:
you will see the code that is actually going to be run 'under the hood' to mark the student's response.Where should I see this? Is it in a popup window? Should it appear in the red region which says: Your code must pass all tests... ? Or does it appear in a link somewhere which I need to click on?
HI Jenny, do I understand correctly that debugging a template only means to see the twig output which is expected to see a valid python program. Moreover, debugging is not intended to show me the stdout and stderr of actually running that python program in the specially prepared directory with the specially prepared environment?
What I'd like to figure out is what does the python script (output by twig) do when run in the directory containing the student's submitted file. The suggestion that I "save the message with 'Validate on save' unchecked and test manually", doesn't really help me figure out what I need to know, as far as I can understand. Am I missing something crucial?
I found this Preview link. Is this the link I should use to get the debug feedback?
"I found this preview link. Is this the link I should use to get the debug feedback?" Yes, this is one of the ways to preview a Moodle quiz question (any type, not just CodeRunner). You can preview an individual question from the question bank (there will be a preview icon beside the question name) or using the 'Preview' link at the end of the question authoring form.
"What controls whether debugging is enabled". As far as I know, all that is necessary to be able to see the template debugging I described is to click that 'template deugging' box in the question authoring form and save the question with that box ticked. The actual template debugging output will be shown above the results table when you preview, answer and check the question.
I found that I gained a good understanding of how template debugging worked by trying it on a simple question using one of the built-in question prototypes. I hope that doing that helps you to answer your other template debugging questions:) Best of luck with your project!