diff --git a/tests/unit/index.cpp b/tests/unit/index.cpp
index a7ea5e4..49af9fe 100644
--- a/tests/unit/index.cpp
+++ b/tests/unit/index.cpp
@@ -28,60 +28,7 @@
 namespace repo {
 namespace tests {
 
-BOOST_AUTO_TEST_SUITE(TestIndex)
-
-template<class Dataset>
-class Fixture : public Dataset
-{
-};
-
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(IndexGeneralTest, T, DatasetFixtures_Storage, Fixture<T>)
-{
-   Index index(65535);
-   for (typename T::IdContainer::iterator i = this->insert.begin();
-        i != this->insert.end(); ++i)
-   {
-     BOOST_CHECK_EQUAL(index.insert(*i->second, i->first), true);
-   }
-   BOOST_CHECK_EQUAL(index.size(), 7);
-
-   typename T::IdContainer::iterator id = this->ids.begin();
-   for (typename T::InterestContainer::iterator i = this->interests.begin();
-        i != this->interests.end(); ++i)
-   {
-     vector<std::pair<int, ndn::Name> > id_names;
-     BOOST_CHECK_EQUAL(index.find(i->first.getName()).first, id->first);
-     BOOST_CHECK_EQUAL(index.hasData(*i->second), true);
-     ++id;
-   }
-
-   for (typename T::InterestIdContainer::iterator i = this->interestsSelectors.begin();
-        i != this->interestsSelectors.end(); ++i)
-   {
-
-     BOOST_CHECK_EQUAL(index.find(i->first).first, i->second);
-     ndn::Name name = index.find(i->first).second;
-     BOOST_CHECK_EQUAL(index.erase(name), true);
-   }
-   BOOST_CHECK_EQUAL(index.size(), 2);
-}
-
-
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(IndexTestSelector, T, DatasetFixtures_Selector, Fixture<T>)
-{
-   Index index(65535);
-   for (typename T::IdContainer::iterator i = this->insert.begin();
-        i != this->insert.end(); ++i)
-     BOOST_CHECK_EQUAL(index.insert(*i->second, i->first), true);
-   for (typename T::InterestIdContainer::iterator i = this->interestsSelectors.begin();
-        i != this->interestsSelectors.end(); ++i)
-   {
-     BOOST_CHECK_EQUAL(index.find(i->first).first, i->second);
-   }
-
-
-}
-
+BOOST_AUTO_TEST_SUITE(Index)
 
 class FindFixture
 {
@@ -116,7 +63,7 @@
   }
 
 protected:
-  Index m_index;
+  repo::Index m_index;
   KeyChain m_keyChain;
   shared_ptr<Interest> m_interest;
 };
@@ -418,6 +365,64 @@
 
 BOOST_AUTO_TEST_SUITE_END() // Find
 
+
+template<class Dataset>
+class Fixture : public Dataset
+{
+public:
+  Fixture()
+    : index(65535)
+  {
+  }
+
+public:
+  std::map<int64_t, shared_ptr<Data> > idToDataMap;
+  repo::Index index;
+};
+
+// Combine CommonDatasets with ComplexSelectorDataset
+typedef boost::mpl::push_back<CommonDatasets,
+                              ComplexSelectorsDataset>::type Datasets;
+
+BOOST_FIXTURE_TEST_CASE_TEMPLATE(Bulk, T, Datasets, Fixture<T>)
+{
+  BOOST_TEST_MESSAGE(T::getName());
+
+  for (typename T::DataContainer::iterator i = this->data.begin();
+       i != this->data.end(); ++i)
+    {
+      int64_t id = std::abs(static_cast<int64_t>(ndn::random::generateWord64()));
+      this->idToDataMap.insert(std::make_pair(id, *i));
+
+      BOOST_CHECK_EQUAL(this->index.insert(**i, id), true);
+    }
+
+  BOOST_CHECK_EQUAL(this->index.size(), this->data.size());
+
+  for (typename T::InterestContainer::iterator i = this->interests.begin();
+       i != this->interests.end(); ++i)
+    {
+      std::pair<int64_t, Name> item = this->index.find(i->first);
+
+      BOOST_REQUIRE_GT(item.first, 0);
+      BOOST_REQUIRE(this->idToDataMap.count(item.first) > 0);
+
+      BOOST_TEST_MESSAGE(i->first);
+      BOOST_CHECK_EQUAL(*this->idToDataMap[item.first], *i->second);
+
+      BOOST_CHECK_EQUAL(this->index.hasData(*i->second), true);
+    }
+
+  // Need support for selector-based removal
+  // for (typename T::RemovalsContainer::iterator i = this->removals.begin();
+  //      i != this->removals.end(); ++i)
+  //   {
+  //     size_t nRemoved = 0;
+  //     BOOST_REQUIRE_NO_THROW(this->index.erase(*i));
+  //     BOOST_CHECK_EQUAL(nRemoved, i->seconds);
+  //   }
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace tests
diff --git a/tests/unit/repo-storage.cpp b/tests/unit/repo-storage.cpp
index 41f9930..5058f08 100644
--- a/tests/unit/repo-storage.cpp
+++ b/tests/unit/repo-storage.cpp
@@ -30,67 +30,47 @@
 namespace tests {
 
 BOOST_AUTO_TEST_SUITE(RepoStorage)
+
 template<class Dataset>
 class Fixture : public Dataset, public RepoStorageFixture
 {
 };
 
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(NdnNameSkipList, T, DatasetFixtures_Storage, Fixture<T>)
+// Combine CommonDatasets with ComplexSelectorDataset
+typedef boost::mpl::push_back<CommonDatasets,
+                              ComplexSelectorsDataset>::type Datasets;
+
+
+BOOST_FIXTURE_TEST_CASE_TEMPLATE(Bulk, T, Datasets, Fixture<T>)
 {
-  //Insert
+  BOOST_TEST_MESSAGE(T::getName());
+
+  // Insert data into repo
   for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i) 
+       i != this->data.end(); ++i)
     {
       BOOST_CHECK_EQUAL(this->handle->insertData(**i), true);
     }
-  
-  //Read
+
+  // check size directly with the storage (repo doesn't have interface yet)
+  BOOST_CHECK_EQUAL(this->store->size(), this->data.size());
+
+  // Read
   for (typename T::InterestContainer::iterator i = this->interests.begin();
-       i != this->interests.end(); ++i) 
+       i != this->interests.end(); ++i)
   {
       shared_ptr<ndn::Data> dataTest = this->handle->readData(i->first);
       BOOST_CHECK_EQUAL(*this->handle->readData(i->first), *i->second);
-     // int rc = memcmp(dataTest->getContent().value(),
-      //                i->second->getContent().value(), sizeof(i->second->getContent().value()));
-      //BOOST_CHECK_EQUAL(rc, 0);
-      BOOST_CHECK_EQUAL(this->handle->deleteData(i->first.getName()), 1);
     }
- 
-  //Insert
-  for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i) 
+
+  // Remove items
+  for (typename T::RemovalsContainer::iterator i = this->removals.begin();
+       i != this->removals.end(); ++i)
     {
-      BOOST_CHECK_EQUAL(this->handle->insertData(**i), true);
+      size_t nRemoved = 0;
+      BOOST_REQUIRE_NO_THROW(nRemoved = this->handle->deleteData(i->first));
+      BOOST_CHECK_EQUAL(nRemoved, i->second);
     }
-
-  //Erase
-  for (typename T::InterestIdContainer::iterator i = this->interestDeleteCount.begin();
-       i != this->interestDeleteCount.end(); ++i)
-    {
-      BOOST_CHECK_EQUAL(this->handle->deleteData(i->first), i->second);
-    }
-}
-
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(Index, T, DatasetFixtures_Storage, Fixture<T>)
-{
-
-  for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i)
-    {
-      BOOST_CHECK_EQUAL(this->handle->insertData(**i), true);
-    }
-  ndn::Interest interest("/a");
-  ndn::Interest interest1("/a/b/d/1");
-
-  BOOST_CHECK_EQUAL(this->handle->deleteData(interest), 7);
-
-
-  for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i)
-    {
-      BOOST_CHECK_EQUAL(this->handle->insertData(**i), true);
-    }
-  BOOST_CHECK_EQUAL(this->handle->deleteData(interest.getName()), 7);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit/skiplist.cpp b/tests/unit/skiplist.cpp
index 34083d6..5bbb0ff 100644
--- a/tests/unit/skiplist.cpp
+++ b/tests/unit/skiplist.cpp
@@ -36,27 +36,7 @@
 {
 };
 
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(NdnNameSkipList, T, DatasetFixtures, Fixture<T>)
-{
-  repo::SkipList<ndn::Name, typename T::DataSetNameCompare> skipList;
-  //Insert
-  for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i) {
-    skipList.insert((*i)->getName());
-  }
-
-  //find and erase
-  for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i) {
-    typename repo::SkipList<ndn::Name, typename T::DataSetNameCompare>::iterator findIterator =
-      skipList.find((*i)->getName());
-    skipList.erase(findIterator);
-  }
-
-  //@todo test lower_bound
-}
-
-BOOST_AUTO_TEST_CASE(IntGtSkipList)
+BOOST_AUTO_TEST_CASE(Correctness)
 {
   typedef repo::SkipList<int, std::greater<int> > IntGtSkipList;
   IntGtSkipList sl;
@@ -153,6 +133,56 @@
   BOOST_CHECK(it3 == sl.end());
 }
 
+class Item : public ndn::Name
+{
+public:
+  explicit
+  Item(const ndn::Name& name = "")
+    : ndn::Name(name)
+    , randomValue(ndn::random::generateWord64())
+  {
+  }
+
+public:
+  uint64_t randomValue;
+};
+
+BOOST_FIXTURE_TEST_CASE_TEMPLATE(Bulk, T, CommonDatasets, Fixture<T>)
+{
+  BOOST_TEST_MESSAGE(T::getName());
+  typedef repo::SkipList<Item, std::less<Item> > SkipList;
+  SkipList skipList;
+
+  std::vector<Item> items;
+  std::set<ndn::Name> names;
+  for (typename T::DataContainer::iterator i = this->data.begin();
+       i != this->data.end(); ++i) {
+    std::pair<std::set<ndn::Name>::iterator, bool> ret = names.insert((*i)->getName());
+    if (ret.second) {
+      items.push_back(Item((*i)->getName()));
+    }
+  }
+
+  // Insert
+  for (std::vector<Item>::iterator i = items.begin(); i != items.end(); ++i) {
+    skipList.insert(*i);
+  }
+
+  BOOST_CHECK_EQUAL(items.size(), skipList.size());
+
+  // Randomize items
+  std::random_shuffle(items.begin(), items.end());
+
+  // Find items and check if the right item is found
+  for (std::vector<Item>::iterator i = items.begin(); i != items.end(); ++i) {
+    SkipList::iterator item = skipList.find(*i);
+    BOOST_CHECK(item != skipList.end());
+
+    BOOST_CHECK_EQUAL(static_cast<const Name&>(*item), static_cast<const Name&>(*i));
+    BOOST_CHECK_EQUAL(item->randomValue, i->randomValue);
+  }
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace tests
diff --git a/tests/unit/sqlite-handle.cpp b/tests/unit/sqlite-handle.cpp
index 17a4832..59c5977 100644
--- a/tests/unit/sqlite-handle.cpp
+++ b/tests/unit/sqlite-handle.cpp
@@ -32,42 +32,45 @@
 template<class Dataset>
 class Fixture : public SqliteFixture, public Dataset
 {
+public:
+  std::map<int64_t, shared_ptr<Data> > idToDataMap;
 };
 
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(InsertReadDelete, T, DatasetFixtures_Sqlite, Fixture<T>)
+BOOST_FIXTURE_TEST_CASE_TEMPLATE(InsertReadDelete, T, CommonDatasets, Fixture<T>)
 {
   BOOST_TEST_MESSAGE(T::getName());
 
-  // Insert
-  for (typename T::IdContainer::iterator i = this->ids.begin();
-       i != this->ids.end(); ++i) {
-    BOOST_CHECK_EQUAL(this->handle->insert(*i->second), i->first);
-  }
+  std::vector<int64_t> ids;
 
+  // Insert
+  for (typename T::DataContainer::iterator i = this->data.begin();
+       i != this->data.end(); ++i)
+    {
+      int64_t id = -1;
+      BOOST_REQUIRE_NO_THROW(id = this->handle->insert(**i));
+
+      this->idToDataMap.insert(std::make_pair(id, *i));
+      ids.push_back(id);
+    }
   BOOST_CHECK_EQUAL(this->handle->size(), this->data.size());
 
+  std::random_shuffle(ids.begin(), ids.end());
+
   // Read (all items should exist)
-  for (typename T::IdContainer::iterator i = this->ids.begin();
-       i != this->ids.end(); ++i) {
-    shared_ptr<Data> retrievedData = this->handle->read(i->first);
-    BOOST_CHECK_EQUAL(*retrievedData, *i->second);
+  for (std::vector<int64_t>::iterator i = ids.begin(); i != ids.end(); ++i) {
+    shared_ptr<Data> retrievedData = this->handle->read(*i);
+
+    BOOST_REQUIRE(this->idToDataMap.count(*i) > 0);
+    BOOST_CHECK_EQUAL(*this->idToDataMap[*i], *retrievedData);
   }
+  BOOST_CHECK_EQUAL(this->handle->size(), this->data.size());
 
   // Delete
-  for (typename T::IdContainer::iterator i = this->ids.begin();
-       i != this->ids.end(); ++i) {
-      //std::cout<<"remove name = "<<i->second->getName()<<std::endl;
-    BOOST_CHECK_EQUAL(this->handle->erase(i->first), true);
+  for (std::vector<int64_t>::iterator i = ids.begin(); i != ids.end(); ++i) {
+    BOOST_CHECK_EQUAL(this->handle->erase(*i), true);
   }
 
-  /*
-  // Read (none of the items should exist)
-  for (typename T::InterestContainer::iterator i = this->interests.begin();
-       i != this->interests.end(); ++i) {
-    ndn::Data retrievedData;
-    BOOST_REQUIRE_EQUAL(this->handle->readData(i->first, retrievedData), false);
-  }*/
-
+  BOOST_CHECK_EQUAL(this->handle->size(), 0);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit/tcp-bulk-insert-handle.cpp b/tests/unit/tcp-bulk-insert-handle.cpp
index 67a541a..6d911f7 100644
--- a/tests/unit/tcp-bulk-insert-handle.cpp
+++ b/tests/unit/tcp-bulk-insert-handle.cpp
@@ -153,11 +153,9 @@
 };
 
 
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(BulkInsertAndRead, T, DatasetFixtures_Storage,
-                                 TcpBulkInsertFixture<T>)
+BOOST_FIXTURE_TEST_CASE_TEMPLATE(BulkInsertAndRead, T, CommonDatasets, TcpBulkInsertFixture<T>)
 {
   BOOST_TEST_MESSAGE(T::getName());
-  // BOOST_CHECK_EQUAL(this->handle->size(), 1);
 
   // start bulk inserter
   this->bulkInserter.listen("localhost", "17376");
@@ -168,16 +166,10 @@
   // actually run the test
   this->ioService.run();
 
-//  BOOST_CHECK_EQUAL(this->handle->size(), this->data.size());
-
   // Read (all items should exist)
   for (typename T::InterestContainer::iterator i = this->interests.begin();
        i != this->interests.end(); ++i) {
       BOOST_CHECK_EQUAL(*this->handle->readData(i->first), *i->second);
-   // int rc = memcmp(retrievedData->getContent().value(),
-   //                 i->second->getContent().value(), sizeof(i->second->getContent().value()));
-    //BOOST_CHECK_EQUAL(rc, 0);
-
   }
 }
 
