Index: src/lib/siwebserviceclient.cpp
===================================================================
--- src/lib/siwebserviceclient.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/lib/siwebserviceclient.cpp	(revision a2330fc0e40995dfadcddd581076ac2842ecd09d)
@@ -66,5 +66,5 @@
 
 	QNetworkRequest request;
-	request.setUrl(QString("%1%2").arg(_baseUrl.toString()).arg("index.php/stations/register"));
+	request.setUrl(QString("%1%2").arg(appendSlashToUrl(_baseUrl.toString())).arg("index.php/stations/register"));
 	request.setRawHeader("User-Agent", QString("SiWeather Library %1").arg(Library::version()).toUtf8());
 	request.setHeader(QNetworkRequest::ContentTypeHeader, 
@@ -126,2 +126,9 @@
 	return reply;
 }
+
+QString SiWebserviceClient::appendSlashToUrl(QString url)
+{
+	if(url.right(1) != "/")
+		url += "/";
+	return url;
+}
Index: src/lib/siwebserviceclient.h
===================================================================
--- src/lib/siwebserviceclient.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/lib/siwebserviceclient.h	(revision a2330fc0e40995dfadcddd581076ac2842ecd09d)
@@ -65,4 +65,6 @@
 
 			private:
+				static QString appendSlashToUrl(QString url);
+
 				QNetworkReply* getNetworkReply(QObject *sender, ReplyType type) const;
 				QUrl _baseUrl;
Index: src/testing/CMakeLists.txt
===================================================================
--- src/testing/CMakeLists.txt	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/CMakeLists.txt	(revision a2330fc0e40995dfadcddd581076ac2842ecd09d)
@@ -25,5 +25,4 @@
 SET(files_CPP
 	webserverprocess.cpp
-	private/webserverrunner.cpp
 )
 
@@ -31,6 +30,4 @@
 	${CMAKE_CURRENT_BINARY_DIR}
 	${CMAKE_CURRENT_SOURCE_DIR}
-	${CMAKE_CURRENT_BINARY_DIR}/private
-	${CMAKE_CURRENT_SOURCE_DIR}/private
 )
 ADD_DEFINITIONS(-DSI_BUILD_TESTING)
@@ -57,5 +54,5 @@
 )
 
-qt5_use_modules(libsiweather_testing Core Network)
+qt5_use_modules(libsiweather_testing Core Network Test)
 
 SET_TARGET_PROPERTIES(libsiweather_testing PROPERTIES
Index: c/testing/private/webserverrunner.cpp
===================================================================
--- src/testing/private/webserverrunner.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
-		Copyright (C) 2012 - 2013 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-    MA 02110-1301  USA.
-*/
-
-
-#include "webserverrunner.h"
-#include "moc_webserverrunner.cpp"
-
-#include "sitestingconfig.h"
-#include "webserverprocess.h"
-
-#include <QProcess>
-#include <QDebug>
-
-WebserverRunner::WebserverRunner()
-	: QObject()
-{
-	
-}
-
-WebserverRunner::~WebserverRunner()
-{
-
-}
-
-void WebserverRunner::start()
-{
-	QStringList arguments;
-	arguments << QString("-S %1:%2").arg(QString(WEBSERVICE_SERVER_HOST)).arg(QString(WEBSERVICE_SERVER_PORT));
- 	arguments << QString("-t %1").arg(WebserverProcess::appendSlashToUrl(QString(WEBSERVICE_SERVER_DOCROOT)));
-
-	qDebug() << QString("%1: Executing %2 %3").arg(metaObject()->className()).arg(QString(PHP_EXECUTABLE)).arg(arguments.join(" "));
-// 	_webserverProcess->setStandardInputFile("/tmp/test-input");
-// 	_webserverProcess->setStandardErrorFile("/tmp/test-error.log");
-// 	_webserverProcess->setStandardOutputFile("/tmp/test-output.log");
-	// must be executed in own thread, QProcess::start isn't working
- 	QProcess::execute(QString(PHP_EXECUTABLE) +" "+ arguments.join(" "));
-}
-
Index: c/testing/private/webserverrunner.h
===================================================================
--- src/testing/private/webserverrunner.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
-		Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-    MA 02110-1301  USA.
-*/
-
-
-#ifndef WEBSERVERRUNNER_H
-#define WEBSERVERRUNNER_H
-
-#include <QObject>
-
-class WebserverRunner : public QObject
-{
-	Q_OBJECT
-	public:
-		WebserverRunner();
-		/**
-		 * @todo How to stop the process?
-		 */
-		~WebserverRunner();
-		
-	public slots:
-		void start();
-};
-
-#endif // WEBSERVERRUNNER_H
Index: src/testing/webserverprocess.cpp
===================================================================
--- src/testing/webserverprocess.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/webserverprocess.cpp	(revision a2330fc0e40995dfadcddd581076ac2842ecd09d)
@@ -23,24 +23,33 @@
 #include "sitestingconfig.h"
 
-#include "webserverrunner.h"
-
-#include <QTimer>
+#include <QTcpSocket>
+#include <QRegExp>
+#include <QNetworkAccessManager>
+#include <QNetworkRequest>
+#include <QNetworkReply>
 #include <QTime>
 #include <QCoreApplication>
-#include <QTcpSocket>
-#include <QRegExp>
+#include <QTest>
+#include <QDir>
 
 WebserverProcess::WebserverProcess(QObject* parent)
- : QThread(parent)
-{
-	_runner = NULL;
-	_finishedStartup = false;
-	connect(this, SIGNAL(started()), this, SLOT(setStarted()));
+ : QObject(parent)
+{
+	_process = new QProcess(this);
+	connect(_process, SIGNAL(error(QProcess::ProcessError)),
+					this, SLOT(processError(QProcess::ProcessError)));
+	connect(_process, SIGNAL(finished(int,QProcess::ExitStatus)),
+					this, SLOT(processFinished(int,QProcess::ExitStatus)));
+	connect(_process, SIGNAL(readyRead()),
+					this, SLOT(processReadyRead()));
 }
 
 WebserverProcess::~WebserverProcess()
 {
-	if(_runner)
-		delete _runner;
+	if(_process && _process->state() == QProcess::Running){
+		_process->kill();
+		_process->waitForFinished(5000);
+	}
+	cleanupDataDirectory();
 }
 
@@ -58,8 +67,11 @@
 bool WebserverProcess::isRunning() const
 {
+	if(!_process)
+		return false;
+
 	QRegExp regex("http:\\/\\/([^:]+)+:([0-9]+)");
 	if(regex.indexIn(webserviceBaseUrl()) < 0){
-			qDebug() << QString("Regex %1 to find host and port not matching in %2").arg(regex.pattern()).arg(webserviceBaseUrl());
-			return false;
+		qDebug() << QString("Regex %1 to find host and port not matching in %2").arg(regex.pattern()).arg(webserviceBaseUrl());
+		return false;
 	}
 	QStringList capturedTexts = regex.capturedTexts();
@@ -70,5 +82,5 @@
 	QTcpSocket *socket = new QTcpSocket();
 	socket->connectToHost(capturedTexts[1], capturedTexts[2].toInt(), QIODevice::ReadOnly); 
-	if (!socket->waitForConnected(2000)){
+	if (!socket->waitForConnected()){
 		qDebug() << QString("Webservice at %1:%2 not reachable").arg(capturedTexts[1]).arg(capturedTexts[2]);
 		delete socket;
@@ -80,54 +92,128 @@
 }
 
-void WebserverProcess::stopThread()
-{
-	// stopping thread
-	// cancel query first
-	// stop eventloop
-	quit();
-	// wait 2000 seconds to stop the eventloop
-	wait(2000);
-}
-
-void WebserverProcess::run()
-{
-	_runner = new WebserverRunner();
-	QTimer::singleShot(1, _runner, SLOT(start()));
-	exec();
-}
-
-bool WebserverProcess::isStarted()
-{
-	return _finishedStartup;
-}
-
-bool WebserverProcess::waitForStart()
-{
-	if(isStarted())
+bool WebserverProcess::start()
+{
+	if(!_process)
+		return false;
+
+	QStringList arguments;
+	arguments << QString("-S %1:%2").arg(QString(WEBSERVICE_SERVER_HOST)).arg(QString(WEBSERVICE_SERVER_PORT));
+	arguments << QString("-t %1").arg(QString(WEBSERVICE_SERVER_DOCROOT));
+	
+	connect(_process, SIGNAL(error(QProcess::ProcessError)),
+					this, SLOT(processError(QProcess::ProcessError)));
+	connect(_process, SIGNAL(finished(int,QProcess::ExitStatus)),
+					this, SLOT(processFinished(int,QProcess::ExitStatus)));
+	connect(_process, SIGNAL(readyRead()),
+					this, SLOT(processReadyRead()));
+	
+ 	_process->setReadChannelMode(QProcess::ForwardedChannels);
+	_process->start(QString("/usr/bin/php ")+ arguments.join(" "));
+	// give the php webserver a few seconds to start
+ 	QTest::qWait(5000);
+ 	if(!isRunning())
+		return false;
+	return true;
+}
+
+bool WebserverProcess::stop()
+{
+	if(!_process)
 		return true;
-
-	// wait for thread to be started
-	QTime dieTime = QTime::currentTime().addSecs(2);
-	// Userevents should be excluded see http://lists.trolltech.com/qt-interest/2007-01/thread00133-0.html
-	while( QTime::currentTime() < dieTime ){
+	_process->terminate();
+	return _process->waitForFinished(5000);
+}
+
+
+bool WebserverProcess::setup()
+{
+	if(!_process)
+		return false;
+
+	QRegExp regex("http:\\/\\/([^:]+)+:([0-9]+)");
+	if(regex.indexIn(webserviceBaseUrl()) < 0){
+		qDebug() << QString("Regex %1 to find host and port not matching in %2").arg(regex.pattern()).arg(webserviceBaseUrl());
+		return false;
+	}
+	QStringList capturedTexts = regex.capturedTexts();
+	if(capturedTexts.size() != 3){
+		qDebug() << QString("Regex %1 does not matches enough items in %2").arg(regex.pattern()).arg(webserviceBaseUrl());
+		return false;
+	}
+	QNetworkAccessManager *manager = new QNetworkAccessManager(this);
+	QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(QString("%1%2").arg(webserviceBaseUrl()).arg("index.php/setup"))));
+	QTime dieTime = QTime::currentTime().addSecs(30);
+	while(QTime::currentTime() < dieTime){
+		if(reply->isFinished())
+			break;
 		QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 100);
-		if(isStarted())
-			return true;
-	}
-
-	if(isStarted())
+	}
+	bool result = reply->isFinished();
+	reply->deleteLater();
+	manager->deleteLater();
+	return result;
+}
+
+bool WebserverProcess::cleanupDataDirectory()
+{
+	QDir dir(QString(WEBSERVICE_SERVER_DOCROOT));
+	if(!dir.exists())
 		return true;
-	return false;
-}
-
-void WebserverProcess::setStarted()
-{
-	// Give the php webserver 5 seconds to start
-	QTime dieTime = QTime::currentTime().addSecs(5);
-	// Userevents should be excluded see http://lists.trolltech.com/qt-interest/2007-01/thread00133-0.html
-	while( QTime::currentTime() < dieTime ){
-		QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 100);
-	}
-	_finishedStartup = true;
+	if(!dir.removeRecursively())
+		return false;
+	return true;
+}
+
+void WebserverProcess::processError(QProcess::ProcessError error)
+{
+	QString errorString;
+	switch(error){
+		case QProcess::FailedToStart:
+			errorString = "FailedToStart";
+			break;
+		case QProcess::Crashed:
+			errorString = "Crashed";
+			break;
+		case QProcess::Timedout:
+			errorString = "Timedout";
+			break;
+		case QProcess::WriteError:
+			errorString = "WriteError";
+			break;
+		case QProcess::ReadError:
+			errorString = "ReadError";
+			break;
+		default:
+			errorString = "Unknown";
+	}
+
+	qDebug() << QString("%1: Error %2 (%3)")
+								.arg(metaObject()->className()).arg(errorString).arg(int(error));
+}
+
+void WebserverProcess::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
+{
+	QString exitString;
+	switch(exitStatus){
+		case QProcess::NormalExit:
+			exitString = "NormalExit";
+			break;
+		case QProcess::CrashExit:
+			exitString = "CrashExit";
+			break;
+		default:
+			exitString = "Unknown";
+	}
+	qDebug() << QString("%1: Finished with exit code %2 and staus %3 (%4)")
+								.arg(metaObject()->className()).arg(exitCode).arg(exitString).arg(int(exitStatus));
+}
+
+void WebserverProcess::processReadyRead()
+{
+	QProcess *process = qobject_cast<QProcess*>(sender());
+	if(!process)
+		return;
+	qDebug() << QString("%1: Read %2")
+							.arg(metaObject()->className()).arg(QString::fromUtf8(process->readAll()));
 }
 
Index: src/testing/webserverprocess.h
===================================================================
--- src/testing/webserverprocess.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/webserverprocess.h	(revision a2330fc0e40995dfadcddd581076ac2842ecd09d)
@@ -21,8 +21,6 @@
 #define WEBSERVERPROCESS_H
 
-#include <QThread>
+#include <QObject>
 #include <sitestingglobal.h>
-
-class WebserverRunner;
 
 #include <QPointer>
@@ -32,7 +30,5 @@
  * @brief Starts the php build in webserver to allow testing against the webservice
  */
-class SI_TESTING_EXPORT WebserverProcess : public QThread {
-	friend WebserverRunner;
-	
+class SI_TESTING_EXPORT WebserverProcess : public QObject {
 	Q_OBJECT
 	public:
@@ -44,20 +40,28 @@
 		
 		bool isRunning() const;
-	
-		void stopThread();
-		void run();
-		bool isStarted();
-		bool waitForStart();
+		bool start();
+		/**
+		 * @brief Stops the webservice with QProcess::terminate(). The destructor ~WebserverProcess() calls QProcess::kill() to stop the webserver process.
+		 */
+		bool stop();
+		/**
+		 * @brief Calls the setup page of the webservice. Returns true, if the call was successfully. This does not means, the setup was successfully.
+		 */
+		bool setup();
+		/**
+		 * @brief Removes the webservice data directory to cleanup test case. It is called by ~WebserverProcess().
+		 */
+		bool cleanupDataDirectory();
 
 	private slots:
-		void setStarted();
+		void processError(QProcess::ProcessError error);
+		void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
+		void processReadyRead();
 
 	private:
 		static QString appendSlashToUrl(QString url);
 
-// 		QPointer<QProcess> _webserverProcess;
-// 		int _timeout;
-		WebserverRunner *_runner;
-		bool _finishedStartup;
+		QPointer<QProcess> _process;
+		int _timeout;
 };
 
Index: src/tests/siwebserviceclienttest.cpp
===================================================================
--- src/tests/siwebserviceclienttest.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/tests/siwebserviceclienttest.cpp	(revision a2330fc0e40995dfadcddd581076ac2842ecd09d)
@@ -34,13 +34,13 @@
 {
 	_webserverProcess = new WebserverProcess(this);
-	_webserverProcess->start();
-	QCOMPARE(_webserverProcess->waitForStart(), true);
+	QCOMPARE(_webserverProcess->start(), true);
+	QCOMPARE(_webserverProcess->isRunning(), true);
+	QCOMPARE(_webserverProcess->setup(), true);
 }
 
-void SiWebserviceClientTest::cleanUpTestCase()
+void SiWebserviceClientTest::cleanupTestCase()
 {
 	QVERIFY(_webserverProcess);
-// 	QCOMPARE(_webserverProcess->stop(), true);
-	_webserverProcess->stopThread();
+	QCOMPARE(_webserverProcess->stop(), true);
 }
 
@@ -107,4 +107,7 @@
 	QVariantList data = spyFinishedStationsRegister.takeFirst();
 	QCOMPARE(data.count(), 3);
+	if(!data[0].toBool()){
+		QTest::qWarn(data[2].toString().toUtf8());
+	}
 	QCOMPARE(data[0].toBool(), true);
 	QCOMPARE(data[1].toUuid().isNull(), false);
Index: src/tests/siwebserviceclienttest.h
===================================================================
--- src/tests/siwebserviceclienttest.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/tests/siwebserviceclienttest.h	(revision a2330fc0e40995dfadcddd581076ac2842ecd09d)
@@ -30,5 +30,5 @@
 	private slots:
 		void initTestCase();
-		void cleanUpTestCase();
+		void cleanupTestCase();
 		
 		void apiVersion();
