diff --git a/Tests/Functional/PyExamples/CMakeLists.txt b/Tests/Functional/PyExamples/CMakeLists.txt
index faea206e7dc9fad540ec87abc8e9078b04b720fd..47adecd1063cbbf54fc3844bf67c80c4f2a758b8 100644
--- a/Tests/Functional/PyExamples/CMakeLists.txt
+++ b/Tests/Functional/PyExamples/CMakeLists.txt
@@ -8,21 +8,17 @@
 
 add_custom_target(TempQtCreatorTarget SOURCES check_functionality.py)
 
-set(examples
-    simulation/ex01_BasicParticles/CylindersAndPrisms
-    )
 
+file(GLOB examples "${PY_EXAMPLES_DIR}/simulation/ex*/*.py")
 
 set(test_script ${CMAKE_SOURCE_DIR}/Tests/Functional/PyExamples/check_functionality.py)
-
 foreach(example ${examples})
-    set(script_path ${PY_EXAMPLES_DIR}/${example}.py)
+    set(script_path ${example})
 
     get_filename_component(script_name ${script_path} NAME_WE)
     set(test_name PyExamples/${script_name})
 
     add_test(${test_name} ${PYTHON_EXECUTABLE} ${test_script} ${script_path})
     set_tests_properties(${test_name} PROPERTIES LABELS "Examples")
-
-    message(INFO "XXX ${PYTHON_EXECUTABLE} ${test_script} ${script_path}")
 endforeach()
+
diff --git a/Tests/Functional/PyExamples/check_functionality.py b/Tests/Functional/PyExamples/check_functionality.py
index 2ab620e5c362081e680dd966f2e20e57b4d558ea..7098ecbbb708d28b0826ab2f75c4c4209580cf03 100644
--- a/Tests/Functional/PyExamples/check_functionality.py
+++ b/Tests/Functional/PyExamples/check_functionality.py
@@ -46,6 +46,9 @@ def run_example(filename):
     """
     Tries to run python example and produce a *.png image
     """
+    if not os.path.exists(filename):
+        raise Exception("File '"+filename+"' doesn't exist.")
+
     print(filename)
 
     fig = get_figure(filename)
@@ -64,10 +67,13 @@ def run_example(filename):
             status = "EMPTY?"
 
     except:
+        e = sys.exc_info()[0]
+        print("Error {0} while trying to execute '{1}'".format(e, filename))
         status = "FAILED"
 
     print(status)
-    # return os.path.join(dirname, filename), status, ""
+    if status != "OK":
+        raise Exception(status)
 
 
 if __name__ == '__main__':