Index: src/testing/CMakeLists.txt
===================================================================
--- src/testing/CMakeLists.txt	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/CMakeLists.txt	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,80 @@
+######################
+#
+#    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.
+#
+######################
+
+SET(files_UI
+)
+
+SET(files_CPP
+	webserverprocess.cpp
+	private/webserverrunner.cpp
+)
+
+INCLUDE_DIRECTORIES(
+	${CMAKE_CURRENT_BINARY_DIR}
+	${CMAKE_CURRENT_SOURCE_DIR}
+	${CMAKE_CURRENT_BINARY_DIR}/private
+	${CMAKE_CURRENT_SOURCE_DIR}/private
+)
+ADD_DEFINITIONS(-DSI_BUILD_TESTING)
+SET(LINK_LIBRARIES ${QT_LIBRARIES})
+SET(LIBOUTDIR ${LIBRARY_OUTPUT_PATH})
+SET(SHAREDIR ${share_DIR})
+SET(WEBSERVICE_SERVER_DOCROOT ${WEB_OUTPUT_DIRECTORY})
+CONFIGURE_FILE(
+	${CMAKE_CURRENT_SOURCE_DIR}/sitestingconfig.h.in
+	${CMAKE_CURRENT_BINARY_DIR}/sitestingconfig.h
+)
+
+# 	QT5_WRAP_UI(libengsas_UI_H ${libengsas_UI})
+# 	QT5_ADD_TRANSLATION(libengsas_TRANS ${libengsas_TS})
+
+ADD_LIBRARY(libsiweather_testing SHARED
+	${files_CPP}
+# 	${files_UI_H}
+# 	${files_TRANS}
+)
+
+TARGET_LINK_LIBRARIES(libsiweather_testing
+  ${LINK_LIBRARIES}
+)
+
+qt5_use_modules(libsiweather_testing Core Network)
+
+SET_TARGET_PROPERTIES(libsiweather_testing PROPERTIES
+	OUTPUT_NAME "siweather-testing"
+	VERSION ${TARGET_VERSION_MAJOR}.${TARGET_VERSION_MINOR}.${${PROJECT_NAME}_PATCH_LEVEL}
+	SOVERSION ${TARGET_VERSION_MAJOR})
+
+# INSTALL(
+#   FILES ${files_TRANS}
+#   DESTINATION ${qm_DIR}
+#   COMPONENT library
+# )
+
+# SET(LIBENGSAS_VERSION ${${PROJECT_NAME}_VERSION})
+# SET(QTVERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
+# SET(depends_XML ${CMAKE_BINARY_DIR}/depends/libengsas-core.xml)
+# CONFIGURE_FILE(libengsas-core.xml.in ${depends_XML})
+# INSTALL(
+# 	FILES ${depends_XML}
+# 	DESTINATION ${depends_DIR}
+# 	COMPONENT library
+# )
Index: src/testing/private/webserverrunner.cpp
===================================================================
--- src/testing/private/webserverrunner.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/private/webserverrunner.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,54 @@
+/*
+		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: src/testing/private/webserverrunner.h
===================================================================
--- src/testing/private/webserverrunner.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/private/webserverrunner.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,40 @@
+/*
+		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/sitestingconfig.h.in
===================================================================
--- src/testing/sitestingconfig.h.in	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/sitestingconfig.h.in	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,31 @@
+/*
+    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 SITESTINGCONFIG_H
+#define SITESTINGCONFIG_H
+
+#cmakedefine WEBSERVICE_BASE_URL "@WEBSERVICE_BASE_URL_COMPLETE@"
+#cmakedefine WEBSERVICE_SERVER_HOST "@WEBSERVICE_SERVER_HOST@"
+#cmakedefine WEBSERVICE_SERVER_PORT "@WEBSERVICE_SERVER_PORT@"
+#cmakedefine WEBSERVICE_SERVER_DOCROOT "@WEBSERVICE_SERVER_DOCROOT@"
+#cmakedefine PHP_EXECUTABLE "@PHP_EXECUTABLE@"
+
+#cmakedefine WEBSERVICE_API_VERSION "@WEBSERVICE_API_VERSION@"
+
+#endif // SITESTINGCONFIG_H
Index: src/testing/sitestingglobal.h
===================================================================
--- src/testing/sitestingglobal.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/sitestingglobal.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,34 @@
+/*
+    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.
+*/
+
+/**
+ * @brief Library with helpers to run the tests
+	* @author Joachim Langenbach
+	* 
+  */
+#ifndef SITESTINGGLOBAL_H
+#define SITESTINGGLOBAL_H
+
+#ifdef SI_BUILD_TESTING
+	#define SI_TESTING_EXPORT Q_DECL_EXPORT
+#else
+  #define SI_TESTING_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // SITESTINGGLOBAL_H
Index: src/testing/webserverprocess.cpp
===================================================================
--- src/testing/webserverprocess.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/webserverprocess.cpp	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,139 @@
+/*
+    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.
+*/
+
+#include "webserverprocess.h"
+#include "moc_webserverprocess.cpp"
+
+#include "sitestingconfig.h"
+
+#include "webserverrunner.h"
+
+#include <QTimer>
+#include <QTime>
+#include <QCoreApplication>
+#include <QTcpSocket>
+#include <QRegExp>
+
+WebserverProcess::WebserverProcess(QObject* parent)
+ : QThread(parent)
+{
+	_runner = NULL;
+	_finishedStartup = false;
+	connect(this, SIGNAL(started()), this, SLOT(setStarted()));
+}
+
+WebserverProcess::~WebserverProcess()
+{
+	if(_runner)
+		delete _runner;
+}
+
+QString WebserverProcess::webserviceBaseUrl()
+{
+	return appendSlashToUrl(QString(WEBSERVICE_BASE_URL));
+}
+
+QString WebserverProcess::webserviceApiVersion()
+{
+	return QString(WEBSERVICE_API_VERSION);
+}
+
+
+bool WebserverProcess::isRunning() const
+{
+	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;
+	}
+	QTcpSocket *socket = new QTcpSocket();
+	socket->connectToHost(capturedTexts[1], capturedTexts[2].toInt(), QIODevice::ReadOnly); 
+	if (!socket->waitForConnected(2000)){
+		qDebug() << QString("Webservice at %1:%2 not reachable").arg(capturedTexts[1]).arg(capturedTexts[2]);
+		delete socket;
+		return false;
+	}
+	socket->close();
+	delete socket;
+	return true;
+}
+
+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())
+		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 ){
+		QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 100);
+		if(isStarted())
+			return true;
+	}
+
+	if(isStarted())
+		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;
+}
+
+QString WebserverProcess::appendSlashToUrl(QString url)
+{
+	if(url.right(1) != "/")
+		url += "/";
+	return url;
+}
Index: src/testing/webserverprocess.h
===================================================================
--- src/testing/webserverprocess.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
+++ src/testing/webserverprocess.h	(revision 915dc1852a6aa7d67755cb64c0cff72edbe7dd4c)
@@ -0,0 +1,64 @@
+/*
+    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 WEBSERVERPROCESS_H
+#define WEBSERVERPROCESS_H
+
+#include <QThread>
+#include <sitestingglobal.h>
+
+class WebserverRunner;
+
+#include <QPointer>
+#include <QProcess>
+
+/**
+ * @brief Starts the php build in webserver to allow testing against the webservice
+ */
+class SI_TESTING_EXPORT WebserverProcess : public QThread {
+	friend WebserverRunner;
+	
+	Q_OBJECT
+	public:
+		WebserverProcess(QObject *parent = NULL);
+		~WebserverProcess();
+
+		static QString webserviceBaseUrl();
+		static QString webserviceApiVersion();
+		
+		bool isRunning() const;
+	
+		void stopThread();
+		void run();
+		bool isStarted();
+		bool waitForStart();
+
+	private slots:
+		void setStarted();
+
+	private:
+		static QString appendSlashToUrl(QString url);
+
+// 		QPointer<QProcess> _webserverProcess;
+// 		int _timeout;
+		WebserverRunner *_runner;
+		bool _finishedStartup;
+};
+
+#endif // WEBSERVERPROCESS_H
