Index: src/UIElements/Qt4/QtUIFactory.cpp
===================================================================
--- src/UIElements/Qt4/QtUIFactory.cpp	(revision 3054689a58736f5438fa03886a4337356078607b)
+++ src/UIElements/Qt4/QtUIFactory.cpp	(revision 15e1978cca9c4568b8ac921a0fee1cac72517d81)
@@ -37,4 +37,6 @@
 #include <string.h>
 
+#include <boost/filesystem/path.hpp>
+
 #include <Qt/qapplication.h>
 
@@ -44,26 +46,60 @@
 #include "UIElements/Qt4/QtDialog.hpp"
 
+// boost::python uses placement new which is incompatible with MemDebug.
+#ifdef HAVE_PYTHON
+#include "Python/PythonScripting.hpp"
+#endif
+
 #include "CodePatterns/MemDebug.hpp"
 
-#include "version.h"
 #include "Helpers/defs.hpp"
 
 using namespace std;
 
-QtUIFactory::QtUIFactory() :
-  argc(1)
+QtUIFactory::QtUIFactory(int _argc, char **_argv) :
+    argc(1),
+    argv(new char*[1]),
+    testlauncher_Interrupted(false),
+    testlauncher_thread(NULL)
 {
-  // For now we just fake the command line parameters to make QT happy
-  argv = new char*[1];
-  argv[0] = new char[256];
-  strcpy(argv[0],MOLECUILDERVERSION);
-  app = new QApplication(argc,argv);
+
+  // check whether we are in test mode
+  if ((_argc > 1) && (isTestMode(_argv[1]))) {
+#ifdef HAVE_BOOST_THREAD_HPP
+    std::vector<std::string> scripts;
+    scripts.reserve(_argc-1);
+    for (int i=2;i<_argc;++i)
+      scripts.push_back(std::string(_argv[i]));
+
+    // prepare an extra thread
+    std::cout << "TESTLAUNCHER: Preparing " << std::endl;
+    testlauncher_thread = new boost::thread(
+        boost::bind(&QtUIFactory::testrun, this, scripts));
+#else
+    std::cerr << "Boost::thread support missing! Cannot launch test scripts.\n";
+#endif
+    // use fake commands to not pass test stuff
+    const int length = strlen(_argv[0]);
+    argv[0] = new char[length];
+    strncpy(_argv[0],_argv[0], length);
+    app = new QApplication(argc,argv);
+  } else {
+    app = new QApplication(_argc,_argv);
+  }
 }
 
 QtUIFactory::~QtUIFactory()
 {
-  //delete app;
-  delete [] argv[0];
-  delete [] argv;
+  if (testlauncher_thread != NULL) {
+    // notify testlauncher_thread thread that we wish to terminate
+    testlauncher_thread->interrupt();
+    // wait till it ends
+    testlauncher_thread->join();
+    // and remove
+    delete testlauncher_thread;
+  }
+  // free fake command line argument arrays
+  delete[] argv[0];
+  delete[] argv;
 }
 
@@ -76,6 +112,8 @@
 }
 
-QtUIFactory::description::description() :
-    UIFactory::factoryDescription("Qt4")
+QtUIFactory::description::description(int _argc, char **_argv) :
+    UIFactory::factoryDescription("Qt4"),
+    argc(_argc),
+    argv(_argv)
 {}
 
@@ -84,5 +122,5 @@
 
 UIFactory* QtUIFactory::description::makeFactory(){
-  return new QtUIFactory();
+  return new QtUIFactory(argc, argv);
 }
 
@@ -91,2 +129,42 @@
   return (strncmp(_argument,"--test", 6) == 0);
 }
+
+void QtUIFactory::testrun(const std::vector<std::string> _scripts) const
+{
+  std::cout << "TESTLAUNCHER: Waiting for GUI to set up" << std::endl;
+  testlauncher_sleep(boost::posix_time::seconds(3));
+
+  std::vector<std::string>::const_iterator scriptiter = _scripts.begin();
+  do {
+    // then launch script
+    std::cout << "TESTLAUNCHER: Launching script " << *scriptiter << std::endl;
+    boost::filesystem::path scriptfilename(*scriptiter);
+    ASSERT( boost::filesystem::exists(scriptfilename),
+        "QtUIFactory::testrun() - given testmode script file "
+        +toString(scriptfilename.string())+" does not exist.");
+    executePythonScriptFile(scriptfilename);
+    ++scriptiter;
+
+    std::cout << "TESTLAUNCHER: Sleeping after script" << std::endl;
+    testlauncher_sleep(boost::posix_time::seconds(1.5));
+
+  } while ((scriptiter != _scripts.end()) && (!testlauncher_Interrupted));
+
+  // send quit signal
+  std::cout << "TESTLAUNCHER: Quitting" << std::endl;
+  app->quit();
+}
+
+void QtUIFactory::testlauncher_sleep(const boost::posix_time::time_duration& _period) const
+{
+  try {
+    // first sleep for four seconds
+#if BOOST_VERSION < 105000
+    testlauncher_thread->sleep(boost::get_system_time() + _period);
+#else
+    boost::this_thread::sleep_for(boost::chrono::seconds(4));
+#endif
+  } catch(boost::thread_interrupted &e) {
+    LOG(2, "INFO: testlauncher thread has received stop signal.");
+  }
+}
Index: src/UIElements/Qt4/QtUIFactory.hpp
===================================================================
--- src/UIElements/Qt4/QtUIFactory.hpp	(revision 3054689a58736f5438fa03886a4337356078607b)
+++ src/UIElements/Qt4/QtUIFactory.hpp	(revision 15e1978cca9c4568b8ac921a0fee1cac72517d81)
@@ -17,4 +17,8 @@
 #include "UIElements/UIFactory.hpp"
 
+#include <boost/thread.hpp>
+#include <string>
+#include <vector>
+
 class QApplication;
 
@@ -30,9 +34,13 @@
 
   struct description : public UIFactory::factoryDescription {
-    description();
+    description(int _argc, char **_argv);
     virtual ~description();
 
     virtual UIFactory* makeFactory();
-  };
+
+  private:
+    int argc;
+    char **argv;
+ };
   virtual std::string getUIName(){  return "Qt4";  }
 
@@ -40,11 +48,23 @@
 
 protected:
-  QtUIFactory();
+  QtUIFactory(int _argc, char **_argv);
 
 private:
-  // faked command line arguments
+
+  void testrun(const std::vector<std::string> _scripts) const;
+
+  void testlauncher_sleep(const boost::posix_time::time_duration& _period) const;
+
+private:
+  QApplication *app;
+
   int argc;
   char **argv;
-  QApplication *app;
+
+  //!> internal flag to tell testlauncher_thread to stop
+  mutable bool testlauncher_Interrupted;
+
+  //!> internal thread to call Actions
+  boost::thread *testlauncher_thread;
 };
 
Index: src/builder_init.cpp
===================================================================
--- src/builder_init.cpp	(revision 3054689a58736f5438fa03886a4337356078607b)
+++ src/builder_init.cpp	(revision 15e1978cca9c4568b8ac921a0fee1cac72517d81)
@@ -150,5 +150,5 @@
       ASSERT_DO(Assert::Ask);
       LOG(0, "Setting UI to Qt4.");
-      UIFactory::registerFactory(new QtUIFactory::description());
+      UIFactory::registerFactory(new QtUIFactory::description(argc, argv));
       UIFactory::makeUserInterface("Qt4");
     #else
