How to programmatically take a quiz? I need to programmatically make some users take an existing quiz. The quiz has only one question, which is a long answer one, and I have the text needed to fill it. I just can't find any function in the Quiz module that I can call to submit the answer. Is it possible?
I found a way to solve that:

// Load user who will take the quiz
$account = user_load($quiz_taker_uid);
// Load quiz and question nodes
$quiz = node_load($quiz_nid);
$question = node_load($question_nid);
// Create a new result id
db_query("INSERT INTO {quiz_node_results} (nid, vid, uid, time_start) VALUES (%d, %d, %d, %d)", $quiz-&gt;nid, $quiz-&gt;vid, $account-&gt;uid, time());
$rid = db_last_insert_id('quiz_node_results', 'result_id');
// Submit the answer
$result = quiz_question_evaluate_question($question, $rid, $long_answer_text);
quiz_store_question_result($quiz, $result, array('set_msg' =&gt; FALSE));
// Finish the scoring and properly invoke hooks
$score = quiz_end_scoring($quiz, $rid);
quiz_end_actions($quiz, $rid, $score);