diff --git a/core/modules/simpletest/src/Form/SimpletestTestForm.php b/core/modules/simpletest/src/Form/SimpletestTestForm.php
index 92c8a54..8c933cb 100644
--- a/core/modules/simpletest/src/Form/SimpletestTestForm.php
+++ b/core/modules/simpletest/src/Form/SimpletestTestForm.php
@@ -105,27 +105,29 @@ public function buildForm(array $form, FormStateInterface $form_state) {
 
     // Generate the list of tests arranged by group.
     $groups = simpletest_test_get_all();
+    // Ensure no id collisions.
+    $i = 0;
+
     foreach ($groups as $group => $tests) {
       $form['tests'][$group] = array(
         '#attributes' => array('class' => array('simpletest-group')),
       );
 
-      // Make the class name safe for output on the page by replacing all
-      // non-word/decimal characters with a dash (-).
-      $group_class = 'module-' . strtolower(trim(preg_replace("/[^\w\d]/", "-", $group)));
+      // Create an identifier for this test group.
+      $group_id = 'module-' . $i++;
 
       // Override tableselect column with custom selector for this group.
       // This group-select-all checkbox is injected via JavaScript.
       $form['tests'][$group]['select'] = array(
         '#wrapper_attributes' => array(
-          'id' => $group_class,
+          'id' => $group_id,
           'class' => array('simpletest-group-select-all'),
         ),
       );
       $form['tests'][$group]['title'] = array(
         // Expand/collapse image.
-        '#prefix' => '<div class="simpletest-image" id="simpletest-test-group-' . $group_class . '"></div>',
-        '#markup' => '<label for="' . $group_class . '-group-select-all">' . $group . '</label>',
+        '#prefix' => '<div class="simpletest-image" id="simpletest-test-group-' . $group_id . '"></div>',
+        '#markup' => '<label for="' . $group_id . '-group-select-all">' . $group . '</label>',
         '#wrapper_attributes' => array(
           'class' => array('simpletest-group-label'),
         ),
@@ -140,7 +142,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
       // Cycle through each test within the current group.
       foreach ($tests as $class => $info) {
         $form['tests'][$class] = array(
-          '#attributes' => array('class' => array($group_class . '-test', 'js-hide')),
+          '#attributes' => array('class' => array($group_id . '-test', 'js-hide')),
         );
         $form['tests'][$class]['title'] = array(
           '#type' => 'label',
