Index: src/webservice/tests/StationsTest.php
===================================================================
--- src/webservice/tests/StationsTest.php	(revision 02fbeb816a6fd00276fc6f4dfc1dd966ba3dc6d5)
+++ src/webservice/tests/StationsTest.php	(revision d55ec21a7baa94629097e8a4e29c682e38829d3c)
@@ -19,7 +19,6 @@
 */
 
-/**
-	* @todo Reset database before this test is run
-	*/
+require_once(__DIR__ ."/TestHelpers/TestSetup.php");
+
 class StationsTest extends PHPUnit_Framework_TestCase
 {
@@ -37,4 +36,16 @@
 		$this->_webserviceConfig = new SiWeather\Webservice\WebserviceConfig();
 		$this->assertNotNull($this->_webserviceConfig);
+
+		$this->_dataDirectory = $this->_webserviceConfig->getConfig("dataDirectory");
+		$this->assertInternaltype("string", $this->_dataDirectory);
+		$this->assertTrue(!empty($this->_dataDirectory));
+		if(file_exists($this->_dataDirectory))
+			$this->assertTrue(TestHelpers\TestSetup::wipeDataDirectory());
+		$this->assertTrue(TestHelpers\TestSetup::databaseSetup());
+    }
+    
+    protected function tearDown(){
+		if(file_exists($this->_dataDirectory))
+			$this->assertTrue(TestHelpers\TestSetup::wipeDataDirectory());
     }
 
@@ -44,18 +55,14 @@
 
 		$this->assertInternalType("array", $stations);
+		$message = "";
+		if(array_key_exists("message", $stations))
+			$message = $stations["message"];
+		$this->assertTrue(!array_key_exists("result", $stations), $message);
 		$this->assertEquals(count($stations), 0);
 	}
-	
-	public function testStationRewrite()
-	{
-		$stations = $this->query("stations");
 
-		$this->assertInternalType("array", $stations);
-		$this->assertEquals(count($stations), 0);
-	}
-	
 	public function testRegisterStationUnprovenLocation()
 	{
-		$baseUrl = $this->_webserviceConfig->webserviceBaseUrl();
+		$baseUrl = TestHelpers\TestSetup::webserviceTestBaseUrl();
 		$this->assertInternalType('string', $baseUrl, "baseUrl is not of type string: ". $baseUrl);
 		$this->assertTrue(!empty($baseUrl), "baseUrl is empty: ". $baseUrl);
@@ -82,5 +89,5 @@
 	public function testRegisterStation()
 	{
-		$baseUrl = $this->_webserviceConfig->webserviceBaseUrl();
+		$baseUrl = TestHelpers\TestSetup::webserviceTestBaseUrl();
 		$this->assertInternalType('string', $baseUrl, "baseUrl is not of type string: ". $baseUrl);
 		$this->assertTrue(!empty($baseUrl), "baseUrl is empty: ". $baseUrl);
@@ -94,5 +101,4 @@
 		);
 
-		// sending must failing register request, caused by unproven location
 		$response = $client->post("index.php/stations/register",
 			[ "json" => ["name" => "My Weather Station", "city" => "Clausthal-Zellerfeld", "longitude" => 10.28152, "latitude" => 51.8281, "email" => "test@example.org"]]
@@ -113,5 +119,5 @@
 	
 	protected function query($url){
-		$baseUrl = $this->_webserviceConfig->webserviceBaseUrl();
+		$baseUrl = TestHelpers\TestSetup::webserviceTestBaseUrl();
 		$this->assertInternalType('string', $baseUrl, "baseUrl is not of type string: ". $baseUrl);
 		$this->assertTrue(!empty($baseUrl), "baseUrl is empty: ". $baseUrl);
@@ -138,4 +144,5 @@
 	protected $_testconfig;
 	protected $_webserviceConfig;
+	protected $_dataDirectory;
 }
 ?>
