Index: modules/simpletest/simpletest.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.pages.inc,v
retrieving revision 1.31
diff -u -r1.31 simpletest.pages.inc
--- modules/simpletest/simpletest.pages.inc	24 Jul 2010 17:28:26 -0000	1.31
+++ modules/simpletest/simpletest.pages.inc	17 Oct 2010 16:44:05 -0000
@@ -225,6 +225,7 @@
   $form['result'] = array(
     '#type' => 'fieldset',
     '#title' => t('Results'),
+    '#title_tag' => simpletest_tag(),
   );
   $form['result']['summary'] = $summary = array(
     '#theme' => 'simpletest_result_summary',
@@ -245,6 +246,7 @@
       '#title' => $info['name'],
       '#description' => $info['description'],
       '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
     );
     $form['result']['results'][$group]['summary'] = $summary;
     $group_summary = &$form['result']['results'][$group]['summary'];
@@ -252,8 +254,9 @@
     // Create table of assertions for the group.
     $rows = array();
     foreach ($assertions as $assertion) {
+      $ok = ($assertion->status != 'fail' && $assertion->status != 'exception');
       $row = array();
-      $row[] = $assertion->message;
+      $row[] = ($ok ? '' : simpletest_tag(TRUE)) . $assertion->message;
       $row[] = $assertion->message_group;
       $row[] = basename($assertion->file);
       $row[] = $assertion->line;
@@ -277,14 +280,20 @@
 
     // Set summary information.
     $group_summary['#ok'] = $group_summary['#fail'] + $group_summary['#exception'] == 0;
-    $form['result']['results'][$group]['#collapsed'] = $group_summary['#ok'];
+    if (!$group_summary['#ok']) {
+      $form['result']['results'][$group]['#collapsed'] = FALSE;
+      $form['result']['results'][$group]['#suffix'] = simpletest_tag();
+    }
 
     // Store test group (class) as for use in filter.
     $filter[$group_summary['#ok'] ? 'pass' : 'fail'][] = $group;
   }
 
-  // Overal summary status.
+  // Overall summary status.
   $form['result']['summary']['#ok'] = $form['result']['summary']['#fail'] + $form['result']['summary']['#exception'] == 0;
+  if (!$form['result']['summary']['#ok']) {
+    $form['result']['#title'] = $form['result']['#title_tag'] . $form['result']['#title'];
+  }
 
   // Actions.
   $form['#action'] = url('admin/config/development/testing/results/re-run');
@@ -335,6 +344,19 @@
 }
 
 /**
+ * Return a 'next error' link, i.e. an <a> tag with id and href to the next tag.
+ *
+ * @param $adjust = FALSE
+ *   When the tag is placed into a table row, its position needs to be adjusted
+ *   so that the floating table header does not obscure the row.
+ */
+function simpletest_tag($adjust = FALSE)
+{
+  static $id = 0;
+  return '<a id="jump-' . $id . '" href="#jump-' . (++$id) . '" style="position: relative; left: ' . ($adjust ? '-1.8em' : '-1em') . '; top: ' . ($adjust ? '-4em' : '0') . ';">&#9660;</a>';
+}
+
+/**
  * Re-run the tests that match the filter.
  */
 function simpletest_result_form_submit($form, &$form_state) {
