diff --git a/public/carp/src/test/scala/nl/lumc/sasc/biopet/pipelines/carp/CarpTest.scala b/public/carp/src/test/scala/nl/lumc/sasc/biopet/pipelines/carp/CarpTest.scala
index da63e765dd64f39af329973c1ca513ba659f7f1d..fd57a752a0039cd69eccf93dd6bb805eae1ebc86 100644
--- a/public/carp/src/test/scala/nl/lumc/sasc/biopet/pipelines/carp/CarpTest.scala
+++ b/public/carp/src/test/scala/nl/lumc/sasc/biopet/pipelines/carp/CarpTest.scala
@@ -2,15 +2,18 @@ package nl.lumc.sasc.biopet.pipelines.carp
 
 import java.io.File
 
+import com.google.common.io.Files
+import org.apache.commons.io.FileUtils
+import org.broadinstitute.gatk.queue.QSettings
+import org.testng.annotations.{ AfterClass, Test, DataProvider }
+import org.scalatest.Matchers
+import org.scalatest.testng.TestNGSuite
+
 import nl.lumc.sasc.biopet.core.config.Config
 import nl.lumc.sasc.biopet.extensions.bwa.BwaMem
 import nl.lumc.sasc.biopet.extensions.macs2.Macs2CallPeak
 import nl.lumc.sasc.biopet.extensions.picard.{ MergeSamFiles, SortSam }
 import nl.lumc.sasc.biopet.utils.ConfigUtils
-import org.broadinstitute.gatk.queue.QSettings
-import org.testng.annotations.{ Test, DataProvider }
-import org.scalatest.Matchers
-import org.scalatest.testng.TestNGSuite
 
 /**
  * Created by pjvan_thof on 2/13/15.
@@ -69,10 +72,15 @@ class CarpTest extends TestNGSuite with Matchers {
       carp.functions.count(_.isInstanceOf[Macs2CallPeak]) shouldBe (numberSamples + (if (threatment) 1 else 0))
     }
   }
+
+  // remove temporary run directory all tests in the class have been run
+  @AfterClass def removeTempOutputDir() = {
+    FileUtils.deleteDirectory(CarpTest.outputDir)
+  }
 }
 
 object CarpTest {
-  val outputDir = System.getProperty("java.io.tmpdir") + File.separator + "flexiprep"
+  val outputDir = Files.createTempDir()
 
   val excutables = Map(
     "reference" -> "test",
diff --git a/public/flexiprep/src/test/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/FlexiprepTest.scala b/public/flexiprep/src/test/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/FlexiprepTest.scala
index 1fcaab37ba5f1518dc03650cf35568bf44667ce5..7f6c81a342c3266ea95626677d345f28eec6201c 100644
--- a/public/flexiprep/src/test/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/FlexiprepTest.scala
+++ b/public/flexiprep/src/test/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/FlexiprepTest.scala
@@ -2,15 +2,17 @@ package nl.lumc.sasc.biopet.pipelines.flexiprep
 
 import java.io.File
 
+import com.google.common.io.Files
+import org.apache.commons.io.FileUtils
+import org.broadinstitute.gatk.queue.QSettings
+import org.scalatest.Matchers
+import org.scalatest.testng.TestNGSuite
+import org.testng.annotations.{ AfterClass, DataProvider, Test }
+
 import nl.lumc.sasc.biopet.core.config.Config
 import nl.lumc.sasc.biopet.extensions.{ Gzip, Zcat }
 import nl.lumc.sasc.biopet.tools.FastqSync
 import nl.lumc.sasc.biopet.utils.ConfigUtils
-import org.broadinstitute.gatk.queue.QSettings
-import org.broadinstitute.gatk.queue.function.QFunction
-import org.scalatest.Matchers
-import org.scalatest.testng.TestNGSuite
-import org.testng.annotations.{ DataProvider, Test }
 
 /**
  * Created by pjvan_thof on 2/11/15.
@@ -67,9 +69,15 @@ class FlexiprepTest extends TestNGSuite with Matchers {
     flexiprep.functions.count(_.isInstanceOf[Sickle]) shouldBe (if (skipTrim) 0 else 1)
     flexiprep.functions.count(_.isInstanceOf[Gzip]) shouldBe (if (paired) 2 else 1)
   }
+
+  // remove temporary run directory all tests in the class have been run
+  @AfterClass def removeTempOutputDir() = {
+    FileUtils.deleteDirectory(FlexiprepTest.outputDir)
+  }
 }
+
 object FlexiprepTest {
-  val outputDir = System.getProperty("java.io.tmpdir") + File.separator + "flexiprep"
+  val outputDir = Files.createTempDir()
 
   val excutables = Map(
     "seqstat" -> Map("exe" -> "test"),
diff --git a/public/mapping/src/test/scala/nl/lumc/sasc/biopet/pipelines/mapping/MappingTest.scala b/public/mapping/src/test/scala/nl/lumc/sasc/biopet/pipelines/mapping/MappingTest.scala
index 43085064c1c51404b5c872079d3d780457ce0475..19b773aba8155eb5773cef5ebc567ae7638b5956 100644
--- a/public/mapping/src/test/scala/nl/lumc/sasc/biopet/pipelines/mapping/MappingTest.scala
+++ b/public/mapping/src/test/scala/nl/lumc/sasc/biopet/pipelines/mapping/MappingTest.scala
@@ -2,6 +2,13 @@ package nl.lumc.sasc.biopet.pipelines.mapping
 
 import java.io.File
 
+import com.google.common.io.Files
+import org.apache.commons.io.FileUtils
+import org.broadinstitute.gatk.queue.QSettings
+import org.scalatest.Matchers
+import org.scalatest.testng.TestNGSuite
+import org.testng.annotations.{ AfterClass, DataProvider, Test }
+
 import nl.lumc.sasc.biopet.core.config.Config
 import nl.lumc.sasc.biopet.extensions.bwa.{ BwaSamse, BwaSampe, BwaAln, BwaMem }
 import nl.lumc.sasc.biopet.extensions.picard.{ MergeSamFiles, AddOrReplaceReadGroups, MarkDuplicates, SortSam }
@@ -12,10 +19,6 @@ import nl.lumc.sasc.biopet.pipelines.flexiprep.Sickle
 import nl.lumc.sasc.biopet.pipelines.flexiprep._
 import nl.lumc.sasc.biopet.tools.FastqSync
 import nl.lumc.sasc.biopet.utils.ConfigUtils
-import org.broadinstitute.gatk.queue.QSettings
-import org.scalatest.Matchers
-import org.scalatest.testng.TestNGSuite
-import org.testng.annotations.{ DataProvider, Test }
 
 /**
  * Created by pjvan_thof on 2/12/15.
@@ -94,10 +97,15 @@ class MappingTest extends TestNGSuite with Matchers {
     mapping.functions.count(_.isInstanceOf[MergeSamFiles]) shouldBe (if (skipMarkDuplicate && chunks > 1) 1 else 0)
     mapping.functions.count(_.isInstanceOf[MarkDuplicates]) shouldBe (if (skipMarkDuplicate) 0 else 1)
   }
+
+  // remove temporary run directory all tests in the class have been run
+  @AfterClass def removeTempOutputDir() = {
+    FileUtils.deleteDirectory(MappingTest.outputDir)
+  }
 }
 
 object MappingTest {
-  val outputDir = System.getProperty("java.io.tmpdir") + File.separator + "flexiprep"
+  val outputDir = Files.createTempDir()
 
   val excutables = Map(
     "reference" -> "test",