diff --git a/Code/Mantid/Framework/MDEvents/test/ImportMDEventWorkspaceTest.h b/Code/Mantid/Framework/MDEvents/test/ImportMDEventWorkspaceTest.h
index f6bd6b98ecc86e5cd9db2490bf0e8a68659b4de9..a44b47c78671f34202aefe8279e2bc9a1795b49e 100644
--- a/Code/Mantid/Framework/MDEvents/test/ImportMDEventWorkspaceTest.h
+++ b/Code/Mantid/Framework/MDEvents/test/ImportMDEventWorkspaceTest.h
@@ -8,8 +8,10 @@
 #include <iostream>
 #include <fstream>
 #include <iomanip>
-
 #include "MantidMDEvents/ImportMDEventWorkspace.h"
+#include "MantidKernel/ConfigService.h"
+#include <Poco/Path.h>
+
 
 using namespace Mantid;
 using namespace Mantid::MDEvents;
@@ -76,9 +78,12 @@ class MDFileObject
 public:
 
   /// Create a simple input file.
-  MDFileObject(const FileContentsBuilder& builder = FileContentsBuilder(), std::string filename="test_import_md_event_workspace_file.txt") : m_filename(filename)
+  MDFileObject(const FileContentsBuilder& builder = FileContentsBuilder(), std::string filename="test_import_md_event_workspace_file.txt") 
   {
-    m_file.open (filename.c_str());
+    Poco::Path path(Mantid::Kernel::ConfigService::Instance().getTempDir().c_str());
+    path.append(filename);
+    m_filename = path.toString();
+    m_file.open (m_filename.c_str(), std::ios_base::out);
     // Invoke the builder to create the contents of the file.
     m_file << builder.create();
     m_file.close();
diff --git a/Code/Mantid/Framework/MDEvents/test/ImportMDHistoWorkspaceTest.h b/Code/Mantid/Framework/MDEvents/test/ImportMDHistoWorkspaceTest.h
index 3d4afe7050607f7e8dabc92f5af6962381ca885e..030c22cdbffb5e00904a76e0009b953b5eb0602a 100644
--- a/Code/Mantid/Framework/MDEvents/test/ImportMDHistoWorkspaceTest.h
+++ b/Code/Mantid/Framework/MDEvents/test/ImportMDHistoWorkspaceTest.h
@@ -9,6 +9,8 @@
 #include <fstream>
 #include "MantidMDEvents/ImportMDHistoWorkspace.h"
 #include "MantidAPI/IMDHistoWorkspace.h"
+#include "MantidKernel/ConfigService.h"
+#include <Poco/Path.h>
 
 using namespace Mantid;
 using namespace Mantid::MDEvents;
@@ -22,9 +24,12 @@ class MDFileObject
 public:
 
   /// Create a simple input file.
-  MDFileObject(const std::string& filename, const size_t& size) : m_filename(filename)
+  MDFileObject(const std::string& filename, const size_t& size) 
   {
-    m_file.open (filename.c_str());
+    Poco::Path path(Mantid::Kernel::ConfigService::Instance().getTempDir().c_str());
+    path.append(filename);
+    m_filename = path.toString();
+    m_file.open (m_filename.c_str(), std::ios_base::out);
     for(size_t i=1; i<size+1;++i)
     {
       m_file << i << "\t" << i+1 << std::endl;