diff --git a/tests/publisher/publisher-fixture.hpp b/tests/publisher/publisher-fixture.hpp
index 3dcf103..ffc7016 100644
--- a/tests/publisher/publisher-fixture.hpp
+++ b/tests/publisher/publisher-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021,  The University of Memphis,
+ * Copyright (c) 2014-2022,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -19,40 +19,31 @@
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NLSR_PUBLISHER_FIXTURE_HPP
-#define NLSR_PUBLISHER_FIXTURE_HPP
+#ifndef NLSR_TESTS_PUBLISHER_FIXTURE_HPP
+#define NLSR_TESTS_PUBLISHER_FIXTURE_HPP
 
 #include "publisher/dataset-interest-handler.hpp"
 #include "nlsr.hpp"
 
+#include "tests/io-key-chain-fixture.hpp"
 #include "tests/test-common.hpp"
 
-#include <ndn-cxx/util/dummy-client-face.hpp>
-#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/security/pib/identity.hpp>
-
-#include <ndn-cxx/util/io.hpp>
-
-#include <boost/filesystem.hpp>
-
-using namespace ndn;
-
 namespace nlsr {
 namespace test {
 
-class PublisherFixture : public BaseFixture
+class PublisherFixture : public IoKeyChainFixture
 {
 public:
   PublisherFixture()
-    : face(m_ioService, m_keyChain, {true, true})
+    : face(m_io, m_keyChain, {true, true})
     , conf(face, m_keyChain)
     , confProcessor(conf)
     , nlsr(face, m_keyChain, conf)
     , lsdb(nlsr.m_lsdb)
     , rt1(nlsr.m_routingTable)
   {
-    routerId = addIdentity(conf.getRouterPrefix());
-    face.processEvents(ndn::time::milliseconds(100));
+    routerId = m_keyChain.createIdentity(conf.getRouterPrefix());
+    advanceClocks(100_ms);
   }
 
   void
@@ -65,16 +56,28 @@
   NextHop
   createNextHop(const std::string& faceUri, double cost)
   {
-    NextHop nexthop(faceUri, cost);
-    return nexthop;
+    return {faceUri, cost};
   }
 
   CoordinateLsa
   createCoordinateLsa(const std::string& origin, double radius, std::vector<double> angle)
   {
-    CoordinateLsa lsa(origin, 1, ndn::time::system_clock::now(),
-                      radius, angle);
-    return lsa;
+    return {origin, 1, ndn::time::system_clock::now(), radius, angle};
+  }
+
+  void
+  processDatasetInterest(std::function<bool(const ndn::Block&)> isSameType)
+  {
+    advanceClocks(30_ms);
+
+    BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+    ndn::Block parser(face.sentData[0].getContent());
+    parser.parse();
+    face.sentData.clear();
+
+    auto it = parser.elements_begin();
+    BOOST_CHECK(isSameType(*it++));
+    BOOST_CHECK(it == parser.elements_end());
   }
 
 public:
@@ -91,4 +94,4 @@
 } // namespace test
 } // namespace nlsr
 
-#endif // NLSR_PUBLISHER_FIXTURE_HPP
+#endif // NLSR_TESTS_PUBLISHER_FIXTURE_HPP
diff --git a/tests/publisher/test-dataset-interest-handler.cpp b/tests/publisher/test-dataset-interest-handler.cpp
index b8a44d3..2e71585 100644
--- a/tests/publisher/test-dataset-interest-handler.cpp
+++ b/tests/publisher/test-dataset-interest-handler.cpp
@@ -22,30 +22,11 @@
 #include "publisher/dataset-interest-handler.hpp"
 #include "tlv-nlsr.hpp"
 
-#include "tests/test-common.hpp"
-#include "publisher-fixture.hpp"
+#include "tests/publisher/publisher-fixture.hpp"
 
 namespace nlsr {
 namespace test {
 
-static void
-processDatasetInterest(ndn::util::DummyClientFace& face,
-                       std::function<bool(const ndn::Block&)> isSameType)
-{
-  face.processEvents(30_ms);
-
-  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
-
-  ndn::Block parser(face.sentData[0].getContent());
-  parser.parse();
-
-  auto it = parser.elements_begin();
-  BOOST_CHECK_EQUAL(isSameType(*it++), true);
-  BOOST_CHECK(it == parser.elements_end());
-
-  face.sentData.clear();
-}
-
 BOOST_FIXTURE_TEST_SUITE(TestDatasetInterestHandler, PublisherFixture)
 
 BOOST_AUTO_TEST_CASE(Localhost)
@@ -70,29 +51,23 @@
   const ndn::Name& DEST_ROUTER = rte1.getDestination();
 
   NextHop nh = createNextHop("udp://face-test1", 10);
-
   rt1.addNextHop(DEST_ROUTER, nh);
 
   // Request adjacency LSAs
   face.receive(ndn::Interest("/localhost/nlsr/lsdb/adjacencies").setCanBePrefix(true));
-  processDatasetInterest(face,
-    [] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::AdjacencyLsa; });
+  processDatasetInterest([] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::AdjacencyLsa; });
 
   // Request coordinate LSAs
   face.receive(ndn::Interest("/localhost/nlsr/lsdb/coordinates").setCanBePrefix(true));
-  processDatasetInterest(face,
-    [] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::CoordinateLsa; });
+  processDatasetInterest([] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::CoordinateLsa; });
 
   // Request Name LSAs
   face.receive(ndn::Interest("/localhost/nlsr/lsdb/names").setCanBePrefix(true));
-  processDatasetInterest(face,
-    [] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::NameLsa; });
+  processDatasetInterest([] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::NameLsa; });
 
   // Request Routing Table
   face.receive(ndn::Interest("/localhost/nlsr/routing-table").setCanBePrefix(true));
-  processDatasetInterest(face,
-    [] (const ndn::Block& block) {
-      return block.type() == ndn::tlv::nlsr::RoutingTable; });
+  processDatasetInterest([] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::RoutingTable; });
 }
 
 BOOST_AUTO_TEST_CASE(RouterName)
@@ -126,23 +101,19 @@
 
   // Request adjacency LSAs
   face.receive(ndn::Interest(ndn::Name(routerName).append("lsdb").append("adjacencies")).setCanBePrefix(true));
-  processDatasetInterest(face,
-    [] (const auto& block) { return block.type() == ndn::tlv::nlsr::AdjacencyLsa; });
+  processDatasetInterest([] (const auto& block) { return block.type() == ndn::tlv::nlsr::AdjacencyLsa; });
 
   // Request coordinate LSAs
   face.receive(ndn::Interest(ndn::Name(routerName).append("lsdb").append("coordinates")).setCanBePrefix(true));
-  processDatasetInterest(face,
-    [] (const auto& block) { return block.type() == ndn::tlv::nlsr::CoordinateLsa; });
+  processDatasetInterest([] (const auto& block) { return block.type() == ndn::tlv::nlsr::CoordinateLsa; });
 
   // Request Name LSAs
   face.receive(ndn::Interest(ndn::Name(routerName).append("lsdb").append("names")).setCanBePrefix(true));
-  processDatasetInterest(face,
-    [] (const auto& block) { return block.type() == ndn::tlv::nlsr::NameLsa; });
+  processDatasetInterest([] (const auto& block) { return block.type() == ndn::tlv::nlsr::NameLsa; });
 
   // Request Routing Table
   face.receive(ndn::Interest(ndn::Name(routerName).append("routing-table")).setCanBePrefix(true));
-  processDatasetInterest(face,
-    [] (const auto& block) { return block.type() == ndn::tlv::nlsr::RoutingTable; });
+  processDatasetInterest([] (const auto& block) { return block.type() == ndn::tlv::nlsr::RoutingTable; });
 }
 
 BOOST_AUTO_TEST_SUITE_END()
