diff --git a/tests/mpi_test_main.cpp b/tests/mpi_test_main.cpp
index 541d48a37c352a0cd12ce6c15ddd32de3ddae941..ec01b679be37c65f2bdbbf5e7a99618f814f76fe 100644
--- a/tests/mpi_test_main.cpp
+++ b/tests/mpi_test_main.cpp
@@ -15,8 +15,14 @@ main(int argc, char* argv[])
   if (parallel::rank() != 0) {
     setenv("GCOV_PREFIX", "/dev/null", 1);
   }
+  Catch::Session session;
+  int result = session.applyCommandLine(argc, argv);
 
-  int result = Catch::Session().run(argc, argv);
+  if (result == 0) {
+    // Disable outputs from tested classes to the standard output
+    std::cout.setstate(std::ios::badbit);
+    result = session.run();
+  }
 
   Kokkos::finalize();
   parallel::Messenger::destroy();
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index c7355e990f3322d22de1ab0398d7b5ed0fab3c06..eba6d05d0ea0cc29b222ec92f4815a3820118c20 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -8,10 +8,14 @@ main(int argc, char* argv[])
 {
   Kokkos::initialize({4, -1, -1, true});
 
-  // Disable outputs from tested classes to the standard output
-  std::cout.setstate(std::ios::badbit);
+  Catch::Session session;
+  int result = session.applyCommandLine(argc, argv);
 
-  int result = Catch::Session().run(argc, argv);
+  if (result == 0) {
+    // Disable outputs from tested classes to the standard output
+    std::cout.setstate(std::ios::badbit);
+    result = session.run();
+  }
 
   Kokkos::finalize();