Index: profiles/testing/testing.info
===================================================================
RCS file: testing.info
diff -N profiles/testing/testing.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ profiles/testing/testing.info	22 Jun 2010 06:18:25 -0000
@@ -0,0 +1,5 @@
+; $Id:$
+name = Testing
+description = Totally stripped back testing profile.
+version = VERSION
+core = 7.x
Index: profiles/testing/testing.install
===================================================================
RCS file: testing.install
diff -N profiles/testing/testing.install
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ profiles/testing/testing.install	22 Jun 2010 06:18:25 -0000
@@ -0,0 +1,17 @@
+<?php
+
+/**
+ * Implements hook_install().
+ *
+ * Perform actions to set up the site for this profile.
+ */
+function testing_install() {
+
+  // Allow visitor account creation, but with administrative approval.
+  variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
+
+  // Enable default permissions for system roles.
+  user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content'));
+  user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content'));
+}
+
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.220
diff -u -p -r1.220 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	13 Jun 2010 13:14:18 -0000	1.220
+++ modules/simpletest/drupal_web_test_case.php	22 Jun 2010 06:18:27 -0000
@@ -1108,6 +1108,11 @@ class DrupalWebTestCase extends DrupalTe
    */
   protected function setUp() {
     global $db_prefix, $user, $language, $conf;
+    
+    // Allow tests to use a profile other than the testing one.
+    if (!isset($this->profile)) {
+      $this->profile = 'testing';
+    }
 
     // Store necessary current values before switching to prefixed database.
     $this->originalLanguage = $language;
@@ -1165,8 +1170,8 @@ class DrupalWebTestCase extends DrupalTe
     variable_set('file_temporary_path', $temp_files_directory);
 
     // Include the default profile.
-    variable_set('install_profile', 'standard');
-    $profile_details = install_profile_info('standard', 'en');
+    variable_set('install_profile', $this->profile);
+    $profile_details = install_profile_info($this->profile, 'en');
 
     // Install the modules specified by the default profile.
     module_enable($profile_details['dependencies'], FALSE);
@@ -1184,7 +1189,12 @@ class DrupalWebTestCase extends DrupalTe
     }
 
     // Run default profile tasks.
-    module_enable(array('standard'), FALSE);
+    $install_profile_module_exists = db_query("SELECT 1 FROM {system} WHERE type = 'module' AND name = :name", array(
+      ':name' => $this->profile))
+      ->fetchField();
+    if ($install_profile_module_exists) {
+      module_enable(array($this->profile), FALSE);
+    }
 
     // Rebuild caches.
     drupal_static_reset();
