diff --git a/CMakeLists.txt b/CMakeLists.txt
index 264512dd88d6516399181fca2e826510ea915da1..e2b1e20a79499c933c694fc3a117de9e5cd46092 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,6 +67,17 @@ endif()
 
 #OPTION(BUILD_DOC "Build Documentation" OFF)
 OPTION(BUILD_TESTS "Build Unit tests" ON)
+#############
+## Testing ##
+#############
+#
+if(BUILD_TESTS)
+    # Enables testing for this directory and below.
+    # Note that ctest expects to find a test file in the build directory root.
+    # Therefore, this command should be in the source directory root.
+    #include(CTest) # according to http://public.kitware.com/pipermail/cmake/2012-June/050853.html
+    enable_testing()
+endif()
 
 ADD_SUBDIRECTORY(src)
 
@@ -127,13 +138,3 @@ ELSE(UNIX)
     TARGET  uninstall)
 ENDIF(UNIX)
 
-#############
-## Testing ##
-#############
-#
-if(BUILD_TESTS)
-    # Enables testing for this directory and below.
-    # Note that ctest expects to find a test file in the build directory root.
-    # Therefore, this command should be in the source directory root.
-    enable_testing()
-endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d2261746a266c18391fbec99330dde80f774cb33..9261ffff1caad4502bffa38878975c63f74c8086 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -21,9 +21,14 @@ option(BUILD_EXAMPLES "Build examples" ON)
 
 # Does this has any other interest
 # but for the examples ?
-#IF(BUILD_EXAMPLES)
+IF(BUILD_EXAMPLES)
+  set(_WOLF_ROOT_DIR ${CMAKE_SOURCE_DIR})
+ENDIF(BUILD_EXAMPLES)
+#
+# yes, for the tests !
+IF(BUILD_TESTS)
   set(_WOLF_ROOT_DIR ${CMAKE_SOURCE_DIR})
-#ENDIF(BUILD_EXAMPLES)
+ENDIF(BUILD_TESTS)
 
 
 #find dependencies.
@@ -478,12 +483,6 @@ INSTALL(DIRECTORY ${SPDLOG_INCLUDE_DIRS} DESTINATION "include/iri-algorithms/")
 
 export(PACKAGE ${PROJECT_NAME})
 
-IF(BUILD_EXAMPLES)
-  #Build examples & tests
-  MESSAGE("Building examples.")
-  ADD_SUBDIRECTORY(examples)
-ENDIF(BUILD_EXAMPLES)
-
 #############
 ## Testing ##
 #############
@@ -495,3 +494,9 @@ if(BUILD_TESTS)
 
 endif()
 
+IF(BUILD_EXAMPLES)
+  #Build examples & tests
+  MESSAGE("Building examples.")
+  ADD_SUBDIRECTORY(examples)
+ENDIF(BUILD_EXAMPLES)
+
diff --git a/src/constraint_fix.h b/src/constraint_fix.h
index 0051911cdba9334d5143ecf7d23d8f933ca34054..37b77c226af7535c8b2458aac8e5deddc2a3ea42 100644
--- a/src/constraint_fix.h
+++ b/src/constraint_fix.h
@@ -11,6 +11,8 @@ namespace wolf {
 
 class ConstraintFix: public ConstraintSparse<3,2,1>
 {
+    public:
+        typedef std::shared_ptr<ConstraintFix> Ptr;
     public:
 //        static const unsigned int N_BLOCKS = 2;
 
diff --git a/src/sensor_odom_2D.h b/src/sensor_odom_2D.h
index 6e07c7d3360ba4aeb539becb54e8db55f8aa037e..c148bf262da0e04ae7b2d3a39947be2dd17fbb69 100644
--- a/src/sensor_odom_2D.h
+++ b/src/sensor_odom_2D.h
@@ -15,6 +15,8 @@ struct IntrinsicsOdom2D : public IntrinsicsBase
 
 class SensorOdom2D : public SensorBase
 {
+    public:
+        typedef std::shared_ptr<SensorOdom2D> Ptr;
 
     protected:
         Scalar k_disp_to_disp_; ///< ratio of displacement variance to displacement, for odometry noise calculation
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
index f359aedbde576543bbfe64af08a4896dd9fe6b39..1dfd2b2fc193fa1e599296dd59e728866a99fcf4 100644
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -12,18 +12,18 @@ include_directories(${PROJECT_SOURCE_DIR}/third_party/spdlog/include/)
 ## Added these two include_dirs: ######################
 #
 #CMAKE modules
-SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules")
-MESSAGE(STATUS ${CMAKE_MODULE_PATH})
-
+#SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules")
+#MESSAGE(STATUS ${CMAKE_MODULE_PATH})
+#
 # Include Eigen
-FIND_PACKAGE(Eigen 3 REQUIRED)
-INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIRS})
+#FIND_PACKAGE(Eigen 3 REQUIRED)
+#INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIRS})
 #
 # Include Ceres
-FIND_PACKAGE(Ceres QUIET) #Ceres is not required
-IF(Ceres_FOUND)
-    INCLUDE_DIRECTORIES(${CERES_INCLUDE_DIRS})
-ENDIF(Ceres_FOUND)
+#FIND_PACKAGE(Ceres QUIET) #Ceres is not required
+#IF(Ceres_FOUND)
+#    INCLUDE_DIRECTORIES(${CERES_INCLUDE_DIRS})
+#ENDIF(Ceres_FOUND)
 #
 ## and now gtest_motion_2d works ######################
 
@@ -45,6 +45,10 @@ target_link_libraries(gtest_example ${PROJECT_NAME})      #
 #           ==== IN ALPHABETICAL ORDER! ====              #
 #                                                         #
 
+# FrameBase classes test
+wolf_add_gtest(gtest_frame_base gtest_frame_base.cpp)
+target_link_libraries(gtest_frame_base ${PROJECT_NAME})
+
 # LocalParametrizationXxx classes test
 wolf_add_gtest(gtest_local_param gtest_local_param.cpp)
 target_link_libraries(gtest_local_param ${PROJECT_NAME})
diff --git a/src/test/gtest_frame_base.cpp b/src/test/gtest_frame_base.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b9d873cb0f1d4d44dad177880751c6356ea94423
--- /dev/null
+++ b/src/test/gtest_frame_base.cpp
@@ -0,0 +1,123 @@
+/*
+ * gtest_frame_base.cpp
+ *
+ *  Created on: Nov 15, 2016
+ *      Author: jsola
+ */
+
+
+
+#include "utils_gtest.h"
+#include "../logging.h"
+
+#include "../frame_base.h"
+#include "../sensor_odom_2D.h"
+#include "../constraint_odom_2D.h"
+#include "../capture_motion.h"
+
+#include <iostream>
+
+
+using namespace Eigen;
+using namespace std;
+using namespace wolf;
+
+
+TEST(FrameBase, GettersAndSetters)
+{
+    FrameBasePtr F = make_shared<FrameBase>(1, make_shared<StateBlock>(2), make_shared<StateBlock>(1));
+
+    // getters
+    ASSERT_EQ(F->id(), 1);
+    ASSERT_EQ(F->getTimeStamp(), 1);
+    TimeStamp t;
+    F->getTimeStamp(t);
+    ASSERT_EQ(t, 1);
+    ASSERT_EQ(F->isFixed(), false);
+    ASSERT_EQ(F->isKey(), false);
+}
+
+TEST(FrameBase, StateBlocks)
+{
+    FrameBasePtr F = make_shared<FrameBase>(1, make_shared<StateBlock>(2), make_shared<StateBlock>(1));
+
+    ASSERT_EQ(F->getStateBlockVec().size(), 3);
+    ASSERT_EQ(F->getPPtr()->getVector().size(), 2);
+    ASSERT_EQ(F->getOPtr()->getVector().size(), 1);
+    ASSERT_EQ(F->getVPtr(), nullptr);
+}
+
+TEST(FrameBase, LinksBasic)
+{
+    FrameBasePtr F = make_shared<FrameBase>(1, make_shared<StateBlock>(2), make_shared<StateBlock>(1));
+
+    ASSERT_FALSE(F->getTrajectoryPtr());
+    ASSERT_FALSE(F->getProblem());
+    //    ASSERT_THROW(f->getPreviousFrame(), std::runtime_error);  // protected by assert()
+    //    ASSERT_EQ(f->getStatus(), ST_ESTIMATED);                  // protected
+    ASSERT_FALSE(F->getCaptureOf(make_shared<SensorOdom2D>(nullptr, nullptr, 1,1)));
+    ASSERT_TRUE(F->getCaptureList().empty());
+    ASSERT_TRUE(F->getConstrainedByList().empty());
+    ASSERT_EQ(F->getHits() , 0);
+}
+
+
+TEST(FrameBase, LinksToTree)
+{
+    // Problem with 2 frames and one motion constraint between them
+    ProblemPtr P = Problem::create(FRM_PO_2D);
+    TrajectoryBasePtr T = P->getTrajectoryPtr();
+    SensorOdom2D::Ptr S = make_shared<SensorOdom2D>(make_shared<StateBlock>(2), make_shared<StateBlock>(1), 1,1);
+    P->getHardwarePtr()->addSensor(S);
+    FrameBasePtr F1 = make_shared<FrameBase>(1, make_shared<StateBlock>(2), make_shared<StateBlock>(1));
+    T->addFrame(F1);
+    FrameBasePtr F2 = make_shared<FrameBase>(1, make_shared<StateBlock>(2), make_shared<StateBlock>(1));
+    T->addFrame(F2);
+    CaptureMotion::Ptr C = make_shared<CaptureMotion>(1, S, Vector3s::Zero());
+    F1->addCapture(C);
+    FeatureBasePtr f = make_shared<FeatureBase>("f", 1);
+    C->addFeature(f);
+    ConstraintOdom2D::Ptr c = make_shared<ConstraintOdom2D>(f, F2);
+    f->addConstraint(c);
+
+    // c-by link F2 -> c not yet established
+    ASSERT_TRUE(F2->getConstrainedByList().empty());
+
+    // establish link F2 -> c
+    F2->addConstrainedBy(c);
+
+    // F1 has one capture and no constraints-by
+    ASSERT_FALSE(F1->getCaptureList().empty());
+    ASSERT_TRUE(F1->getConstrainedByList().empty());
+    ASSERT_EQ(F1->getHits() , 0);
+
+    // F2 has no capture and one constraint-by
+    ASSERT_TRUE(F2->getCaptureList().empty());
+    ASSERT_FALSE(F2->getConstrainedByList().empty());
+    ASSERT_EQ(F2->getHits() , 1);
+
+    // fix and unfix
+    F1->fix();
+    ASSERT_TRUE(F1->isFixed());
+    F1->unfix();
+    ASSERT_FALSE(F1->isFixed());
+
+    // set key
+    F1->setKey();
+    ASSERT_TRUE(F1->isKey());
+
+    // Unlink
+    F1->unlinkCapture(C);
+    ASSERT_TRUE(F1->getCaptureList().empty());
+}
+
+
+int main(int argc, char **argv)
+{
+  testing::InitGoogleTest(&argc, argv);
+  return RUN_ALL_TESTS();
+}
+
+
+
+