diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index e785299..c95e867 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -55,13 +55,6 @@
         self.identity_client = self._get_identity_client()
         self.network_client = self._get_network_client()
         self.volume_client = self._get_volume_client()
-        self.client_attr_names = [
-            'compute_client',
-            'image_client',
-            'identity_client',
-            'network_client',
-            'volume_client'
-        ]
 
     def _get_compute_client(self, username=None, password=None,
                             tenant_name=None):
@@ -160,7 +153,7 @@
                                                 insecure=dscv)
 
 
-class OfficialClientTest(tempest.test.TestCase):
+class OfficialClientTest(tempest.test.BaseTestCase):
     """
     Official Client test base class for scenario testing.
 
@@ -173,7 +166,16 @@
      * Use only the default client tool for calling an API
     """
 
-    manager_class = OfficialClientManager
+    @classmethod
+    def setUpClass(cls):
+        cls.manager = OfficialClientManager()
+        cls.compute_client = cls.manager.compute_client
+        cls.image_client = cls.manager.image_client
+        cls.identity_client = cls.manager.identity_client
+        cls.network_client = cls.manager.network_client
+        cls.volume_client = cls.manager.volume_client
+        cls.resource_keys = {}
+        cls.os_resources = []
 
     @classmethod
     def tearDownClass(cls):
@@ -215,6 +217,52 @@
             # Block until resource deletion has completed or timed-out
             tempest.test.call_until_true(is_deletion_complete, 10, 1)
 
+    @classmethod
+    def set_resource(cls, key, thing):
+        LOG.debug("Adding %r to shared resources of %s" %
+                  (thing, cls.__name__))
+        cls.resource_keys[key] = thing
+        cls.os_resources.append(thing)
+
+    @classmethod
+    def get_resource(cls, key):
+        return cls.resource_keys[key]
+
+    @classmethod
+    def remove_resource(cls, key):
+        thing = cls.resource_keys[key]
+        cls.os_resources.remove(thing)
+        del cls.resource_keys[key]
+
+    def status_timeout(self, things, thing_id, expected_status):
+        """
+        Given a thing and an expected status, do a loop, sleeping
+        for a configurable amount of time, checking for the
+        expected status to show. At any time, if the returned
+        status of the thing is ERROR, fail out.
+        """
+        def check_status():
+            # python-novaclient has resources available to its client
+            # that all implement a get() method taking an identifier
+            # for the singular resource to retrieve.
+            thing = things.get(thing_id)
+            new_status = thing.status
+            if new_status == 'ERROR':
+                self.fail("%s failed to get to expected status. "
+                          "In ERROR state."
+                          % thing)
+            elif new_status == expected_status:
+                return True  # All good.
+            LOG.debug("Waiting for %s to get to %s status. "
+                      "Currently in %s status",
+                      thing, expected_status, new_status)
+        if not tempest.test.call_until_true(
+            check_status,
+            self.config.compute.build_timeout,
+            self.config.compute.build_interval):
+            self.fail("Timed out waiting for thing %s to become %s"
+                      % (thing_id, expected_status))
+
 
 class NetworkScenarioTest(OfficialClientTest):
     """
diff --git a/tempest/test.py b/tempest/test.py
index 6c304c3..96360ff 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -244,70 +244,3 @@
         time.sleep(sleep_for)
         now = time.time()
     return False
-
-
-class TestCase(BaseTestCase):
-    """Base test case class for all Tempest tests
-
-    Contains basic setup and convenience methods
-    """
-
-    manager_class = None
-
-    @classmethod
-    def setUpClass(cls):
-        cls.manager = cls.manager_class()
-        for attr_name in cls.manager.client_attr_names:
-            # Ensure that pre-existing class attributes won't be
-            # accidentally overriden.
-            assert not hasattr(cls, attr_name)
-            client = getattr(cls.manager, attr_name)
-            setattr(cls, attr_name, client)
-        cls.resource_keys = {}
-        cls.os_resources = []
-
-    @classmethod
-    def set_resource(cls, key, thing):
-        LOG.debug("Adding %r to shared resources of %s" %
-                  (thing, cls.__name__))
-        cls.resource_keys[key] = thing
-        cls.os_resources.append(thing)
-
-    @classmethod
-    def get_resource(cls, key):
-        return cls.resource_keys[key]
-
-    @classmethod
-    def remove_resource(cls, key):
-        thing = cls.resource_keys[key]
-        cls.os_resources.remove(thing)
-        del cls.resource_keys[key]
-
-    def status_timeout(self, things, thing_id, expected_status):
-        """
-        Given a thing and an expected status, do a loop, sleeping
-        for a configurable amount of time, checking for the
-        expected status to show. At any time, if the returned
-        status of the thing is ERROR, fail out.
-        """
-        def check_status():
-            # python-novaclient has resources available to its client
-            # that all implement a get() method taking an identifier
-            # for the singular resource to retrieve.
-            thing = things.get(thing_id)
-            new_status = thing.status
-            if new_status == 'ERROR':
-                self.fail("%s failed to get to expected status. "
-                          "In ERROR state."
-                          % thing)
-            elif new_status == expected_status:
-                return True  # All good.
-            LOG.debug("Waiting for %s to get to %s status. "
-                      "Currently in %s status",
-                      thing, expected_status, new_status)
-        conf = config.TempestConfig()
-        if not call_until_true(check_status,
-                               conf.compute.build_timeout,
-                               conf.compute.build_interval):
-            self.fail("Timed out waiting for thing %s to become %s"
-                      % (thing_id, expected_status))
