diff --git devel.module devel.module
index ac1201e..9e1ac07 100644
--- devel.module
+++ devel.module
@@ -1451,7 +1451,13 @@ function dargs($always = TRUE) {
   static $printed;
   if ($always || !$printed) {
     $bt = debug_backtrace();
-    print kdevel_print_object($bt[1]['args']);
+    $print = kdevel_print_object($bt[1]['args']);
+    if (Database::getConnectionInfo('simpletest_original_default')) {
+      trigger_error($print);
+    }
+    else {
+      print $print;
+    }
     $printed = TRUE;
   }
 }
@@ -1462,7 +1468,14 @@ function dargs($always = TRUE) {
 function dpm($input, $name = NULL) {
   if (user_access('access devel information')) {
     $export = kprint_r($input, TRUE, $name);
-    drupal_set_message($export);
+    if (Database::getConnectionInfo('simpletest_original_default')) {
+      // Simpletest is running. Trigger error to send debug information to the
+      // test report page.
+      trigger_error($export);
+    }
+    else {
+      drupal_set_message($export);
+    }
   }
 }
 
@@ -1472,7 +1485,12 @@ function dpm($input, $name = NULL) {
 function dvm($input, $name = NULL) {
   if (user_access('access devel information')) {
     $export = dprint_r($input, TRUE, $name, 'drupal_var_export', FALSE);
-    drupal_set_message($export);
+    if (Database::getConnectionInfo('simpletest_original_default')) {
+      trigger_error($export);
+    }
+    else {
+      drupal_set_message($export);
+    }
   }
 }
 
@@ -1548,6 +1566,9 @@ function dprint_r($input, $return = FALSE, $name = NULL, $function = 'print_r',
     if ($return) {
       return $printed_value;
     }
+    elseif (Database::getConnectionInfo('simpletest_original_default')) {
+      trigger_error($printed_value);
+    }
     else {
       print $printed_value;
     }
@@ -1565,7 +1586,13 @@ function ddebug_backtrace() {
       $rich_trace[$value['function']] = $value;
     }
     if (has_krumo()) {
-      print krumo($rich_trace);
+      $krumo = krumo($rich_trace);
+      if (Database::getConnectionInfo('simpletest_original_default')) {
+        trigger_error($krumo);
+      }
+      else {
+        print $krumo;
+      }
     }
     else {
       dprint_r($rich_trace);
