diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index b60c682..4041e33 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -1430,7 +1430,14 @@ class DrupalWebTestCase extends DrupalTestCase {
   protected function refreshVariables() {
     global $conf;
     cache_clear_all('variables', 'cache_bootstrap');
-    $conf = variable_initialize();
+    $conf = array();
+    // We need to see if variables were set in settings.php.
+    if (file_exists(DRUPAL_ROOT . '/' . conf_path() . '/settings.php')) {
+      // Include settings.php. This generates errors because it reruns ini_set()
+      // statements, so we suppress error messages.
+      @include DRUPAL_ROOT . '/' . conf_path() . '/settings.php';
+    }
+    $conf = variable_initialize($conf);
   }
 
   /**
