diff --git a/questiontestform.php b/questiontestform.php
index 18fecd66a9f6426c7bf43a3440e4c367e4fbdad7..be987c4d85c588707e08d2452b39373ab61afc70 100644
--- a/questiontestform.php
+++ b/questiontestform.php
@@ -105,9 +105,15 @@ class qtype_stack_question_test_form extends moodleform {
         foreach ($question->prts as $prtname => $prt) {
             $result = $question->get_prt_result($prtname, $response, false);
             $answernotes = $result->get_answernotes();
+            // In automatic test case generation set penalties as the default unless they differ.
+            // If they are the same as the detault, and you want this, you can change it later.
+            $prtpenalty = $result->get_penalty();
+            if ($prtpenalty == $question->penalty) {
+                $prtpenalty = '';
+            }
             $mform->getElement($prtname . 'group')->setValue(array(
                     $prtname . 'score'      => $result->get_score(),
-                    $prtname . 'penalty'    => $result->get_penalty(),
+                    $prtname . 'penalty'    => $prtpenalty,
                     $prtname . 'answernote' => end($answernotes)));
         }
     }