diff --git a/core/modules/simpletest/src/Tests/MissingDependentModuleUnitTest.php b/core/modules/simpletest/src/Tests/MissingDependentModuleUnitTest.php
index 9b620f5..956f280 100644
--- a/core/modules/simpletest/src/Tests/MissingDependentModuleUnitTest.php
+++ b/core/modules/simpletest/src/Tests/MissingDependentModuleUnitTest.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\simpletest\Tests;
 
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * This test should not load since it requires a module that is not found.
@@ -15,7 +15,8 @@
  * @group simpletest
  * @requires module simpletest_missing_module
  */
-class MissingDependentModuleUnitTest extends UnitTestBase {
+class MissingDependentModuleUnitTest extends KernelTestBase {
+
   /**
    * Ensure that this test will not be loaded despite its dependency.
    */
diff --git a/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php b/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php
index c4b6c30..32bbc09 100644
--- a/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php
+++ b/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php
@@ -7,14 +7,27 @@
 
 namespace Drupal\system\Tests\Bootstrap;
 
-use Drupal\simpletest\UnitTestBase;
+use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\State\StateInterface;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * Tests that drupal_get_filename() works correctly.
  *
  * @group Bootstrap
  */
-class GetFilenameUnitTest extends UnitTestBase {
+class GetFilenameUnitTest extends KernelTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function containerBuild(ContainerBuilder $container) {
+    parent::containerBuild($container);
+
+    $container->set('state', NULL);
+    $container->getDefinition('state')
+      ->setClass(__NAMESPACE__ . '\NullState');
+  }
 
   /**
    * Tests that drupal_get_filename() works when the file is not in database.
@@ -25,9 +38,10 @@ function testDrupalGetFilename() {
     global $install_state;
     $install_state['parameters']['profile'] = 'testing';
 
-    // Assert that the test is meaningful by making sure the keyvalue service
-    // does not exist.
-    $this->assertFalse(\Drupal::hasService('keyvalue'), 'The container has no keyvalue service.');
+    // Assert that the test is meaningful by making sure the state service
+    // always returns NULL.
+    $this->assertIdentical(get_class($this->container->get('state')), __NAMESPACE__ . '\NullState');
+
     // Retrieving the location of a module.
     $this->assertIdentical(drupal_get_filename('module', 'system'), 'core/modules/system/system.info.yml');
 
@@ -45,3 +59,30 @@ function testDrupalGetFilename() {
     $this->assertNull(drupal_get_filename('module', uniqid("", TRUE)), 'Searching for an item that does not exist returns NULL.');
   }
 }
+
+class NullState implements StateInterface {
+
+  public function get($key, $default = NULL) {
+    return $default;
+  }
+
+  public function getMultiple(array $keys) {
+    return array();
+  }
+
+  public function set($key, $value) {
+  }
+
+  public function setMultiple(array $data) {
+  }
+
+  public function delete($key) {
+  }
+
+  public function deleteMultiple(array $keys) {
+  }
+
+  public function resetCache() {
+  }
+
+}
diff --git a/core/modules/system/src/Tests/Bootstrap/ResettableStaticUnitTest.php b/core/modules/system/src/Tests/Bootstrap/ResettableStaticUnitTest.php
index 8613902..4dd34c8 100644
--- a/core/modules/system/src/Tests/Bootstrap/ResettableStaticUnitTest.php
+++ b/core/modules/system/src/Tests/Bootstrap/ResettableStaticUnitTest.php
@@ -7,14 +7,14 @@
 
 namespace Drupal\system\Tests\Bootstrap;
 
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * Tests that drupal_static() and drupal_static_reset() work.
  *
  * @group Bootstrap
  */
-class ResettableStaticUnitTest extends UnitTestBase {
+class ResettableStaticUnitTest extends KernelTestBase {
 
   /**
    * Tests drupal_static() function.
diff --git a/core/modules/system/src/Tests/Database/ConnectionUnitTest.php b/core/modules/system/src/Tests/Database/ConnectionUnitTest.php
index 03a5fbc..0d7e506 100644
--- a/core/modules/system/src/Tests/Database/ConnectionUnitTest.php
+++ b/core/modules/system/src/Tests/Database/ConnectionUnitTest.php
@@ -8,14 +8,14 @@
 namespace Drupal\system\Tests\Database;
 
 use Drupal\Core\Database\Database;
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * Tests management of database connections.
  *
  * @group Database
  */
-class ConnectionUnitTest extends UnitTestBase {
+class ConnectionUnitTest extends KernelTestBase {
 
   protected $key;
   protected $target;
@@ -240,6 +240,12 @@ public function testConnectionSerialization() {
     $unserialized_reflection = new \ReflectionObject($unserialized);
     foreach ($db_reflection->getProperties() as $value) {
       $value->setAccessible(TRUE);
+
+      // Skip properties that are lazily populated on access.
+      if ($value->getName() === 'driverClasses' || $value->getName() === 'schema') {
+        continue;
+      }
+
       $unserialized_property = $unserialized_reflection->getProperty($value->getName());
       $unserialized_property->setAccessible(TRUE);
       // For the PDO object, just check the statement class attribute.
@@ -252,7 +258,13 @@ public function testConnectionSerialization() {
         $this->assertEqual(get_class($unserialized_statement_class[1][0]), get_class($db_statement_class[1][0]));
       }
       else {
-        $this->assertEqual($unserialized_property->getValue($unserialized), $value->getValue($db));
+        $actual = $unserialized_property->getValue($unserialized);
+        $expected = $value->getValue($db);
+        $this->assertEqual($actual, $expected, vsprintf('Unserialized Connection property %s value %s is equal to expected %s', array(
+          var_export($value->getName(), TRUE),
+          is_object($actual) ? print_r($actual, TRUE) : var_export($actual, TRUE),
+          is_object($expected) ? print_r($expected, TRUE) : var_export($expected, TRUE),
+        )));
       }
     }
 
diff --git a/core/modules/system/src/Tests/Database/DatabaseExceptionWrapperTest.php b/core/modules/system/src/Tests/Database/DatabaseExceptionWrapperTest.php
index 34364bb..fbe0247 100644
--- a/core/modules/system/src/Tests/Database/DatabaseExceptionWrapperTest.php
+++ b/core/modules/system/src/Tests/Database/DatabaseExceptionWrapperTest.php
@@ -9,14 +9,15 @@
 
 use Drupal\Core\Database\DatabaseExceptionWrapper;
 use Drupal\Core\Database\Database;
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * Tests exceptions thrown by queries.
  *
  * @group Database
  */
-class DatabaseExceptionWrapperTest extends UnitTestBase {
+class DatabaseExceptionWrapperTest extends KernelTestBase {
+
   function testDatabaseExceptionWrapper() {
     $connection = Database::getConnection();
     $query = $connection->prepare('bananas');
diff --git a/core/modules/system/src/Tests/Database/SchemaTest.php b/core/modules/system/src/Tests/Database/SchemaTest.php
index 7673323..0264556 100644
--- a/core/modules/system/src/Tests/Database/SchemaTest.php
+++ b/core/modules/system/src/Tests/Database/SchemaTest.php
@@ -10,14 +10,14 @@
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\SchemaObjectDoesNotExistException;
 use Drupal\Core\Database\SchemaObjectExistsException;
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * Tests table creation and modification via the schema API.
  *
  * @group Database
  */
-class SchemaTest extends UnitTestBase {
+class SchemaTest extends KernelTestBase {
 
   /**
    * A global counter for table and field creation.
diff --git a/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageExpirableTest.php b/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageExpirableTest.php
index b18befa..0600972 100644
--- a/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageExpirableTest.php
+++ b/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageExpirableTest.php
@@ -16,35 +16,20 @@
  */
 class DatabaseStorageExpirableTest extends StorageTestBase {
 
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('system');
+
   protected function setUp() {
     parent::setUp();
     $this->factory = 'keyvalue.expirable';
-    module_load_install('system');
-    $schema = system_schema();
-    db_create_table('key_value_expire', $schema['key_value_expire']);
-    $this->container
-      ->register('database', 'Drupal\Core\Database\Connection')
-      ->setFactoryClass('Drupal\Core\Database\Database')
-      ->setFactoryMethod('getConnection')
-      ->addArgument('default');
-    $this->container
-      ->register('keyvalue.expirable.database', 'Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory')
-      ->addArgument(new Reference('serialization.phpserialize'))
-      ->addArgument(new Reference('database'));
-    $this->container
-      ->register('serialization.phpserialize', 'Drupal\Component\Serialization\PhpSerialize');
+    $this->installSchema('system', array('key_value_expire'));
     $this->settingsSet('keyvalue_expirable_default', 'keyvalue.expirable.database');
   }
 
-  protected function tearDown() {
-    // The DatabaseExpirableStorage class has a destructor which deletes rows
-    // from the key_value_expire table. We need to make sure the destructor
-    // runs before the table is deleted.
-    $this->container->set('keyvalue.expirable', NULL);
-    db_drop_table('key_value_expire');
-    parent::tearDown();
-  }
-
   /**
    * Tests CRUD functionality with expiration.
    */
diff --git a/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageTest.php b/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageTest.php
index f3f61be..a235c52 100644
--- a/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageTest.php
+++ b/core/modules/system/src/Tests/KeyValueStore/DatabaseStorageTest.php
@@ -7,8 +7,6 @@
 
 namespace Drupal\system\Tests\KeyValueStore;
 
-use Symfony\Component\DependencyInjection\Reference;
-
 /**
  * Tests the key-value database storage.
  *
@@ -16,28 +14,17 @@
  */
 class DatabaseStorageTest extends StorageTestBase {
 
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('system');
+
   protected function setUp() {
     parent::setUp();
-    module_load_install('system');
-    $schema = system_schema();
-    db_create_table('key_value', $schema['key_value']);
-    $this->container
-      ->register('database', 'Drupal\Core\Database\Connection')
-      ->setFactoryClass('Drupal\Core\Database\Database')
-      ->setFactoryMethod('getConnection')
-      ->addArgument('default');
-    $this->container
-      ->register('keyvalue.database', 'Drupal\Core\KeyValueStore\KeyValueDatabaseFactory')
-      ->addArgument(new Reference('serialization.phpserialize'))
-      ->addArgument(new Reference('database'));
-    $this->container
-      ->register('serialization.phpserialize', 'Drupal\Component\Serialization\PhpSerialize');
+    $this->installSchema('system', array('key_value'));
     $this->settingsSet('keyvalue_default', 'keyvalue.database');
   }
 
-  protected function tearDown() {
-    db_drop_table('key_value');
-    parent::tearDown();
-  }
-
 }
diff --git a/core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php b/core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php
index ca63c3b..98f6ce5 100644
--- a/core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php
+++ b/core/modules/system/src/Tests/KeyValueStore/GarbageCollectionTest.php
@@ -10,26 +10,27 @@
 use Drupal\Component\Serialization\PhpSerialize;
 use Drupal\Core\Database\Database;
 use Drupal\Core\KeyValueStore\DatabaseStorageExpirable;
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * Tests garbage collection for the the expirable key-value database storage.
  *
  * @group KeyValueStore
  */
-class GarbageCollectionTest extends UnitTestBase {
+class GarbageCollectionTest extends KernelTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('system');
 
   protected function setUp() {
     parent::setUp();
-    module_load_install('system');
-    $schema = system_schema();
-    db_create_table('key_value_expire', $schema['key_value_expire']);
+    $this->installSchema('system', array('key_value_expire'));
   }
 
-  protected function tearDown() {
-    db_drop_table('key_value_expire');
-    parent::tearDown();
-  }
 
   /**
    * Tests garbage collection.
diff --git a/core/modules/system/src/Tests/KeyValueStore/MemoryStorageTest.php b/core/modules/system/src/Tests/KeyValueStore/MemoryStorageTest.php
index 10b2a15..8143525 100644
--- a/core/modules/system/src/Tests/KeyValueStore/MemoryStorageTest.php
+++ b/core/modules/system/src/Tests/KeyValueStore/MemoryStorageTest.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\system\Tests\KeyValueStore;
 
+use Drupal\Core\DependencyInjection\ContainerBuilder;
+
 /**
  * Tests the key-value memory storage.
  *
@@ -14,18 +16,17 @@
  */
 class MemoryStorageTest extends StorageTestBase {
 
-  /**
-   * Holds the original default key/value service name.
-   *
-   * @var String
-   */
-  protected $originalKeyValue = NULL;
-
   protected function setUp() {
     parent::setUp();
-    $this->container
-      ->register('keyvalue.memory', 'Drupal\Core\KeyValueStore\KeyValueMemoryFactory');
     $this->settingsSet('keyvalue_default', 'keyvalue.memory');
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function containerBuild(ContainerBuilder $container) {
+    parent::containerBuild($container);
+    $container->register('keyvalue.memory', 'Drupal\Core\KeyValueStore\KeyValueMemoryFactory');
+  }
+
 }
diff --git a/core/modules/system/src/Tests/KeyValueStore/StorageTestBase.php b/core/modules/system/src/Tests/KeyValueStore/StorageTestBase.php
index 0190e6b..3278173 100644
--- a/core/modules/system/src/Tests/KeyValueStore/StorageTestBase.php
+++ b/core/modules/system/src/Tests/KeyValueStore/StorageTestBase.php
@@ -7,14 +7,12 @@
 
 namespace Drupal\system\Tests\KeyValueStore;
 
-use Drupal\simpletest\UnitTestBase;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Reference;
+use Drupal\simpletest\KernelTestBase;
 
 /**
  * Base class for testing key-value storages.
  */
-abstract class StorageTestBase extends UnitTestBase {
+abstract class StorageTestBase extends KernelTestBase {
 
   /**
    * An array of random stdClass objects.
@@ -37,32 +35,9 @@
    */
   protected $factory = 'keyvalue';
 
-  /**
-   * A container for the services needed in these tests.
-   *
-   * @var ContainerBuilder
-   */
-  protected $container;
-
   protected function setUp() {
     parent::setUp();
 
-    $this->container = new ContainerBuilder();
-    $this->container
-      ->register('service_container', 'Symfony\Component\DependencyInjection\ContainerBuilder')
-      ->setSynthetic(TRUE);
-    $this->container->set('service_container', $this->container);
-    $this->container->register('settings', 'Drupal\Core\Site\Settings')
-      ->setFactoryClass('Drupal\Core\Site\Settings')
-      ->setFactoryMethod('getInstance');
-    $this->container
-      ->register('keyvalue', 'Drupal\Core\KeyValueStore\KeyValueFactory')
-      ->addArgument(new Reference('service_container'))
-      ->addArgument(new Reference('settings'));
-    $this->container
-      ->register('keyvalue.expirable', 'Drupal\Core\KeyValueStore\KeyValueExpirableFactory')
-      ->addArgument(new Reference('service_container'))
-      ->addArgument(new Reference('settings'));
     // Define two data collections,
     $this->collections = array(0 => 'zero', 1 => 'one');
 
diff --git a/core/modules/system/src/Tests/Routing/MatcherDumperTest.php b/core/modules/system/src/Tests/Routing/MatcherDumperTest.php
index 4846ca7..f98d294 100644
--- a/core/modules/system/src/Tests/Routing/MatcherDumperTest.php
+++ b/core/modules/system/src/Tests/Routing/MatcherDumperTest.php
@@ -9,10 +9,9 @@
 
 use Drupal\Core\KeyValueStore\KeyValueMemoryFactory;
 use Drupal\Core\State\State;
+use Drupal\simpletest\KernelTestBase;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
-
-use Drupal\simpletest\UnitTestBase;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Routing\MatcherDumper;
 use Drupal\Tests\Core\Routing\RoutingFixtures;
@@ -22,7 +21,7 @@
  *
  * @group Routing
  */
-class MatcherDumperTest extends UnitTestBase {
+class MatcherDumperTest extends KernelTestBase {
 
   /**
    * A collection of shared fixture data for tests.
@@ -38,17 +37,13 @@ class MatcherDumperTest extends UnitTestBase {
    */
   protected $state;
 
-  function __construct($test_id = NULL) {
-    parent::__construct($test_id);
+  protected function setUp() {
+    parent::setUp();
 
     $this->fixtures = new RoutingFixtures();
     $this->state = new State(new KeyValueMemoryFactory());
   }
 
-  protected function setUp() {
-    parent::setUp();
-  }
-
   /**
    * Confirms that the dumper can be instantiated successfully.
    */
diff --git a/core/modules/system/src/Tests/Routing/RouteProviderTest.php b/core/modules/system/src/Tests/Routing/RouteProviderTest.php
index 562fa26..b453feb 100644
--- a/core/modules/system/src/Tests/Routing/RouteProviderTest.php
+++ b/core/modules/system/src/Tests/Routing/RouteProviderTest.php
@@ -9,13 +9,12 @@
 
 use Drupal\Core\KeyValueStore\KeyValueMemoryFactory;
 use Drupal\Core\State\State;
+use Drupal\simpletest\KernelTestBase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Exception\RouteNotFoundException;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
-
-use Drupal\simpletest\UnitTestBase;
 use Drupal\Core\Routing\RouteProvider;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Routing\MatcherDumper;
@@ -27,7 +26,7 @@
  *
  * @group Routing
  */
-class RouteProviderTest extends UnitTestBase {
+class RouteProviderTest extends KernelTestBase {
 
   /**
    * A collection of shared fixture data for tests.
diff --git a/core/modules/system/src/Tests/System/IgnoreReplicaSubscriberTest.php b/core/modules/system/src/Tests/System/IgnoreReplicaSubscriberTest.php
index 49d11ec..d3cac32 100644
--- a/core/modules/system/src/Tests/System/IgnoreReplicaSubscriberTest.php
+++ b/core/modules/system/src/Tests/System/IgnoreReplicaSubscriberTest.php
@@ -9,7 +9,7 @@
 use Drupal\Core\Database\Database;
 use Drupal\Core\EventSubscriber\ReplicaDatabaseIgnoreSubscriber;
 use Drupal\Core\DrupalKernel;
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\HttpKernelInterface;
 use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -19,7 +19,7 @@
  *
  * @group system
  */
-class IgnoreReplicaSubscriberTest extends UnitTestBase {
+class IgnoreReplicaSubscriberTest extends KernelTestBase {
 
   /**
    * Tests \Drupal\Core\EventSubscriber\ReplicaDatabaseIgnoreSubscriber::checkReplicaServer().
diff --git a/core/modules/user/src/Tests/TempStoreDatabaseTest.php b/core/modules/user/src/Tests/TempStoreDatabaseTest.php
index f148696..9a06b68 100644
--- a/core/modules/user/src/Tests/TempStoreDatabaseTest.php
+++ b/core/modules/user/src/Tests/TempStoreDatabaseTest.php
@@ -8,7 +8,7 @@
 namespace Drupal\user\Tests;
 
 use Drupal\Component\Serialization\PhpSerialize;
-use Drupal\simpletest\UnitTestBase;
+use Drupal\simpletest\KernelTestBase;
 use Drupal\user\TempStoreFactory;
 use Drupal\Core\Lock\DatabaseLockBackend;
 use Drupal\Core\Database\Database;
@@ -19,7 +19,14 @@
  * @group user
  * @see \Drupal\Core\TempStore\TempStore.
  */
-class TempStoreDatabaseTest extends UnitTestBase {
+class TempStoreDatabaseTest extends KernelTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('system', 'user');
 
   /**
    * A key/value store factory.
@@ -54,10 +61,7 @@ protected function setUp() {
 
     // Install system tables to test the key/value storage without installing a
     // full Drupal environment.
-    module_load_install('system');
-    $schema = system_schema();
-    db_create_table('semaphore', $schema['semaphore']);
-    db_create_table('key_value_expire', $schema['key_value_expire']);
+    $this->installSchema('system', array('semaphore', 'key_value_expire'));
 
     // Create several objects for testing.
     for ($i = 0; $i <= 3; $i++) {
@@ -66,12 +70,6 @@ protected function setUp() {
 
   }
 
-  protected function tearDown() {
-    db_drop_table('key_value_expire');
-    db_drop_table('semaphore');
-    parent::tearDown();
-  }
-
   /**
    * Tests the UserTempStore API.
    */
