diff --git a/tests/lib/appframework/AppTest.php b/tests/lib/appframework/AppTest.php
index 3d41d6590aac4c860b7c70b3a877c2a80362c069..7288e686d524016563639a4b7d971c76c5603d67 100644
--- a/tests/lib/appframework/AppTest.php
+++ b/tests/lib/appframework/AppTest.php
@@ -22,8 +22,9 @@
  */
 
 
-namespace OC\AppFramework;
+namespace Test\AppFramework;
 
+use OC\AppFramework\App;
 use OCP\AppFramework\Http\Response;
 
 
diff --git a/tests/lib/appframework/controller/ApiControllerTest.php b/tests/lib/appframework/controller/ApiControllerTest.php
index 137e5950f6743301c44bf1df410d018fd41de25f..783eecf93e5caf04e6bcf63f597cbdb551bc4b36 100644
--- a/tests/lib/appframework/controller/ApiControllerTest.php
+++ b/tests/lib/appframework/controller/ApiControllerTest.php
@@ -22,9 +22,10 @@
  */
 
 
-namespace OCP\AppFramework;
+namespace Test\AppFramework\Controller;
 
 use OC\AppFramework\Http\Request;
+use OCP\AppFramework\ApiController;
 
 
 class ChildApiController extends ApiController {};
diff --git a/tests/lib/appframework/controller/ControllerTest.php b/tests/lib/appframework/controller/ControllerTest.php
index 1493c0c3175f18006dfc3be9eee46471c5cb3b53..521799a46cec32009a6627c82e5fdae718424038 100644
--- a/tests/lib/appframework/controller/ControllerTest.php
+++ b/tests/lib/appframework/controller/ControllerTest.php
@@ -22,9 +22,10 @@
  */
 
 
-namespace OCP\AppFramework;
+namespace Test\AppFramework\Controller;
 
 use OC\AppFramework\Http\Request;
+use OCP\AppFramework\Controller;
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\AppFramework\Http\JSONResponse;
 use OCP\AppFramework\Http\DataResponse;
diff --git a/tests/lib/appframework/controller/OCSControllerTest.php b/tests/lib/appframework/controller/OCSControllerTest.php
index 92b092cf0e902434e6beaf3b0b10b4d496ae1d04..f69740d4496658fb43385f6fceb4985f30abf485 100644
--- a/tests/lib/appframework/controller/OCSControllerTest.php
+++ b/tests/lib/appframework/controller/OCSControllerTest.php
@@ -22,10 +22,11 @@
  */
 
 
-namespace OCP\AppFramework;
+namespace Test\AppFramework\Controller;
 
 use OC\AppFramework\Http\Request;
 use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\OCSController;
 
 
 class ChildOCSController extends OCSController {}
diff --git a/tests/lib/appframework/db/EntityTest.php b/tests/lib/appframework/db/EntityTest.php
index 161e11d8030dd887cb51c05c4deacf883fa0b9bf..e1a3d7533be52402ac596fbdddaf63196fe18388 100644
--- a/tests/lib/appframework/db/EntityTest.php
+++ b/tests/lib/appframework/db/EntityTest.php
@@ -21,7 +21,10 @@
 *
 */
 
-namespace OCP\AppFramework\Db;
+namespace Test\AppFramework\Db;
+
+
+use OCP\AppFramework\Db\Entity;
 
 
 /**
diff --git a/tests/lib/appframework/dependencyinjection/DIContainerTest.php b/tests/lib/appframework/dependencyinjection/DIContainerTest.php
index fc15b5a44ee56e8ece359802b5d3f0da53c8f8d7..5aa000fa25aaeadd541afb655e6eee4ccb1a223e 100644
--- a/tests/lib/appframework/dependencyinjection/DIContainerTest.php
+++ b/tests/lib/appframework/dependencyinjection/DIContainerTest.php
@@ -24,10 +24,10 @@
  */
 
 
-namespace OC\AppFramework\DependencyInjection;
+namespace Test\AppFramework\DependencyInjection;
 
-use \OC\AppFramework\Http\Request;
 
+use \OC\AppFramework\Http\Request;
 
 class DIContainerTest extends \Test\TestCase {
 
diff --git a/tests/lib/appframework/http/ContentSecurityPolicyTest.php b/tests/lib/appframework/http/ContentSecurityPolicyTest.php
index adf03185e9f24a632b5a1a022de82ed113c5b862..82f2b3873b7b4f507314c0e38b2bab214138476f 100644
--- a/tests/lib/appframework/http/ContentSecurityPolicyTest.php
+++ b/tests/lib/appframework/http/ContentSecurityPolicyTest.php
@@ -7,7 +7,7 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\ContentSecurityPolicy;
diff --git a/tests/lib/appframework/http/DataResponseTest.php b/tests/lib/appframework/http/DataResponseTest.php
index e3d5689d54c9102a0a278341c6cd52c8bc5fefcd..cde553cdf5f6bae2d9f291956e7e6936fd850008 100644
--- a/tests/lib/appframework/http/DataResponseTest.php
+++ b/tests/lib/appframework/http/DataResponseTest.php
@@ -22,7 +22,7 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
 
 use OCP\AppFramework\Http\DataResponse;
diff --git a/tests/lib/appframework/http/DispatcherTest.php b/tests/lib/appframework/http/DispatcherTest.php
index 02c86df8e72113aa8ab021d76bb0890fe62af286..6df6f7fa7fe5659924908f2ff82039e2f121560e 100644
--- a/tests/lib/appframework/http/DispatcherTest.php
+++ b/tests/lib/appframework/http/DispatcherTest.php
@@ -22,8 +22,10 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
+use OC\AppFramework\Http\Dispatcher;
+use OC\AppFramework\Http\Request;
 use OC\AppFramework\Utility\ControllerMethodReflector;
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\JSONResponse;
diff --git a/tests/lib/appframework/http/DownloadResponseTest.php b/tests/lib/appframework/http/DownloadResponseTest.php
index 5e5db2c55ec8b36fae450708e7a36fcd37fe1990..07c932b2725c8236c7cd2916f32eae2da3ae7f94 100644
--- a/tests/lib/appframework/http/DownloadResponseTest.php
+++ b/tests/lib/appframework/http/DownloadResponseTest.php
@@ -22,9 +22,11 @@
  */
 
 
-namespace OCP\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
 
+use OCP\AppFramework\Http\DownloadResponse;
+
 class ChildDownloadResponse extends DownloadResponse {
 
 };
diff --git a/tests/lib/appframework/http/EmptyContentSecurityPolicyTest.php b/tests/lib/appframework/http/EmptyContentSecurityPolicyTest.php
index 0d0f92de8190e7435f3a97eadcc6581141fa3c31..248c3d808d214ac491b65ee049d89af930c6d481 100644
--- a/tests/lib/appframework/http/EmptyContentSecurityPolicyTest.php
+++ b/tests/lib/appframework/http/EmptyContentSecurityPolicyTest.php
@@ -7,7 +7,7 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\EmptyContentSecurityPolicy;
diff --git a/tests/lib/appframework/http/HttpTest.php b/tests/lib/appframework/http/HttpTest.php
index 4bcc8305db488315f96db0a0e8c564ecb0afbd9e..66256d1a86f78a35427f4542c662f707051e9c29 100644
--- a/tests/lib/appframework/http/HttpTest.php
+++ b/tests/lib/appframework/http/HttpTest.php
@@ -22,7 +22,7 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
 use OC\AppFramework\Http;
 
diff --git a/tests/lib/appframework/http/JSONResponseTest.php b/tests/lib/appframework/http/JSONResponseTest.php
index a98f5fc894a390a743685f2107b3f403df77d822..23a55e7eee8e5e17d59a45e7970eb706a4baa5fa 100644
--- a/tests/lib/appframework/http/JSONResponseTest.php
+++ b/tests/lib/appframework/http/JSONResponseTest.php
@@ -24,7 +24,7 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
 
 use OCP\AppFramework\Http\JSONResponse;
diff --git a/tests/lib/appframework/http/OCSResponseTest.php b/tests/lib/appframework/http/OCSResponseTest.php
index 1ca3e330badce265a3aedad343db3616f8c6e583..adac66a231c61d59f3db34f84f4b3ad4c383a871 100644
--- a/tests/lib/appframework/http/OCSResponseTest.php
+++ b/tests/lib/appframework/http/OCSResponseTest.php
@@ -22,7 +22,7 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
 
 use OCP\AppFramework\Http\OCSResponse;
diff --git a/tests/lib/appframework/http/RedirectResponseTest.php b/tests/lib/appframework/http/RedirectResponseTest.php
index 723f6600c559f368d2d5cb5439d9f09c1709a09c..5ef82a1221dce95c344d0451a54dd1294861fbd3 100644
--- a/tests/lib/appframework/http/RedirectResponseTest.php
+++ b/tests/lib/appframework/http/RedirectResponseTest.php
@@ -22,9 +22,10 @@
  */
 
 
-namespace OCP\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
 use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\RedirectResponse;
 
 
 class RedirectResponseTest extends \Test\TestCase {
diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/appframework/http/RequestTest.php
index 3f1d09c2a93ca418c07bd69db8a3a9e28a0f194f..5b960908991edb46a5ec01b18cdfa2435abd6c9e 100644
--- a/tests/lib/appframework/http/RequestTest.php
+++ b/tests/lib/appframework/http/RequestTest.php
@@ -8,8 +8,9 @@
  * See the COPYING-README file.
  */
 
-namespace OC\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
+use OC\AppFramework\Http\Request;
 use OC\Security\CSRF\CsrfToken;
 use OC\Security\CSRF\CsrfTokenManager;
 use OCP\Security\ISecureRandom;
diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php
index f845f02d9840c5f3096dd5110b6e1cc671494f7d..0c582f8f6eafb5c1491e8f14bbc244718fa1fd17 100644
--- a/tests/lib/appframework/http/ResponseTest.php
+++ b/tests/lib/appframework/http/ResponseTest.php
@@ -22,7 +22,7 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
 
 use OCP\AppFramework\Http\Response;
diff --git a/tests/lib/appframework/http/StreamResponseTest.php b/tests/lib/appframework/http/StreamResponseTest.php
index 4c47ecfbd6c8b91368e4c1fa319039a34208ed0a..1f761d6b89c2e7854d0d4f08cbaf5acf2a9378c9 100644
--- a/tests/lib/appframework/http/StreamResponseTest.php
+++ b/tests/lib/appframework/http/StreamResponseTest.php
@@ -22,10 +22,11 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
 
 use OCP\AppFramework\Http\StreamResponse;
+use OCP\AppFramework\Http\IOutput;
 use OCP\AppFramework\Http;
 
 
diff --git a/tests/lib/appframework/http/TemplateResponseTest.php b/tests/lib/appframework/http/TemplateResponseTest.php
index 2ec57f8979ac837d23b27cda1fc0451dc6efa122..87fb6864f78c2901b6ae84f23bdfda57e802d2f2 100644
--- a/tests/lib/appframework/http/TemplateResponseTest.php
+++ b/tests/lib/appframework/http/TemplateResponseTest.php
@@ -22,7 +22,7 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace Test\AppFramework\Http;
 
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\AppFramework\Http;
diff --git a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php
index a873152579899aa9b3cee9f9d3235e77d679f24b..f81aca106d6d625bc563e5f95496bc00e27bc880 100644
--- a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php
+++ b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php
@@ -22,7 +22,7 @@
  */
 
 
-namespace OC\AppFramework;
+namespace Test\AppFramework\Middleware;
 
 use OC\AppFramework\Http\Request;
 use OC\AppFramework\Middleware\MiddlewareDispatcher;
diff --git a/tests/lib/appframework/middleware/MiddlewareTest.php b/tests/lib/appframework/middleware/MiddlewareTest.php
index 33f04e1383d0b177c6e1fcb21ae10e47fee87560..013403a9a4abb1b2860c8f6ce25521d58e763113 100644
--- a/tests/lib/appframework/middleware/MiddlewareTest.php
+++ b/tests/lib/appframework/middleware/MiddlewareTest.php
@@ -22,7 +22,7 @@
  */
 
 
-namespace OC\AppFramework;
+namespace Test\AppFramework\Middleware;
 
 use OC\AppFramework\Http\Request;
 use OCP\AppFramework\Middleware;
diff --git a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php b/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php
index cf5f97a046fd7a0cc638e5184796e1f3b7945b1d..8e53c9202cf3802af4f09a0eff4811cdcddcc9d6 100644
--- a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php
+++ b/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php
@@ -10,9 +10,10 @@
  */
 
 
-namespace OC\AppFramework\Middleware\Security;
+namespace Test\AppFramework\Middleware\Security;
 
 use OC\AppFramework\Http\Request;
+use OC\AppFramework\Middleware\Security\CORSMiddleware;
 use OC\AppFramework\Utility\ControllerMethodReflector;
 use OC\AppFramework\Middleware\Security\Exceptions\SecurityException;
 use OCP\AppFramework\Http;
diff --git a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
index f70308dc731c69465bbfd7cc479f7db3ad1703c2..8cdba76d8356a460996061cc5a59dee653e57214 100644
--- a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
+++ b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
@@ -22,7 +22,7 @@
 
 
 
-namespace OC\AppFramework\Middleware\Security;
+namespace Test\AppFramework\Middleware\Security;
 
 use OC\AppFramework\Http;
 use OC\AppFramework\Http\Request;
@@ -31,6 +31,7 @@ use OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryExcept
 use OC\AppFramework\Middleware\Security\Exceptions\NotAdminException;
 use OC\AppFramework\Middleware\Security\Exceptions\NotLoggedInException;
 use OC\AppFramework\Middleware\Security\Exceptions\SecurityException;
+use OC\AppFramework\Middleware\Security\SecurityMiddleware;
 use OC\AppFramework\Utility\ControllerMethodReflector;
 use OC\Security\CSP\ContentSecurityPolicy;
 use OCP\AppFramework\Http\RedirectResponse;
diff --git a/tests/lib/appframework/middleware/sessionmiddlewaretest.php b/tests/lib/appframework/middleware/sessionmiddlewaretest.php
index 11c1600f515edbbb56097fb1cc601d4c281602e5..17fcc1904c1bfbe3ebccb2e113f02efb67b682db 100644
--- a/tests/lib/appframework/middleware/sessionmiddlewaretest.php
+++ b/tests/lib/appframework/middleware/sessionmiddlewaretest.php
@@ -10,7 +10,7 @@
  */
 
 
-namespace OC\AppFramework\Middleware\Security;
+namespace Test\AppFramework\Middleware;
 
 use OC\AppFramework\Http\Request;
 use OC\AppFramework\Middleware\SessionMiddleware;
diff --git a/tests/lib/appframework/routing/RoutingTest.php b/tests/lib/appframework/routing/RoutingTest.php
index 3ceab1aac486a3ab82cd110ee5c1da86694b8355..326c156af980850d78a60ae31b386450dea8b837 100644
--- a/tests/lib/appframework/routing/RoutingTest.php
+++ b/tests/lib/appframework/routing/RoutingTest.php
@@ -1,8 +1,10 @@
 <?php
 
-namespace OC\AppFramework\Routing;
+namespace Test\AppFramework\Routing;
 
 use OC\AppFramework\DependencyInjection\DIContainer;
+use OC\AppFramework\Routing\RouteActionHandler;
+use OC\AppFramework\Routing\RouteConfig;
 
 class RoutingTest extends \Test\TestCase
 {
diff --git a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php b/tests/lib/appframework/utility/ControllerMethodReflectorTest.php
index c643c362a9c64ec3e5a659d1a759c4b607677959..92d767e9987103fc1d25d5b430f5237ec5fa39fb 100644
--- a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php
+++ b/tests/lib/appframework/utility/ControllerMethodReflectorTest.php
@@ -22,9 +22,11 @@
  */
 
 
-namespace OC\AppFramework\Utility;
+namespace Test\AppFramework\Utility;
 
 
+use OC\AppFramework\Utility\ControllerMethodReflector;
+
 class BaseController {
 
 	/**
@@ -66,7 +68,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
 	public function testReadAnnotation(){
 		$reader = new ControllerMethodReflector();
 		$reader->reflect(
-			'\OC\AppFramework\Utility\ControllerMethodReflectorTest',
+			'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
 			'testReadAnnotation'
 		);
 
@@ -81,7 +83,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
 	public function testReadAnnotationNoLowercase(){
 		$reader = new ControllerMethodReflector();
 		$reader->reflect(
-			'\OC\AppFramework\Utility\ControllerMethodReflectorTest',
+			'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
 			'testReadAnnotationNoLowercase'
 		);
 
@@ -97,7 +99,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
 	public function testReadTypeIntAnnotations(){
 		$reader = new ControllerMethodReflector();
 		$reader->reflect(
-			'\OC\AppFramework\Utility\ControllerMethodReflectorTest',
+			'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
 			'testReadTypeIntAnnotations'
 		);
 
@@ -117,7 +119,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
 	public function testReadTypeIntAnnotationsScalarTypes(){
 		$reader = new ControllerMethodReflector();
 		$reader->reflect(
-			'\OC\AppFramework\Utility\ControllerMethodReflectorTest',
+			'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
 			'arguments3'
 		);
 
@@ -135,7 +137,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
 	public function testReadTypeDoubleAnnotations(){
 		$reader = new ControllerMethodReflector();
 		$reader->reflect(
-			'\OC\AppFramework\Utility\ControllerMethodReflectorTest',
+			'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
 			'testReadTypeDoubleAnnotations'
 		);
 
@@ -149,7 +151,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
 	public function testReadTypeWhitespaceAnnotations(){
 		$reader = new ControllerMethodReflector();
 		$reader->reflect(
-			'\OC\AppFramework\Utility\ControllerMethodReflectorTest',
+			'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
 			'testReadTypeWhitespaceAnnotations'
 		);
 
@@ -161,7 +163,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
 	public function testReflectParameters() {
 		$reader = new ControllerMethodReflector();
 		$reader->reflect(
-			'\OC\AppFramework\Utility\ControllerMethodReflectorTest',
+			'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
 			'arguments'
 		);
 
@@ -173,7 +175,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
 	public function testReflectParameters2() {
 		$reader = new ControllerMethodReflector();
 		$reader->reflect(
-			'\OC\AppFramework\Utility\ControllerMethodReflectorTest',
+			'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
 			'arguments2'
 		);
 
@@ -183,7 +185,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
 
 	public function testInheritance() {
 		$reader = new ControllerMethodReflector();
-		$reader->reflect('OC\AppFramework\Utility\EndController', 'test');
+		$reader->reflect('Test\AppFramework\Utility\EndController', 'test');
 
 		$this->assertTrue($reader->hasAnnotation('Annotation'));
 	}
@@ -191,7 +193,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
 
 	public function testInheritanceOverride() {
 		$reader = new ControllerMethodReflector();
-		$reader->reflect('OC\AppFramework\Utility\EndController', 'test2');
+		$reader->reflect('Test\AppFramework\Utility\EndController', 'test2');
 
 		$this->assertTrue($reader->hasAnnotation('NoAnnotation'));
 		$this->assertFalse($reader->hasAnnotation('Annotation'));
@@ -200,7 +202,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
 
 	public function testInheritanceOverrideNoDocblock() {
 		$reader = new ControllerMethodReflector();
-		$reader->reflect('OC\AppFramework\Utility\EndController', 'test3');
+		$reader->reflect('Test\AppFramework\Utility\EndController', 'test3');
 
 		$this->assertFalse($reader->hasAnnotation('Annotation'));
 	}
diff --git a/tests/lib/archive/tar.php b/tests/lib/archive/tartest.php
similarity index 71%
rename from tests/lib/archive/tar.php
rename to tests/lib/archive/tartest.php
index 2d20bb4c3b199295f3589f89c287070a170dc385..998ce201e72bc77835f1b2ed10502db469c28016 100644
--- a/tests/lib/archive/tar.php
+++ b/tests/lib/archive/tartest.php
@@ -6,23 +6,26 @@
  * See the COPYING-README file.
  */
 
+namespace Test\Archive;
+
+
 use OC\Archive\TAR;
 
-class Test_Archive_TAR extends Test_Archive {
+class TARTest extends TestBase {
 	protected function setUp() {
 		parent::setUp();
 
-		if (OC_Util::runningOnWindows()) {
+		if (\OC_Util::runningOnWindows()) {
 			$this->markTestSkipped('[Windows] tar archives are not supported on Windows');
 		}
 	}
 
 	protected function getExisting() {
-		$dir = OC::$SERVERROOT . '/tests/data';
+		$dir = \OC::$SERVERROOT . '/tests/data';
 		return new TAR($dir . '/data.tar.gz');
 	}
 
 	protected function getNew() {
-		return new TAR(OCP\Files::tmpFile('.tar.gz'));
+		return new TAR(\OCP\Files::tmpFile('.tar.gz'));
 	}
 }
diff --git a/tests/lib/archive.php b/tests/lib/archive/testbase.php
similarity index 89%
rename from tests/lib/archive.php
rename to tests/lib/archive/testbase.php
index 690b4378b88a10dfe9cbe79eb2d07418db2c6fea..5bf4d9d43ea4382a10402fa79ca695cf4e9bc8fb 100644
--- a/tests/lib/archive.php
+++ b/tests/lib/archive/testbase.php
@@ -6,20 +6,23 @@
  * See the COPYING-README file.
  */
 
-abstract class Test_Archive extends \Test\TestCase {
+namespace Test\Archive;
+
+
+abstract class TestBase extends \Test\TestCase {
 	/**
-	 * @var OC_Archive
+	 * @var \OC\Archive\Archive
 	 */
 	protected $instance;
 
 	/**
 	 * get the existing test archive
-	 * @return OC_Archive
+	 * @return \OC\Archive\Archive
 	 */
 	abstract protected function getExisting();
 	/**
 	 * get a new archive for write testing
-	 * @return OC_Archive
+	 * @return \OC\Archive\Archive
 	 */
 	abstract protected function getNew();
 
@@ -51,17 +54,17 @@ abstract class Test_Archive extends \Test\TestCase {
 
 	public function testContent() {
 		$this->instance=$this->getExisting();
-		$dir=OC::$SERVERROOT.'/tests/data';
+		$dir=\OC::$SERVERROOT.'/tests/data';
 		$textFile=$dir.'/lorem.txt';
 		$this->assertEquals(file_get_contents($textFile), $this->instance->getFile('lorem.txt'));
 
-		$tmpFile=OCP\Files::tmpFile('.txt');
+		$tmpFile=\OCP\Files::tmpFile('.txt');
 		$this->instance->extractFile('lorem.txt', $tmpFile);
 		$this->assertEquals(file_get_contents($textFile), file_get_contents($tmpFile));
 	}
 
 	public function testWrite() {
-		$dir=OC::$SERVERROOT.'/tests/data';
+		$dir=\OC::$SERVERROOT.'/tests/data';
 		$textFile=$dir.'/lorem.txt';
 		$this->instance=$this->getNew();
 		$this->assertEquals(0, count($this->instance->getFiles()));
@@ -76,7 +79,7 @@ abstract class Test_Archive extends \Test\TestCase {
 	}
 
 	public function testReadStream() {
-		$dir=OC::$SERVERROOT.'/tests/data';
+		$dir=\OC::$SERVERROOT.'/tests/data';
 		$this->instance=$this->getExisting();
 		$fh=$this->instance->getStream('lorem.txt', 'r');
 		$this->assertTrue((bool)$fh);
@@ -85,11 +88,11 @@ abstract class Test_Archive extends \Test\TestCase {
 		$this->assertEquals(file_get_contents($dir.'/lorem.txt'), $content);
 	}
 	public function testWriteStream() {
-		$dir=OC::$SERVERROOT.'/tests/data';
+		$dir=\OC::$SERVERROOT.'/tests/data';
 		$this->instance=$this->getNew();
 		$fh=$this->instance->getStream('lorem.txt', 'w');
 		$source=fopen($dir.'/lorem.txt', 'r');
-		OCP\Files::streamCopy($source, $fh);
+		\OCP\Files::streamCopy($source, $fh);
 		fclose($source);
 		fclose($fh);
 		$this->assertTrue($this->instance->fileExists('lorem.txt'));
@@ -107,18 +110,18 @@ abstract class Test_Archive extends \Test\TestCase {
 		$this->assertFalse($this->instance->fileExists('/test/'));
 	}
 	public function testExtract() {
-		$dir=OC::$SERVERROOT.'/tests/data';
+		$dir=\OC::$SERVERROOT.'/tests/data';
 		$this->instance=$this->getExisting();
-		$tmpDir=OCP\Files::tmpFolder();
+		$tmpDir=\OCP\Files::tmpFolder();
 		$this->instance->extract($tmpDir);
 		$this->assertEquals(true, file_exists($tmpDir.'lorem.txt'));
 		$this->assertEquals(true, file_exists($tmpDir.'dir/lorem.txt'));
 		$this->assertEquals(true, file_exists($tmpDir.'logo-wide.png'));
 		$this->assertEquals(file_get_contents($dir.'/lorem.txt'), file_get_contents($tmpDir.'lorem.txt'));
-		OCP\Files::rmdirr($tmpDir);
+		\OCP\Files::rmdirr($tmpDir);
 	}
 	public function testMoveRemove() {
-		$dir=OC::$SERVERROOT.'/tests/data';
+		$dir=\OC::$SERVERROOT.'/tests/data';
 		$textFile=$dir.'/lorem.txt';
 		$this->instance=$this->getNew();
 		$this->instance->addFile('lorem.txt', $textFile);
@@ -131,7 +134,7 @@ abstract class Test_Archive extends \Test\TestCase {
 		$this->assertFalse($this->instance->fileExists('target.txt'));
 	}
 	public function testRecursive() {
-		$dir=OC::$SERVERROOT.'/tests/data';
+		$dir=\OC::$SERVERROOT.'/tests/data';
 		$this->instance=$this->getNew();
 		$this->instance->addRecursive('/dir', $dir);
 		$this->assertTrue($this->instance->fileExists('/dir/lorem.txt'));
diff --git a/tests/lib/archive/zip.php b/tests/lib/archive/ziptest.php
similarity index 69%
rename from tests/lib/archive/zip.php
rename to tests/lib/archive/ziptest.php
index 2f4c9cace1d374345c2a188913b43afa7e10ac8a..8d639e0d686aaa8cc8ef7055185727e1196a6b95 100644
--- a/tests/lib/archive/zip.php
+++ b/tests/lib/archive/ziptest.php
@@ -6,23 +6,26 @@
  * See the COPYING-README file.
  */
 
+namespace Test\Archive;
+
+
 use OC\Archive\ZIP;
 
-class Test_Archive_ZIP extends Test_Archive {
+class ZIPTest extends TestBase {
 	protected function setUp() {
 		parent::setUp();
 
-		if (OC_Util::runningOnWindows()) {
+		if (\OC_Util::runningOnWindows()) {
 			$this->markTestSkipped('[Windows] ');
 		}
 	}
 
 	protected function getExisting() {
-		$dir = OC::$SERVERROOT . '/tests/data';
+		$dir = \OC::$SERVERROOT . '/tests/data';
 		return new ZIP($dir . '/data.zip');
 	}
 
 	protected function getNew() {
-		return new ZIP(OCP\Files::tmpFile('.zip'));
+		return new ZIP(\OCP\Files::tmpFile('.zip'));
 	}
 }
diff --git a/tests/lib/cache/cappedmemorycache.php b/tests/lib/cache/cappedmemorycache.php
index a8fb273b80ae5ad39793ed1471b47c97e537c122..c9c74de72db55a78879a03dc06d11831d9ac67bc 100644
--- a/tests/lib/cache/cappedmemorycache.php
+++ b/tests/lib/cache/cappedmemorycache.php
@@ -29,7 +29,7 @@ namespace Test\Cache;
  *
  * @package Test\Cache
  */
-class CappedMemoryCache extends \Test_Cache {
+class CappedMemoryCache extends TestCache {
 	public function setUp() {
 		parent::setUp();
 		$this->instance = new \OC\Cache\CappedMemoryCache();
diff --git a/tests/lib/cache/file.php b/tests/lib/cache/filecache.php
similarity index 99%
rename from tests/lib/cache/file.php
rename to tests/lib/cache/filecache.php
index 92b784bf8ea92141cc559b71ddac583d55e2459a..a85b12671f3c55c90bc38328821ccd61dd307c39 100644
--- a/tests/lib/cache/file.php
+++ b/tests/lib/cache/filecache.php
@@ -29,7 +29,7 @@ namespace Test\Cache;
  *
  * @package Test\Cache
  */
-class FileCache extends \Test_Cache {
+class FileCache extends TestCache {
 	/**
 	 * @var string
 	 * */
diff --git a/tests/lib/cache.php b/tests/lib/cache/testcache.php
similarity index 97%
rename from tests/lib/cache.php
rename to tests/lib/cache/testcache.php
index a91f37467d2f56298f5978dd2c215933b43b9c8e..75ff65207eed748370f7c400161c10c02a24f184 100644
--- a/tests/lib/cache.php
+++ b/tests/lib/cache/testcache.php
@@ -6,7 +6,9 @@
  * See the COPYING-README file.
  */
 
-abstract class Test_Cache extends \Test\TestCase {
+namespace Test\Cache;
+
+abstract class TestCache extends \Test\TestCase {
 	/**
 	 * @var \OCP\ICache cache;
 	 */
diff --git a/tests/lib/command/background.php b/tests/lib/command/backgroundjobs.php
similarity index 100%
rename from tests/lib/command/background.php
rename to tests/lib/command/backgroundjobs.php
diff --git a/tests/lib/comments/comment.php b/tests/lib/comments/commenttest.php
similarity index 98%
rename from tests/lib/comments/comment.php
rename to tests/lib/comments/commenttest.php
index 9b3f2ab166e7d4f4baf25050ce8680a0b17101a0..b55c345f71fc4d24d9dc167b50514c67ed909907 100644
--- a/tests/lib/comments/comment.php
+++ b/tests/lib/comments/commenttest.php
@@ -5,8 +5,7 @@ namespace Test\Comments;
 use OCP\Comments\IComment;
 use Test\TestCase;
 
-class Test_Comments_Comment extends TestCase
-{
+class CommentTest extends TestCase {
 
 	public function testSettersValidInput() {
 		$comment = new \OC\Comments\Comment();
diff --git a/tests/lib/comments/manager.php b/tests/lib/comments/managertest.php
similarity index 99%
rename from tests/lib/comments/manager.php
rename to tests/lib/comments/managertest.php
index c55f4728883b22ccd9fc08ded2f9c09f7d1de9dc..90a8399eb2b3b02b23b274d360e2e7ea3b0f0dde 100644
--- a/tests/lib/comments/manager.php
+++ b/tests/lib/comments/managertest.php
@@ -6,12 +6,11 @@ use OCP\Comments\ICommentsManager;
 use Test\TestCase;
 
 /**
- * Class Test_Comments_Manager
+ * Class ManagerTest
  *
  * @group DB
  */
-class Test_Comments_Manager extends TestCase
-{
+class ManagerTest extends TestCase {
 
 	public function setUp() {
 		parent::setUp();
diff --git a/tests/lib/db/mysqlmigration.php b/tests/lib/db/mysqlmigration.php
index 51e8801dc3b1079c11c89f03e23a80776a7f9042..42ed6ba7251fa9f7bed91d8a8d799d0684e00e33 100644
--- a/tests/lib/db/mysqlmigration.php
+++ b/tests/lib/db/mysqlmigration.php
@@ -6,12 +6,14 @@
  * See the COPYING-README file.
  */
 
+namespace Test\DB;
+
 /**
- * Class TestMySqlMigration
+ * Class MySqlMigration
  *
  * @group DB
  */
-class TestMySqlMigration extends \Test\TestCase {
+class MySqlMigration extends \Test\TestCase {
 
 	/** @var \Doctrine\DBAL\Connection */
 	private $connection;
diff --git a/tests/lib/db/sqlitemigration.php b/tests/lib/db/sqlitemigration.php
index f23f4d4ee86c51e6d7fee6977b260f6880cf347a..176b947e310d4e07448deec7bbeec69d6a7392f3 100644
--- a/tests/lib/db/sqlitemigration.php
+++ b/tests/lib/db/sqlitemigration.php
@@ -6,12 +6,14 @@
  * See the COPYING-README file.
  */
 
+namespace Test\DB;
+
 /**
- * Class TestSqliteMigration
+ * Class SqliteMigration
  *
  * @group DB
  */
-class TestSqliteMigration extends \Test\TestCase {
+class SqliteMigration extends \Test\TestCase {
 
 	/** @var \Doctrine\DBAL\Connection */
 	private $connection;
diff --git a/tests/lib/encryption/keys/storage.php b/tests/lib/encryption/keys/storagetest.php
similarity index 100%
rename from tests/lib/encryption/keys/storage.php
rename to tests/lib/encryption/keys/storagetest.php
diff --git a/tests/lib/memcache/cache.php b/tests/lib/memcache/cache.php
index 725b0fbbf57ed456d4e0acfd53b0b54ddc335bc5..8d6a231dd8d645ece6d4c782313578291a19e8b5 100644
--- a/tests/lib/memcache/cache.php
+++ b/tests/lib/memcache/cache.php
@@ -9,7 +9,7 @@
 
 namespace Test\Memcache;
 
-abstract class Cache extends \Test_Cache {
+abstract class Cache extends \Test\Cache\TestCache {
 	/**
 	 * @var \OCP\IMemcache cache;
 	 */