diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index 5ad1b39..82d5faf 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -756,31 +756,60 @@ function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) {
   $records = array();
   foreach ($xml->testsuite as $testsuite) {
     foreach ($testsuite as $suite) {
-      foreach ($suite as $testcase) {
-        $message = '';
-        $pass = TRUE;
-        if ($testcase->failure) {
-          $lines = explode("\n", $testcase->failure);
-          $message = $lines[2];
-          $pass = FALSE;
-        }
-        if ($testcase->error) {
-          $message = $testcase->error;
-          $pass = FALSE;
-        }
-        $attributes = $testcase->attributes();
-        $records[] = array(
-          'test_id' => $test_id,
-          'test_class' => (string)$attributes->class,
-          'status' => $pass ? 'pass' : 'fail',
-          'message' => $message,
-          'message_group' => 'Other', // TODO: Check on the proper values for this.
-          'function' => $attributes->class . '->' . $attributes->name . '()',
-          'line' => (string)$attributes->line,
-          'file' => (string)$attributes->file,
-        );
+      // The file element won't be on testcase objects created with 
+      // @dataProvider, so just use the one from the test suite at this level
+      // because it should be the same.
+      $file = (string)$suite->attributes()->file;
+
+      $testcases = simpletest_phpunit_find_testcases($suite);
+      foreach ($testcases as $testcase) {
+        $records[] = simpletest_phpunit_testcase_to_row($test_id, $testcase, $file);
       }
     }
   }
   return $records;
 }
+
+function simpletest_phpunit_find_testcases($testsuite) {
+  $testcases = array();
+
+  foreach ($suite as $testcase) {
+    if ($testcase->getName() === 'testcase') {
+      $testcases[] = $testcase;
+    }
+    elseif (isset($testcase->testcase) && $testcase->tests > 0) {
+      foreach ($testcase->testcase as $childtestcase) {
+        $testcases[] = $childtestcase;
+      }
+    }
+  }
+  return $testcases;
+}
+
+function simpletest_phpunit_testcase_to_row($test_id, $testcase, $file) {
+  $message = '';
+  $pass = TRUE;
+  if ($testcase->failure) {
+    $lines = explode("\n", $testcase->failure);
+    $message = $lines[2];
+    $pass = FALSE;
+  }
+  if ($testcase->error) {
+    $message = $testcase->error;
+    $pass = FALSE;
+  }
+
+  $attributes = $testcase->attributes();
+
+  $record = array(
+    'test_id' => $test_id,
+    'test_class' => (string)$attributes->class,
+    'status' => $pass ? 'pass' : 'fail',
+    'message' => $message,
+    'message_group' => 'Other', // TODO: Check on the proper values for this.
+    'function' => $attributes->class . '->' . $attributes->name . '()',
+    'line' => $attributes->line ?: 0,
+    'file' => $file,
+  );
+  return $record;
+}
