diff --git a/tests/integrated/command-fixture.cpp b/tests/integrated/command-fixture.cpp
index a803a51..ad7955a 100644
--- a/tests/integrated/command-fixture.cpp
+++ b/tests/integrated/command-fixture.cpp
@@ -28,8 +28,8 @@
   , dispatcher(repoFace, keyChain)
   , validator(repoFace)
 {
-  this->saveIdentityCertificate(keyChain.getPib().getDefaultIdentity().getName(),
-                                "tests/integrated/insert-delete-test.cert");
+  this->addIdentity("/ndn/test/repo");
+  this->saveIdentityCertificate("/ndn/test/repo", "tests/integrated/insert-delete-test.cert");
   validator.load("tests/integrated/insert-delete-validator-config.conf");
 }
 
diff --git a/tests/integrated/insert-delete-validator-config.conf b/tests/integrated/insert-delete-validator-config.conf
index c97bb4c..0820266 100644
--- a/tests/integrated/insert-delete-validator-config.conf
+++ b/tests/integrated/insert-delete-validator-config.conf
@@ -1,8 +1,7 @@
 ; The test rules below are for test suite TestBasicCommandInsertDelete.
 ; Signed interests and data packets are signed by default certificate.
 ; In these test rules, the type of checker is fixed signer and signer type is file.
-; So user who wants to run this test could use security tool to dump the defualt
-; certificate into a file named "insert-delete-test.cert"
+
 rule
 {
   id "Test Rule For Signed Interest"
@@ -20,7 +19,7 @@
     key-locator
     {
       type name
-      name /DEFAULT
+      name /ndn/test/repo
       relation equal
     }
   }
@@ -43,7 +42,7 @@
     key-locator
     {
       type name
-      name /DEFAULT
+      name /ndn/test/repo
       relation equal
     }
   }
diff --git a/tests/integrated/test-basic-command-insert-delete.cpp b/tests/integrated/test-basic-command-insert-delete.cpp
index ea58abe..f3685f6 100644
--- a/tests/integrated/test-basic-command-insert-delete.cpp
+++ b/tests/integrated/test-basic-command-insert-delete.cpp
@@ -36,9 +36,6 @@
 #include <boost/mpl/vector.hpp>
 #include <boost/test/unit_test.hpp>
 
-
-#include <iostream>
-
 namespace repo {
 namespace tests {
 
@@ -46,6 +43,7 @@
 using ndn::time::seconds;
 using ndn::EventId;
 
+
 // All the test cases in this test suite should be run at once.
 BOOST_AUTO_TEST_SUITE(TestBasicCommandInsertDelete)
 
@@ -60,6 +58,7 @@
     , deleteHandle(repoFace, *handle, dispatcher, scheduler, validator)
     , insertFace(repoFace.getIoService())
     , deleteFace(repoFace.getIoService())
+    , signer(keyChain)
   {
     Name cmdPrefix("/repo/command");
     repoFace.registerPrefix(cmdPrefix, nullptr,
@@ -113,6 +112,8 @@
   Face insertFace;
   Face deleteFace;
   std::map<Name, EventId> insertEvents;
+  std::map<Name, Name> deleteNamePairs;
+  ndn::security::CommandInterestSigner signer;
 };
 
 template<class T> void
@@ -129,9 +130,7 @@
     insertEvents.erase(event);
   }
   // schedule an event 50ms later to check whether insert is Ok
-  scheduler.scheduleEvent(500_ms,
-                          bind(&Fixture<T>::checkInsertOk, this, interest));
-
+  scheduler.scheduleEvent(500_ms, std::bind(&Fixture<T>::checkInsertOk, this, interest));
 }
 
 
@@ -165,8 +164,7 @@
   BOOST_CHECK_EQUAL(statusCode, 200);
 
   //schedlute an event to check whether delete is Ok.
-  scheduler.scheduleEvent(100_ms,
-                          bind(&Fixture<T>::checkDeleteOk, this, interest));
+  scheduler.scheduleEvent(100_ms, std::bind(&Fixture<T>::checkDeleteOk, this, interest));
 }
 
 template<class T> void
@@ -185,25 +183,25 @@
 Fixture<T>::sendInsertInterest(const Interest& insertInterest)
 {
   insertFace.expressInterest(insertInterest,
-                             bind(&Fixture<T>::onInsertData, this, _1, _2),
-                             bind(&Fixture<T>::onInsertTimeout, this, _1), // Nack
-                             bind(&Fixture<T>::onInsertTimeout, this, _1));
+                             std::bind(&Fixture<T>::onInsertData, this, _1, _2),
+                             std::bind(&Fixture<T>::onInsertTimeout, this, _1), // Nack
+                             std::bind(&Fixture<T>::onInsertTimeout, this, _1));
 }
 
 template<class T> void
 Fixture<T>::sendDeleteInterest(const Interest& deleteInterest)
 {
   deleteFace.expressInterest(deleteInterest,
-                             bind(&Fixture<T>::onDeleteData, this, _1, _2),
-                             bind(&Fixture<T>::onDeleteTimeout, this, _1), // Nack
-                             bind(&Fixture<T>::onDeleteTimeout, this, _1));
+                             std::bind(&Fixture<T>::onDeleteData, this, _1, _2),
+                             std::bind(&Fixture<T>::onDeleteTimeout, this, _1), // Nack
+                             std::bind(&Fixture<T>::onDeleteTimeout, this, _1));
 }
 
 template<class T> void
 Fixture<T>::checkInsertOk(const Interest& interest)
 {
   BOOST_TEST_MESSAGE(interest);
-  shared_ptr<Data> data = handle->readData(interest);
+  std::shared_ptr<Data> data = handle->readData(interest);
   if (data) {
     int rc = memcmp(data->getContent().value(), content, sizeof(content));
     BOOST_CHECK_EQUAL(rc, 0);
@@ -216,10 +214,14 @@
 template<class T> void
 Fixture<T>::checkDeleteOk(const Interest& interest)
 {
-  shared_ptr<Data> data = handle->readData(interest);
-  BOOST_CHECK_EQUAL(data, shared_ptr<Data>());
+  std::map<Name, Name>::iterator name = deleteNamePairs.find(interest.getName());
+  BOOST_CHECK_MESSAGE(name != deleteNamePairs.end(), "Delete name not found: " << interest.getName());
+  Interest dataInterest(name->second);
+  std::shared_ptr<Data> data = handle->readData(dataInterest);
+  BOOST_CHECK(!data);
 }
 
+
 template<class T> void
 Fixture<T>::scheduleInsertEvent()
 {
@@ -230,24 +232,20 @@
     RepoCommandParameter insertParameter;
     insertParameter.setName(Name((*i)->getName())
                             .appendNumber(ndn::random::generateWord64()));
-
     insertCommandName.append(insertParameter.wireEncode());
-    Interest insertInterest(insertCommandName);
-    keyChain.sign(insertInterest);
-
+    Interest insertInterest = signer.makeCommandInterest(insertCommandName);
     // schedule a job to express insertInterest every 50ms
     scheduler.scheduleEvent(milliseconds(timeCount * 50 + 1000),
-                            bind(&Fixture<T>::sendInsertInterest, this, insertInterest));
+                            std::bind(&Fixture<T>::sendInsertInterest, this, insertInterest));
     // schedule what to do when interest timeout
     EventId delayEventId = scheduler.scheduleEvent(milliseconds(5000 + timeCount * 50),
-                                                   bind(&Fixture<T>::delayedInterest, this));
+                                                   std::bind(&Fixture<T>::delayedInterest, this));
     insertEvents[insertParameter.getName()] = delayEventId;
-
-    //The delayEvent will be canceled in onInsertInterest
+    // The delayEvent will be canceled in onInsertInterest
     insertFace.setInterestFilter(insertParameter.getName(),
-                                 bind(&Fixture<T>::onInsertInterest, this, _2),
+                                 std::bind(&Fixture<T>::onInsertInterest, this, _2),
                                  ndn::RegisterPrefixSuccessCallback(),
-                                 bind(&Fixture<T>::onRegisterFailed, this, _2));
+                                 std::bind(&Fixture<T>::onRegisterFailed, this, _2));
     timeCount++;
   }
 }
@@ -263,27 +261,23 @@
     deleteParameter.setProcessId(ndn::random::generateWord64());
     deleteParameter.setName((*i)->getName());
     deleteCommandName.append(deleteParameter.wireEncode());
-    Interest deleteInterest(deleteCommandName);
-    keyChain.sign(deleteInterest);
+    Interest deleteInterest = signer.makeCommandInterest(deleteCommandName);
+    deleteNamePairs[deleteInterest.getName()] = (*i)->getName();
     scheduler.scheduleEvent(milliseconds(4000 + timeCount * 50),
-                            bind(&Fixture<T>::sendDeleteInterest, this, deleteInterest));
+                            std::bind(&Fixture<T>::sendDeleteInterest, this, deleteInterest));
     timeCount++;
   }
 }
 
-typedef boost::mpl::vector<BasicDataset,
-                           FetchByPrefixDataset,
-                           BasicChildSelectorDataset,
-                           ExtendedChildSelectorDataset,
-                           SamePrefixDataset<10>> Datasets;
+using Datasets = boost::mpl::vector<BasicDataset,
+                                    FetchByPrefixDataset,
+                                    SamePrefixDataset<10>>;
 
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(InsertDelete, T, Datasets, Fixture<T>)
 {
   // schedule events
-  this->scheduler.scheduleEvent(0_s,
-                                bind(&Fixture<T>::scheduleInsertEvent, this));
-  this->scheduler.scheduleEvent(10_s,
-                                bind(&Fixture<T>::scheduleDeleteEvent, this));
+  this->scheduler.scheduleEvent(0_s, std::bind(&Fixture<T>::scheduleInsertEvent, this));
+  this->scheduler.scheduleEvent(10_s, std::bind(&Fixture<T>::scheduleDeleteEvent, this));
 
   this->repoFace.processEvents(30_s);
 }
diff --git a/tests/integrated/test-basic-command-watch.cpp b/tests/integrated/test-basic-command-watch.cpp
deleted file mode 100644
index 6fe677d..0000000
--- a/tests/integrated/test-basic-command-watch.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2018, Regents of the University of California.
- *
- * This file is part of NDN repo-ng (Next generation of NDN repository).
- * See AUTHORS.md for complete list of repo-ng authors and contributors.
- *
- * repo-ng is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * repo-ng is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * repo-ng, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "handles/watch-handle.hpp"
-#include "storage/sqlite-storage.hpp"
-
-#include "command-fixture.hpp"
-#include "../repo-storage-fixture.hpp"
-#include "../dataset-fixtures.hpp"
-
-#include <ndn-cxx/util/random.hpp>
-
-#include <boost/mpl/vector.hpp>
-#include <boost/test/unit_test.hpp>
-
-namespace repo {
-namespace tests {
-
-using ndn::time::milliseconds;
-using ndn::time::seconds;
-using ndn::EventId;
-
-// All the test cases in this test suite should be run at once.
-BOOST_AUTO_TEST_SUITE(TestBasicCommandWatchDelete)
-
-const static uint8_t content[8] = {3, 1, 4, 1, 5, 9, 2, 6};
-
-template<class Dataset>
-class Fixture : public CommandFixture, public RepoStorageFixture, public Dataset
-{
-public:
-  Fixture()
-    : watchHandle(repoFace, *handle, dispatcher, scheduler, validator)
-    , watchFace(repoFace.getIoService())
-  {
-    Name cmdPrefix("/repo/command");
-    repoFace.registerPrefix(cmdPrefix, nullptr,
-      [] (const Name& cmdPrefix, const std::string& reason) {
-        BOOST_FAIL("Command prefix registration error: " << reason);
-      });
-  }
-
-  void
-  scheduleWatchEvent();
-
-  void
-  onWatchInterest(const Interest& interest);
-
-  void
-  onRegisterFailed(const std::string& reason);
-
-  void
-  delayedInterest();
-
-  void
-  onWatchData(const Interest& interest, const Data& data);
-
-  void
-  onWatchStopData(const Interest& interest, const Data& data);
-
-  void
-  onWatchTimeout(const Interest& interest);
-
-  void
-  sendWatchStartInterest(const Interest& interest);
-
-  void
-  sendWatchStopInterest(const Interest& interest);
-
-  void
-  checkWatchOk(const Interest& interest);
-
-public:
-  WatchHandle watchHandle;
-  Face watchFace;
-  std::map<Name, EventId> watchEvents;
-};
-
-template<class T> void
-Fixture<T>::onWatchInterest(const Interest& interest)
-{
-  auto data = make_shared<Data>(Name(interest.getName())
-                                .appendNumber(ndn::random::generateWord64() + 100));
-  data->setContent(content, sizeof(content));
-  data->setFreshnessPeriod(0_ms);
-  keyChain.sign(*data);
-  watchFace.put(*data);
-
-  // schedule an event 50ms later to check whether watch is Ok
-  scheduler.scheduleEvent(10000_ms,
-                          bind(&Fixture<T>::checkWatchOk, this,
-                               Interest(data->getName())));
-}
-
-
-template<class T> void
-Fixture<T>::onRegisterFailed(const std::string& reason)
-{
-  BOOST_ERROR("ERROR: Failed to register prefix in local hub's daemon" + reason);
-}
-
-template<class T> void
-Fixture<T>::delayedInterest()
-{
-  BOOST_ERROR("Fetching interest does not come. It may be satisfied in CS or something is wrong");
-}
-
-template<class T> void
-Fixture<T>::onWatchData(const Interest& interest, const Data& data)
-{
-  RepoCommandResponse response;
-  response.wireDecode(data.getContent().blockFromValue());
-
-  int statusCode = response.getCode();
-  BOOST_CHECK_EQUAL(statusCode, 100);
-}
-
-template<class T> void
-Fixture<T>::onWatchStopData(const Interest& interest, const Data& data)
-{
-  RepoCommandResponse response;
-  response.wireDecode(data.getContent().blockFromValue());
-
-  int statusCode = response.getCode();
-  BOOST_CHECK_EQUAL(statusCode, 101);
-}
-
-template<class T> void
-Fixture<T>::onWatchTimeout(const Interest& interest)
-{
-  BOOST_ERROR("Watch command timeout");
-}
-
-template<class T> void
-Fixture<T>::sendWatchStartInterest(const Interest& watchInterest)
-{
-  watchFace.expressInterest(watchInterest,
-                            bind(&Fixture<T>::onWatchData, this, _1, _2),
-                            bind(&Fixture<T>::onWatchTimeout, this, _1), // Nack
-                            bind(&Fixture<T>::onWatchTimeout, this, _1));
-}
-
-template<class T> void
-Fixture<T>::sendWatchStopInterest(const Interest& watchInterest)
-{
-  watchFace.expressInterest(watchInterest,
-                            bind(&Fixture<T>::onWatchStopData, this, _1, _2),
-                            bind(&Fixture<T>::onWatchTimeout, this, _1), // Nack
-                            bind(&Fixture<T>::onWatchTimeout, this, _1));
-}
-
-template<class T> void
-Fixture<T>::checkWatchOk(const Interest& interest)
-{
-  BOOST_TEST_MESSAGE(interest);
-  shared_ptr<Data> data = handle->readData(interest);
-  if (data) {
-    int rc = memcmp(data->getContent().value(), content, sizeof(content));
-    BOOST_CHECK_EQUAL(rc, 0);
-  }
-  else {
-    std::cerr<<"Check Watch Failed"<<std::endl;
-  }
-}
-
-template<class T> void
-Fixture<T>::scheduleWatchEvent()
-{
-  Name watchCommandName("/repo/command/watch/start");
-  RepoCommandParameter watchParameter;
-  watchParameter.setName(Name("/a/b"));
-  watchParameter.setMaxInterestNum(10);
-  watchParameter.setInterestLifetime(50000_ms);
-  watchParameter.setWatchTimeout(1000000000_ms);
-  watchCommandName.append(watchParameter.wireEncode());
-  Interest watchInterest(watchCommandName);
-  keyChain.sign(watchInterest);
-  //schedule a job to express watchInterest
-  scheduler.scheduleEvent(1000_ms,
-                          bind(&Fixture<T>::sendWatchStartInterest, this, watchInterest));
-
-  Name watchStopName("/repo/command/watch/stop");
-  RepoCommandParameter watchStopParameter;
-  watchStopName.append(watchStopParameter.wireEncode());
-  Interest watchStopInterest(watchStopName);
-  keyChain.sign(watchStopInterest);
-
-  //The delayEvent will be canceled in onWatchInterest
-  watchFace.setInterestFilter(watchParameter.getName(),
-                              bind(&Fixture<T>::onWatchInterest, this, _2),
-                              ndn::RegisterPrefixSuccessCallback(),
-                              bind(&Fixture<T>::onRegisterFailed, this, _2));
-}
-
-typedef boost::mpl::vector<BasicDataset> Dataset;
-
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(WatchDelete, T, Dataset, Fixture<T>)
-{
-  // schedule events
-  this->scheduler.scheduleEvent(1_s,
-                                bind(&Fixture<T>::scheduleWatchEvent, this));
-
-  this->repoFace.processEvents(500_s);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace tests
-} // namespace repo
diff --git a/tests/integrated/test-basic-interest-read.cpp b/tests/integrated/test-basic-interest-read.cpp
index 0ad2f3c..d73b0d1 100644
--- a/tests/integrated/test-basic-interest-read.cpp
+++ b/tests/integrated/test-basic-interest-read.cpp
@@ -27,12 +27,14 @@
 #include <boost/asio/io_service.hpp>
 #include <boost/test/unit_test.hpp>
 
+#include <ndn-cxx/util/logger.hpp>
 #include <ndn-cxx/util/time.hpp>
 
 namespace repo {
 namespace tests {
 
-// All the test cases in this test suite should be run at once.
+NDN_LOG_INIT(repo.tests.read);
+
 BOOST_AUTO_TEST_SUITE(TestBasicInerestRead)
 
 const static uint8_t content[8] = {3, 1, 4, 1, 5, 9, 2, 6};
@@ -69,13 +71,16 @@
       (*i)->setContent(content, sizeof(content));
       (*i)->setFreshnessPeriod(36000_ms);
       keyChain.sign(**i);
+      NDN_LOG_DEBUG(**i);
       bool rc = handle->insertData(**i);
 
       BOOST_CHECK_EQUAL(rc, true);
+      NDN_LOG_DEBUG("Inserted Data " << (**i).getName());
+
       Interest readInterest((*i)->getName());
       readInterest.setMustBeFresh(true);
       scheduler.scheduleEvent(ndn::time::milliseconds(timeCount * 50),
-                              bind(&BasicInterestReadFixture<Dataset>::sendInterest, this,
+                              std::bind(&BasicInterestReadFixture<Dataset>::sendInterest, this,
                                         readInterest));
       timeCount++;
     }
@@ -91,22 +96,25 @@
   void
   onReadTimeout(const ndn::Interest& interest)
   {
-    BOOST_ERROR("Insert not successfull or Read data does not successfull");
+    NDN_LOG_DEBUG("Timed out " << interest.getName());
+    BOOST_ERROR("Insert or read not successfull");
   }
 
   void
   onReadNack(const ndn::Interest& interest, const ndn::lp::Nack& nack)
   {
+    NDN_LOG_DEBUG("Nacked " << interest.getName() << nack.getReason());
     BOOST_ERROR("Read nacked");
   }
 
   void
   sendInterest(const ndn::Interest& interest)
   {
+    NDN_LOG_DEBUG("Sending Interest " << interest.getName());
     readFace.expressInterest(interest,
-                             bind(&BasicInterestReadFixture::onReadData, this, _1, _2),
-                             bind(&BasicInterestReadFixture::onReadNack, this, _1, _2),
-                             bind(&BasicInterestReadFixture::onReadTimeout, this, _1));
+                             std::bind(&BasicInterestReadFixture::onReadData, this, _1, _2),
+                             std::bind(&BasicInterestReadFixture::onReadNack, this, _1, _2),
+                             std::bind(&BasicInterestReadFixture::onReadTimeout, this, _1));
   }
 
 public:
@@ -117,17 +125,16 @@
   ndn::Face readFace;
 };
 
-typedef boost::mpl::vector<BasicDataset,
-                            FetchByPrefixDataset,
-                            BasicChildSelectorDataset,
-                            ExtendedChildSelectorDataset,
-                            SamePrefixDataset<10>> Datasets;
+
+using Datasets = boost::mpl::vector<BasicDataset,
+                                    FetchByPrefixDataset,
+                                    SamePrefixDataset<10>>;
 
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(Read, T, Datasets, BasicInterestReadFixture<T>)
 {
   this->startListen();
   this->scheduler.scheduleEvent(1_s,
-                                bind(&BasicInterestReadFixture<T>::scheduleReadEvent, this));
+                                std::bind(&BasicInterestReadFixture<T>::scheduleReadEvent, this));
 
   this->repoFace.processEvents(20_s);
 
