diff --git a/Code/Mantid/Framework/API/test/CMakeLists.txt b/Code/Mantid/Framework/API/test/CMakeLists.txt
index 308dcde312c9..3ff1bca32a86 100644
--- a/Code/Mantid/Framework/API/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/API/test/CMakeLists.txt
@@ -4,7 +4,8 @@ if ( CXXTEST_FOUND )
include_directories ( ../../TestHelpers/inc )
# This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ../../TestHelpers/src/ComponentCreationHelper.cpp
+ set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/ComponentCreationHelper.cpp
../../TestHelpers/src/BoxControllerDummyIO.cpp
../../TestHelpers/src/NexusTestHelper.cpp
)
diff --git a/Code/Mantid/Framework/Algorithms/test/CMakeLists.txt b/Code/Mantid/Framework/Algorithms/test/CMakeLists.txt
index 6608673dc1d4..e9f32763feda 100644
--- a/Code/Mantid/Framework/Algorithms/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/Algorithms/test/CMakeLists.txt
@@ -30,7 +30,8 @@ if ( CXXTEST_FOUND )
include_directories ( ../../CurveFitting/inc ../../DataHandling/inc ../../Nexus/inc ../../TestHelpers/inc ../../MDEvents/inc)
# This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ../../TestHelpers/src/ComponentCreationHelper.cpp
+ set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/ComponentCreationHelper.cpp
../../TestHelpers/src/WorkspaceCreationHelper.cpp
../../TestHelpers/src/SANSInstrumentCreationHelper.cpp
../../TestHelpers/src/MDEventsTestHelper.cpp
diff --git a/Code/Mantid/Framework/Crystal/test/CMakeLists.txt b/Code/Mantid/Framework/Crystal/test/CMakeLists.txt
index 0f3f158e3ee3..7159b7659229 100644
--- a/Code/Mantid/Framework/Crystal/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/Crystal/test/CMakeLists.txt
@@ -4,7 +4,8 @@ if ( CXXTEST_FOUND )
include_directories ( ../../DataHandling/inc ../../MDEvents/inc ../../TestHelpers/inc )
# This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ../../TestHelpers/src/ComponentCreationHelper.cpp
+ set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/ComponentCreationHelper.cpp
../../TestHelpers/src/WorkspaceCreationHelper.cpp
../../TestHelpers/src/MDEventsTestHelper.cpp )
cxxtest_add_test ( CrystalTest ${TEST_FILES} )
diff --git a/Code/Mantid/Framework/CurveFitting/test/CMakeLists.txt b/Code/Mantid/Framework/CurveFitting/test/CMakeLists.txt
index ca964a680de6..955da35f9671 100644
--- a/Code/Mantid/Framework/CurveFitting/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/CurveFitting/test/CMakeLists.txt
@@ -4,7 +4,8 @@ if ( CXXTEST_FOUND )
include_directories ( ../../DataHandling/inc ../../TestHelpers/inc )
# This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ../../TestHelpers/src/WorkspaceCreationHelper.cpp
+ set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/WorkspaceCreationHelper.cpp
../../TestHelpers/src/ComponentCreationHelper.cpp
../../TestHelpers/src/StartFrameworkManager.cpp
)
diff --git a/Code/Mantid/Framework/DataHandling/test/CMakeLists.txt b/Code/Mantid/Framework/DataHandling/test/CMakeLists.txt
index f2d0b28d40a4..27e449f8e2b5 100644
--- a/Code/Mantid/Framework/DataHandling/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/DataHandling/test/CMakeLists.txt
@@ -4,10 +4,11 @@ if ( CXXTEST_FOUND )
include_directories ( ../../TestHelpers/inc )
# This variable is used within the cxxtest_add_test macro to build this helper class into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ../../TestHelpers/src/ComponentCreationHelper.cpp
+ set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/ComponentCreationHelper.cpp
+ ../../TestHelpers/src/ScopedFileHelper.cpp
+ ../../TestHelpers/src/StartFrameworkManager.cpp
../../TestHelpers/src/WorkspaceCreationHelper.cpp
- ../../TestHelpers/src/ScopedFileHelper.cpp
- ../../TestHelpers/src/StartFrameworkManager.cpp
)
cxxtest_add_test ( DataHandlingTest ${TEST_FILES} )
diff --git a/Code/Mantid/Framework/DataObjects/test/CMakeLists.txt b/Code/Mantid/Framework/DataObjects/test/CMakeLists.txt
index 91e3a0fa5bf3..294ce1287f46 100644
--- a/Code/Mantid/Framework/DataObjects/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/DataObjects/test/CMakeLists.txt
@@ -4,7 +4,8 @@ if ( CXXTEST_FOUND )
include_directories ( ../../TestHelpers/inc )
# This variable is used within the cxxtest_add_test macro to build this helper class into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ../../TestHelpers/src/ComponentCreationHelper.cpp
+ set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/ComponentCreationHelper.cpp
../../TestHelpers/src/WorkspaceCreationHelper.cpp
../../TestHelpers/src/NexusTestHelper.cpp
)
diff --git a/Code/Mantid/Framework/ICat/test/CMakeLists.txt b/Code/Mantid/Framework/ICat/test/CMakeLists.txt
index a3e21de30687..d32516e51c7d 100644
--- a/Code/Mantid/Framework/ICat/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/ICat/test/CMakeLists.txt
@@ -1,9 +1,12 @@
if ( CXXTEST_FOUND )
include_directories ( SYSTEM ${CXXTEST_INCLUDE_DIR} ${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR} )
+ include_directories ( ../../TestHelpers/inc )
# This variable is used within the cxxtest_add_test macro to build this helper class into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ICatTestHelper.cpp )
+ set ( TESTHELPER_SRCS ICatTestHelper.cpp
+ ../../TestHelpers/src/TearDownWorld.cpp
+ )
# The actual test suite
cxxtest_add_test ( ICatTest ${TEST_FILES} )
diff --git a/Code/Mantid/Framework/ISISLiveData/test/CMakeLists.txt b/Code/Mantid/Framework/ISISLiveData/test/CMakeLists.txt
index 8455391cda80..922418ca8e0e 100644
--- a/Code/Mantid/Framework/ISISLiveData/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/ISISLiveData/test/CMakeLists.txt
@@ -4,7 +4,11 @@ if ( CXXTEST_FOUND )
include_directories ( ../../TestHelpers/inc )
# This variable is used within the cxxtest_add_test macro to build this helper class into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ../../TestHelpers/src/ComponentCreationHelper.cpp ../../TestHelpers/src/WorkspaceCreationHelper.cpp )
+ set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/ComponentCreationHelper.cpp
+ ../../TestHelpers/src/WorkspaceCreationHelper.cpp
+ )
+
cxxtest_add_test ( ISISLiveDataTest ${TEST_FILES} )
target_link_libraries( ISISLiveDataTest ISISLiveData )
# Specify implicit dependency, but don't link to it
diff --git a/Code/Mantid/Framework/LiveData/test/CMakeLists.txt b/Code/Mantid/Framework/LiveData/test/CMakeLists.txt
index 04d3c08516fc..187ad7350b75 100644
--- a/Code/Mantid/Framework/LiveData/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/LiveData/test/CMakeLists.txt
@@ -6,6 +6,7 @@ if ( CXXTEST_FOUND )
# It will go out of scope at the end of this file so doesn't need un-setting
set ( TESTHELPER_SRCS TestDataListener.cpp
TestGroupDataListener.cpp
+ ../../TestHelpers/src/TearDownWorld.cpp
../../TestHelpers/src/ComponentCreationHelper.cpp
../../TestHelpers/src/WorkspaceCreationHelper.cpp
../../TestHelpers/src/StartFrameworkManager.cpp
diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CMakeLists.txt b/Code/Mantid/Framework/MDAlgorithms/test/CMakeLists.txt
index ae8bb05245ae..5ed047d4814e 100644
--- a/Code/Mantid/Framework/MDAlgorithms/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/MDAlgorithms/test/CMakeLists.txt
@@ -4,7 +4,8 @@ if ( CXXTEST_FOUND )
include_directories( ../../TestHelpers/inc ../../DataHandling/inc ../../CurveFitting/inc)
# This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ../../TestHelpers/src/ComponentCreationHelper.cpp
+ set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/ComponentCreationHelper.cpp
../../TestHelpers/src/WorkspaceCreationHelper.cpp
../../TestHelpers/src/MDEventsTestHelper.cpp
../../TestHelpers/src/BinaryOperationMDTestHelper.cpp )
diff --git a/Code/Mantid/Framework/MDEvents/test/CMakeLists.txt b/Code/Mantid/Framework/MDEvents/test/CMakeLists.txt
index 3b75bf0f5139..cd2ab53c3cf3 100644
--- a/Code/Mantid/Framework/MDEvents/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/MDEvents/test/CMakeLists.txt
@@ -4,7 +4,8 @@ if ( CXXTEST_FOUND )
include_directories ( ../../TestHelpers/inc ../../DataHandling/inc )
# This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ../../TestHelpers/src/ComponentCreationHelper.cpp
+ set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/ComponentCreationHelper.cpp
../../TestHelpers/src/WorkspaceCreationHelper.cpp
../../TestHelpers/src/MDEventsTestHelper.cpp
../../TestHelpers/src/ScopedFileHelper.cpp
diff --git a/Code/Mantid/Framework/MPIAlgorithms/test/CMakeLists.txt b/Code/Mantid/Framework/MPIAlgorithms/test/CMakeLists.txt
index 7d879c0a0e08..2dfe09a9efba 100644
--- a/Code/Mantid/Framework/MPIAlgorithms/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/MPIAlgorithms/test/CMakeLists.txt
@@ -2,7 +2,12 @@ if ( CXXTEST_FOUND )
include_directories ( SYSTEM ${CXXTEST_INCLUDE_DIR} ${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR} )
include_directories ( ../../TestHelpers/inc )
- set ( TESTHELPER_SRCS ../../TestHelpers/src/ComponentCreationHelper.cpp ../../TestHelpers/src/WorkspaceCreationHelper.cpp )
+ set ( TESTHELPER_SRCS
+ ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/ComponentCreationHelper.cpp
+ ../../TestHelpers/src/WorkspaceCreationHelper.cpp
+ )
+
cxxtest_add_test ( MPIAlgorithmsTest ${TEST_FILES} )
target_link_libraries ( MPIAlgorithmsTest MPIAlgorithms )
add_dependencies ( FrameworkTests MPIAlgorithmsTest )
diff --git a/Code/Mantid/Framework/SINQ/test/CMakeLists.txt b/Code/Mantid/Framework/SINQ/test/CMakeLists.txt
index 1e45f8ee097f..d1c0d2405397 100644
--- a/Code/Mantid/Framework/SINQ/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/SINQ/test/CMakeLists.txt
@@ -2,8 +2,9 @@ if ( CXXTEST_FOUND )
include_directories ( SYSTEM ${CXXTEST_INCLUDE_DIR} ${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR} )
include_directories ( ../../MDEvents/inc ../../MDAlgorithms/inc ../../Nexus/inc ../../NexusCPP/inc ../../TestHelpers/inc)
-
- set ( TESTHELPER_SRCS ../../TestHelpers/src/ComponentCreationHelper.cpp
+
+ set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/ComponentCreationHelper.cpp
../../TestHelpers/src/WorkspaceCreationHelper.cpp )
if ( GMOCK_FOUND AND GTEST_FOUND )
diff --git a/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/TearDownWorld.h b/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/TearDownWorld.h
new file mode 100644
index 000000000000..61fb1117f911
--- /dev/null
+++ b/Code/Mantid/Framework/TestHelpers/inc/MantidTestHelpers/TearDownWorld.h
@@ -0,0 +1,51 @@
+#ifndef TEARDOWNWORLD_H_
+#define TEARDOWNWORLD_H_
+/**
+ Copyright © 2007-9 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
+
+ This file is part of Mantid.
+
+ Mantid is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ Mantid 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+ File change history is stored at: .
+ Code Documentation is available at:
+*/
+#include
+
+// This file defines a set of CxxTest::GlobalFixture classes that
+// are used to control various aspects of the global test setUp and tearDown
+// process
+
+/**
+ * Defines a CxxTest::GlobalFixture that clears the AlgorithmManager
+ * when its tearDownWorld() method is called.
+ */
+class ClearAlgorithmManager : public CxxTest::GlobalFixture
+{
+ bool tearDownWorld();
+};
+
+//-----------------------------------------------------------------------------
+
+/**
+ * Defines a CxxTest::GlobalFixture that clears the AnalysisDataService
+ * when its tearDownWorld() method is called.
+ */
+class ClearADS : public CxxTest::GlobalFixture
+{
+ bool tearDownWorld();
+};
+
+
+#endif // TEARDOWNWORLD_H_
diff --git a/Code/Mantid/Framework/TestHelpers/src/TearDownWorld.cpp b/Code/Mantid/Framework/TestHelpers/src/TearDownWorld.cpp
new file mode 100644
index 000000000000..c98d924ee3cc
--- /dev/null
+++ b/Code/Mantid/Framework/TestHelpers/src/TearDownWorld.cpp
@@ -0,0 +1,36 @@
+//-----------------------------------------------------------------------------
+// Includes
+//-----------------------------------------------------------------------------
+#include "MantidTestHelpers/TearDownWorld.h"
+#include "MantidAPI/AlgorithmManager.h"
+#include "MantidAPI/AnalysisDataService.h"
+
+namespace
+{
+ /// Define single ClearAlgorithmManager object
+ ClearAlgorithmManager clearAlgManager;
+ /// Definition of ClearADS object;
+ ClearADS clearADS;
+}
+
+//-----------------------------------------------------------------------------
+// ClearAlgorithmManager
+//-----------------------------------------------------------------------------
+/// @return True to indicate success of the tear down process
+bool ClearAlgorithmManager::tearDownWorld()
+{
+ Mantid::API::AlgorithmManager::Instance().clear();
+ return true;
+}
+
+
+//-----------------------------------------------------------------------------
+// ClearADS
+//-----------------------------------------------------------------------------
+
+/// @return True to indicate success of the tear down process
+bool ClearADS::tearDownWorld()
+{
+ Mantid::API::AnalysisDataService::Instance().clear();
+ return true;
+}
diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/test/CMakeLists.txt b/Code/Mantid/Framework/WorkflowAlgorithms/test/CMakeLists.txt
index 4c12c4e7a574..ed9b4a5dbf57 100644
--- a/Code/Mantid/Framework/WorkflowAlgorithms/test/CMakeLists.txt
+++ b/Code/Mantid/Framework/WorkflowAlgorithms/test/CMakeLists.txt
@@ -5,7 +5,8 @@ if ( CXXTEST_FOUND )
include_directories ( ../../Algorithms/inc ../../DataHandling/inc ../../TestHelpers/inc )
# This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ../../TestHelpers/src/ComponentCreationHelper.cpp
+ set ( TESTHELPER_SRCS ../../TestHelpers/src/TearDownWorld.cpp
+ ../../TestHelpers/src/ComponentCreationHelper.cpp
../../TestHelpers/src/WorkspaceCreationHelper.cpp )
cxxtest_add_test ( WorkflowAlgorithmsTest ${TEST_FILES} )
target_link_libraries ( WorkflowAlgorithmsTest WorkflowAlgorithms Algorithms DataHandling )
diff --git a/Code/Mantid/MantidQt/API/test/CMakeLists.txt b/Code/Mantid/MantidQt/API/test/CMakeLists.txt
index 25ea690d05f0..4f897fba2bbf 100644
--- a/Code/Mantid/MantidQt/API/test/CMakeLists.txt
+++ b/Code/Mantid/MantidQt/API/test/CMakeLists.txt
@@ -6,8 +6,10 @@ if ( CXXTEST_FOUND )
# This variable is used within the cxxtest_add_test macro to build these helper classes into the test executable.
# It will go out of scope at the end of this file so doesn't need un-setting
- set ( TESTHELPER_SRCS ../../../Framework/TestHelpers/src/ComponentCreationHelper.cpp
- ../../../Framework/TestHelpers/src/WorkspaceCreationHelper.cpp )
+ set ( TESTHELPER_SRCS ../../../Framework/TestHelpers/src/TearDownWorld.cpp
+ ../../../Framework/TestHelpers/src/ComponentCreationHelper.cpp
+ ../../../Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
+ )
cxxtest_add_test ( MantidQtAPITest ${TEST_FILES} )
target_link_libraries( MantidQtAPITest MantidQtAPI DataObjects)
diff --git a/Code/Mantid/MantidQt/CustomInterfaces/test/CMakeLists.txt b/Code/Mantid/MantidQt/CustomInterfaces/test/CMakeLists.txt
index 12ac3d146062..68f05f3c316c 100644
--- a/Code/Mantid/MantidQt/CustomInterfaces/test/CMakeLists.txt
+++ b/Code/Mantid/MantidQt/CustomInterfaces/test/CMakeLists.txt
@@ -9,6 +9,8 @@ if ( CXXTEST_FOUND )
)
if ( GMOCK_FOUND AND GTEST_FOUND )
+ set ( TESTHELPER_SRCS ../../../Framework/TestHelpers/src/TearDownWorld.cpp )
+
cxxtest_add_test ( CustomInterfacesTest ${TEST_FILES} ${GMOCK_TEST_FILES} )
target_link_libraries( CustomInterfacesTest CustomInterfaces DataObjects ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES} )
add_dependencies( CustomInterfacesTest MDAlgorithms )