diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index e0d1165370ac0af9986bd20ee114832587fef02c..46201533cf1f676a5cb3cdae6615b3f29747c08a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -14,42 +14,44 @@ macro(add_fcl_test test_name)
     hpp-fcl
     ${Boost_LIBRARIES}
     )
+  target_link_libraries(${test_name} utility)
   add_test(${test_name} ${EXECUTABLE_OUTPUT_PATH}/${test_name})
 endmacro(add_fcl_test)
 
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
 
+add_library(utility STATIC utility.cpp)
 
 add_fcl_test(math math.cpp)
 
-add_fcl_test(collision collision.cpp utility.cpp)
-add_fcl_test(distance distance.cpp utility.cpp)
-add_fcl_test(distance_lower_bound distance_lower_bound.cpp utility.cpp)
-add_fcl_test(geometric_shapes geometric_shapes.cpp utility.cpp)
-#add_fcl_test(broadphase broadphase.cpp utility.cpp)
-#add_fcl_test(shape_mesh_consistency shape_mesh_consistency.cpp utility.cpp)
-add_fcl_test(frontlist frontlist.cpp utility.cpp)
-#add_fcl_test(math math.cpp utility.cpp)
+add_fcl_test(collision collision.cpp)
+add_fcl_test(distance distance.cpp)
+add_fcl_test(distance_lower_bound distance_lower_bound.cpp)
+add_fcl_test(geometric_shapes geometric_shapes.cpp)
+#add_fcl_test(broadphase broadphase.cpp)
+#add_fcl_test(shape_mesh_consistency shape_mesh_consistency.cpp)
+add_fcl_test(frontlist frontlist.cpp)
+#add_fcl_test(math math.cpp)
 
 # add_fcl_test(sphere_capsule sphere_capsule.cpp)
-add_fcl_test(capsule_capsule capsule_capsule.cpp utility.cpp)
-add_fcl_test(box_box_distance box_box_distance.cpp utility.cpp)
+add_fcl_test(capsule_capsule capsule_capsule.cpp)
+add_fcl_test(box_box_distance box_box_distance.cpp)
 add_fcl_test(simple simple.cpp)
-add_fcl_test(capsule_box_1 capsule_box_1.cpp utility.cpp)
-add_fcl_test(capsule_box_2 capsule_box_2.cpp utility.cpp)
+add_fcl_test(capsule_box_1 capsule_box_1.cpp)
+add_fcl_test(capsule_box_2 capsule_box_2.cpp)
 add_fcl_test(obb obb.cpp)
 
-add_fcl_test(bvh_models bvh_models.cpp utility.cpp)
+add_fcl_test(bvh_models bvh_models.cpp)
 
-add_fcl_test(profiling profiling.cpp utility.cpp)
+add_fcl_test(profiling profiling.cpp)
 PKG_CONFIG_USE_DEPENDENCY(profiling assimp)
 
 add_fcl_test(gjk gjk.cpp)
 if(HPP_FCL_HAVE_OCTOMAP)
-  add_fcl_test(octree octree.cpp utility.cpp)
+  add_fcl_test(octree octree.cpp)
 endif(HPP_FCL_HAVE_OCTOMAP)
 
 ## Benchmark
-add_executable(test-benchmark benchmark.cpp utility.cpp)
-target_link_libraries(test-benchmark hpp-fcl ${Boost_LIBRARIES})
+add_executable(test-benchmark benchmark.cpp)
+target_link_libraries(test-benchmark hpp-fcl ${Boost_LIBRARIES} utility)
diff --git a/test/geometric_shapes.cpp b/test/geometric_shapes.cpp
index e65aad57e4ad143f95d317f53a33a03e07c9e7e4..3d48154deab50f68d82ddfdda9be962d54c02aba 100644
--- a/test/geometric_shapes.cpp
+++ b/test/geometric_shapes.cpp
@@ -56,28 +56,6 @@ FCL_REAL tol_gjk = 0.01;
 GJKSolver solver1;
 GJKSolver solver2;
 
-Eigen::IOFormat fmt(Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", ", ", "", "", "", "");
-Eigen::IOFormat pyfmt(Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", ", ", "", "", "[", "]");
-
-typedef Eigen::AngleAxis<FCL_REAL> AngleAxis;
-//static const Vec3f UnitX (1, 0, 0);
-//static const Vec3f UnitY (0, 1, 0);
-static const Vec3f UnitZ (0, 0, 1);
-
-
-namespace hpp {
-namespace fcl {
-std::ostream& operator<< (std::ostream& os, const Transform3f& tf)
-{
-  return os << "[ " <<
-    tf.getTranslation().format(fmt)
-    << ", "
-    << tf.getQuatRotation().coeffs().format(fmt)
-    << " ]" ;
-}
-}
-}
-
 #define BOOST_CHECK_FALSE(p) BOOST_CHECK(!(p))
 
 template <typename S1, typename S2>
diff --git a/test/utility.cpp b/test/utility.cpp
index f5708d948c5b9970b56a7c38b9be2a4b0ca1b048..e5e54baefff8ba545b6c08626e04fe312fb81efa 100644
--- a/test/utility.cpp
+++ b/test/utility.cpp
@@ -10,7 +10,6 @@ namespace hpp
 namespace fcl
 {
 
-
 Timer::Timer()
 {
 #ifdef _WIN32
@@ -94,6 +93,13 @@ double Timer::getElapsedTime()
 }
 
 
+const Eigen::IOFormat vfmt  = Eigen::IOFormat (Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", ", ", "", "", "", "");
+const Eigen::IOFormat pyfmt = Eigen::IOFormat (Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", ", ", "", "", "[", "]");
+
+const Vec3f UnitX = Vec3f(1, 0, 0);
+const Vec3f UnitY = Vec3f(0, 1, 0);
+const Vec3f UnitZ = Vec3f(0, 0, 1);
+
 FCL_REAL rand_interval(FCL_REAL rmin, FCL_REAL rmax)
 {
   FCL_REAL t = rand() / ((FCL_REAL)RAND_MAX + 1);
@@ -473,6 +479,15 @@ Quaternion3f makeQuat(FCL_REAL w, FCL_REAL x, FCL_REAL y, FCL_REAL z)
   return q;
 }
 
+std::ostream& operator<< (std::ostream& os, const Transform3f& tf)
+{
+  return os << "[ " <<
+    tf.getTranslation().format(vfmt)
+    << ", "
+    << tf.getQuatRotation().coeffs().format(vfmt)
+    << " ]" ;
+}
+
 }
 
 } // namespace hpp
diff --git a/test/utility.h b/test/utility.h
index 80bab48ebdc7a24282a2543fe98a4d9fe8ddff86..d724399db73e086684e7757e63243ec3a18f27fa 100644
--- a/test/utility.h
+++ b/test/utility.h
@@ -92,6 +92,12 @@ private:
 #endif
 };
 
+extern const Eigen::IOFormat vfmt;
+extern const Eigen::IOFormat pyfmt;
+typedef Eigen::AngleAxis<FCL_REAL> AngleAxis;
+extern const Vec3f UnitX;
+extern const Vec3f UnitY;
+extern const Vec3f UnitZ;
 
 /// @brief Load an obj mesh file
 void loadOBJFile(const char* filename, std::vector<Vec3f>& points, std::vector<Triangle>& triangles);
@@ -176,6 +182,8 @@ std::string getGJKSolverName(GJKSolverType solver_type);
 
 Quaternion3f makeQuat(FCL_REAL w, FCL_REAL x, FCL_REAL y, FCL_REAL z);
 
+std::ostream& operator<< (std::ostream& os, const Transform3f& tf);
+
 }
 
 } // namespace hpp