diff --git a/tests/chunks/consumer.t.cpp b/tests/chunks/consumer.t.cpp
index a2bd683..32e6914 100644
--- a/tests/chunks/consumer.t.cpp
+++ b/tests/chunks/consumer.t.cpp
@@ -28,6 +28,7 @@
 #include "tools/chunks/catchunks/pipeline-interests.hpp"
 
 #include "tests/test-common.hpp"
+#include "tests/io-fixture.hpp"
 
 #include <ndn-cxx/security/validator-null.hpp>
 #include <ndn-cxx/util/dummy-client-face.hpp>
@@ -151,10 +152,9 @@
   bool isPipelineRunning = false;
 };
 
-BOOST_FIXTURE_TEST_CASE(RunBasic, UnitTestTimeFixture)
+BOOST_FIXTURE_TEST_CASE(RunBasic, IoFixture)
 {
-  boost::asio::io_service io;
-  util::DummyClientFace face(io);
+  util::DummyClientFace face(m_io);
   Options options;
   Consumer consumer(security::getAcceptAllValidator());
 
@@ -166,7 +166,7 @@
   BOOST_CHECK_EQUAL(pipelinePtr->isPipelineRunning, false);
 
   consumer.run(std::move(discover), std::move(pipeline));
-  this->advanceClocks(io, 1_ms);
+  this->advanceClocks(1_ms);
 
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 0); // no discovery Interests are issued
   BOOST_CHECK_EQUAL(pipelinePtr->isPipelineRunning, true);
diff --git a/tests/chunks/discover-version.t.cpp b/tests/chunks/discover-version.t.cpp
index 9c3a844..79315cc 100644
--- a/tests/chunks/discover-version.t.cpp
+++ b/tests/chunks/discover-version.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2020, Regents of the University of California,
  *                          Colorado State University,
  *                          University Pierre & Marie Curie, Sorbonne University.
  *
@@ -26,7 +26,8 @@
 #include "tools/chunks/catchunks/discover-version.hpp"
 
 #include "tests/test-common.hpp"
-#include "tests/identity-management-fixture.hpp"
+#include "tests/io-fixture.hpp"
+#include "tests/key-chain-fixture.hpp"
 
 #include <ndn-cxx/metadata-object.hpp>
 #include <ndn-cxx/util/dummy-client-face.hpp>
@@ -37,8 +38,7 @@
 
 using namespace ndn::tests;
 
-class DiscoverVersionFixture : public UnitTestTimeFixture,
-                               public IdentityManagementFixture
+class DiscoverVersionFixture : public IoFixture, public KeyChainFixture
 {
 public:
   void
@@ -56,14 +56,13 @@
     });
 
     discover->run();
-    advanceClocks(io, 1_ns);
+    advanceClocks(1_ns);
   }
 
 protected:
   const Name name = "/ndn/chunks/test";
   const uint64_t version = 1449227841747;
-  boost::asio::io_service io;
-  util::DummyClientFace face{io};
+  util::DummyClientFace face{m_io};
   Options opt;
   unique_ptr<DiscoverVersion> discover;
   optional<Name> discoveredName;
@@ -113,7 +112,7 @@
   MetadataObject mobject;
   mobject.setVersionedName(Name(name).appendVersion(version));
   face.receive(mobject.makeData(lastInterest.getName(), m_keyChain));
-  advanceClocks(io, 1_ns);
+  advanceClocks(1_ns);
 
   BOOST_CHECK_EQUAL(discoveredVersion.value(), version);
 }
@@ -163,11 +162,11 @@
   // timeout or nack discovery Interests
   for (int retries = 0; retries < opt.maxRetriesOnTimeoutOrNack * 2; ++retries) {
     if (retries % 2 == 0) {
-      advanceClocks(io, opt.interestLifetime);
+      advanceClocks(opt.interestLifetime);
     }
     else {
       face.receive(makeNack(face.sentInterests.back(), lp::NackReason::DUPLICATE));
-      advanceClocks(io, 1_ns);
+      advanceClocks(1_ns);
     }
 
     BOOST_CHECK_EQUAL(isDiscoveryFinished, false);
@@ -175,7 +174,7 @@
   }
 
   // timeout the last sent Interest
-  advanceClocks(io, opt.interestLifetime);
+  advanceClocks(opt.interestLifetime);
 
   // finish discovery process without a resolved version number
   BOOST_CHECK_EQUAL(isDiscoveryFinished, true);
@@ -193,11 +192,11 @@
   // timeout or nack discovery Interests
   for (int retries = 0; retries < opt.maxRetriesOnTimeoutOrNack * 2; ++retries) {
     if (retries % 2 == 0) {
-      advanceClocks(io, opt.interestLifetime);
+      advanceClocks(opt.interestLifetime);
     }
     else {
       face.receive(makeNack(face.sentInterests.back(), lp::NackReason::DUPLICATE));
-      advanceClocks(io, 1_ns);
+      advanceClocks(1_ns);
     }
 
     BOOST_CHECK_EQUAL(isDiscoveryFinished, false);
@@ -208,7 +207,7 @@
   MetadataObject mobject;
   mobject.setVersionedName(Name(name).appendVersion(version));
   face.receive(mobject.makeData(face.sentInterests.back().getName(), m_keyChain));
-  advanceClocks(io, 1_ns);
+  advanceClocks(1_ns);
 
   BOOST_CHECK_EQUAL(discoveredVersion.value(), version);
 }
diff --git a/tests/chunks/pipeline-interests-aimd.t.cpp b/tests/chunks/pipeline-interests-aimd.t.cpp
index f38251a..feed933 100644
--- a/tests/chunks/pipeline-interests-aimd.t.cpp
+++ b/tests/chunks/pipeline-interests-aimd.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2020, Regents of the University of California,
  *                          Colorado State University,
  *                          University Pierre & Marie Curie, Sorbonne University.
  *
@@ -88,12 +88,12 @@
 
   double preCwnd = pipeline->m_cwnd;
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   for (uint64_t i = 0; i < nDataSegments - 1; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
     BOOST_CHECK_CLOSE(pipeline->m_cwnd - preCwnd, 1, MARGIN);
     preCwnd = pipeline->m_cwnd;
   }
@@ -109,12 +109,12 @@
 
   double preCwnd = pipeline->m_cwnd;
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   for (uint64_t i = 0; i < pipeline->m_ssthresh; ++i) { // slow start
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
     preCwnd = pipeline->m_cwnd;
   }
 
@@ -122,7 +122,7 @@
 
   for (uint64_t i = pipeline->m_ssthresh; i < nDataSegments - 1; ++i) { // congestion avoidance
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
     BOOST_CHECK_CLOSE(pipeline->m_cwnd - preCwnd, opt.aiStep / floor(preCwnd), MARGIN);
     preCwnd = pipeline->m_cwnd;
   }
@@ -137,28 +137,28 @@
   BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segment 0, 1, and 2
   for (uint64_t i = 0; i < 3; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 3);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.25, MARGIN);
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 7); // request for segment 7 has been sent
 
-  advanceClocks(io, time::milliseconds(100));
+  advanceClocks(time::milliseconds(100));
 
   // receive segment 4
   face.receive(*makeDataWithSegment(4));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 5
   face.receive(*makeDataWithSegment(5));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 5);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.75, MARGIN);
@@ -172,7 +172,7 @@
   BOOST_CHECK_EQUAL(pipeline->m_nCongMarks, 0);
 
   // timeout segment 3 & 6
-  advanceClocks(io, time::milliseconds(150));
+  advanceClocks(time::milliseconds(150));
   BOOST_CHECK_EQUAL(pipeline->m_nTimeouts, 2);
   BOOST_CHECK_EQUAL(pipeline->m_nRetransmitted, 1);
   BOOST_CHECK_EQUAL(pipeline->m_nLossDecr, 1);
@@ -184,7 +184,7 @@
 
   // receive segment 6, retransmit 3
   face.receive(*makeDataWithSegment(6));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 2.875, MARGIN); // congestion avoidance
@@ -205,13 +205,13 @@
   BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segments 0 to 4
   for (uint64_t i = 0; i < 5; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 5);
@@ -219,7 +219,7 @@
 
   // receive segment 5 with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(5));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 2.375, MARGIN); // window size drops to 1/2 of previous size
@@ -227,7 +227,7 @@
 
   // receive the last segment with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(nDataSegments - 1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, nDataSegments);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 2.375, MARGIN); // conservative window adaption (window size should not decrease)
@@ -251,13 +251,13 @@
   BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segments 0 to 4
   for (uint64_t i = 0; i < 5; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 5);
@@ -265,7 +265,7 @@
 
   // receive segment 5 with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(5));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 2.375, MARGIN); // window size drops to 1/2 of previous size
@@ -273,7 +273,7 @@
 
   // receive the last segment with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(nDataSegments - 1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, nDataSegments);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, PipelineInterestsAdaptive::MIN_SSTHRESH,
@@ -298,13 +298,13 @@
   BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segments 0 to 5
   for (uint64_t i = 0; i < 6; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
@@ -313,7 +313,7 @@
 
   // receive the last segment with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(nDataSegments - 1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, nDataSegments);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 5.2, MARGIN); // window size increases
@@ -331,13 +331,13 @@
   nDataSegments = 5;
   pipeline->m_cwnd = 10.0;
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   face.receive(*makeDataWithSegment(0));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   face.receive(*makeDataWithSegment(1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 2);
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 10);
@@ -345,7 +345,7 @@
   // receive a nack with NackReason::DUPLICATE for segment 1
   auto nack1 = makeNack(face.sentInterests[1], lp::NackReason::DUPLICATE);
   face.receive(nack1);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // nack1 is ignored
   BOOST_CHECK_EQUAL(hasFailed, false);
@@ -355,7 +355,7 @@
   // receive a nack with NackReason::CONGESTION for segment 2
   auto nack2 = makeNack(face.sentInterests[2], lp::NackReason::CONGESTION);
   face.receive(nack2);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // segment 2 is retransmitted
   BOOST_CHECK_EQUAL(pipeline->m_retxCount[2], 1);
@@ -363,7 +363,7 @@
   // receive a nack with NackReason::NONE for segment 3
   auto nack3 = makeNack(face.sentInterests[3], lp::NackReason::NONE);
   face.receive(nack3);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // Other types of Nack will trigger a failure
   BOOST_CHECK_EQUAL(hasFailed, true);
@@ -375,11 +375,11 @@
   nDataSegments = 4;
   pipeline->m_cwnd = 4;
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 0 without FinalBlockId
   face.receive(*makeDataWithSegment(0, false));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // interests for segment 0 - 5 have been sent
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 6);
@@ -390,7 +390,7 @@
 
   // receive segment 1 with FinalBlockId
   face.receive(*makeDataWithSegment(1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 2);
   BOOST_CHECK_EQUAL(pipeline->m_hasFinalBlockId, true);
 
@@ -407,15 +407,15 @@
   nDataSegments = 4;
   pipeline->m_cwnd = 4;
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 0 without FinalBlockId
   face.receive(*makeDataWithSegment(0, false));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 1 without FinalBlockId
   face.receive(*makeDataWithSegment(1, false));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // interests for segment 0 - 7 have been sent
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 8);
@@ -423,7 +423,7 @@
   // receive nack with NackReason::NONE for segment 3
   auto nack = makeNack(face.sentInterests[3], lp::NackReason::NONE);
   face.receive(nack);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // error not triggered
   // pending interests for segment > 3 haven been removed
@@ -432,7 +432,7 @@
 
   // receive segment 2 with FinalBlockId
   face.receive(*makeDataWithSegment(2));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // error triggered since segment 3 is part of the content
   BOOST_CHECK_EQUAL(hasFailed, true);
@@ -447,15 +447,15 @@
   nDataSegments = 4;
   pipeline->m_cwnd = 4;
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 0 without FinalBlockId
   face.receive(*makeDataWithSegment(0, false));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 1 without FinalBlockId
   face.receive(*makeDataWithSegment(1, false));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // interests for segment 0 - 7 have been sent
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 8);
@@ -463,7 +463,7 @@
   // receive nack with NackReason::NONE for segment 4
   auto nack = makeNack(face.sentInterests[4], lp::NackReason::NONE);
   face.receive(nack);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // error not triggered
   // pending interests for segment > 3 have been removed
@@ -472,17 +472,17 @@
 
   // receive segment 2 with FinalBlockId
   face.receive(*makeDataWithSegment(2));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // timeout segment 3
-  advanceClocks(io, time::seconds(1));
+  advanceClocks(time::seconds(1));
 
   // segment 3 is retransmitted
   BOOST_CHECK_EQUAL(pipeline->m_retxCount[3], 1);
 
   // receive segment 3
   face.receive(*makeDataWithSegment(3));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(hasFailed, false);
 }
@@ -495,15 +495,15 @@
   nDataSegments = 3;
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 0
   face.receive(*makeDataWithSegment(0));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 1
   face.receive(*makeDataWithSegment(1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 3);
 
@@ -513,7 +513,7 @@
   BOOST_CHECK(it->second.state == SegmentState::FirstTimeSent);
 
   // timeout segment 2 twice
-  advanceClocks(io, time::milliseconds(400), 3);
+  advanceClocks(time::milliseconds(400), 3);
 
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 5);
 
@@ -527,7 +527,7 @@
 
   // receive segment 2 the first time
   face.receive(*makeDataWithSegment(2));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // check if segment 2 was erased from m_segmentInfo
   it = pipeline->m_segmentInfo.find(2);
@@ -538,7 +538,7 @@
 
   // receive segment 2 the second time
   face.receive(*makeDataWithSegment(2));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // nothing changed
   it = pipeline->m_segmentInfo.find(2);
@@ -582,10 +582,10 @@
   nDataSegments = 1;
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   face.receive(*makeDataWithSegment(0));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_hasFinalBlockId, true);
   BOOST_CHECK_EQUAL(pipeline->m_segmentInfo.size(), 0);
diff --git a/tests/chunks/pipeline-interests-cubic.t.cpp b/tests/chunks/pipeline-interests-cubic.t.cpp
index 51d5be2..fc53343 100644
--- a/tests/chunks/pipeline-interests-cubic.t.cpp
+++ b/tests/chunks/pipeline-interests-cubic.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2020, Regents of the University of California,
  *                          Colorado State University,
  *                          University Pierre & Marie Curie, Sorbonne University.
  *
@@ -87,12 +87,12 @@
 
   double preCwnd = pipeline->m_cwnd;
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   for (uint64_t i = 0; i < nDataSegments - 1; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
     BOOST_CHECK_CLOSE(pipeline->m_cwnd - preCwnd, 1, MARGIN);
     preCwnd = pipeline->m_cwnd;
   }
@@ -107,28 +107,28 @@
   BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segment 0, 1, and 2
   for (uint64_t i = 0; i < 3; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 3);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 5, MARGIN);
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 8); // request for segment #7 has been sent
 
-  advanceClocks(io, time::milliseconds(100));
+  advanceClocks(time::milliseconds(100));
 
   // receive segment 4
   face.receive(*makeDataWithSegment(4));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 5
   face.receive(*makeDataWithSegment(5));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 5);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 7.0, MARGIN);
@@ -142,7 +142,7 @@
   BOOST_CHECK_EQUAL(pipeline->m_nCongMarks, 0);
 
   // timeout segment 3 & 6
-  advanceClocks(io, time::milliseconds(150));
+  advanceClocks(time::milliseconds(150));
   BOOST_CHECK_EQUAL(pipeline->m_nTimeouts, 3);
   BOOST_CHECK_EQUAL(pipeline->m_nRetransmitted, 3);
   BOOST_CHECK_EQUAL(pipeline->m_nLossDecr, 1);
@@ -154,7 +154,7 @@
 
   // receive segment 6, retransmit 3
   face.receive(*makeDataWithSegment(6));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.9, MARGIN); // congestion avoidance
@@ -174,13 +174,13 @@
   BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segments 0 to 4
   for (uint64_t i = 0; i < 5; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 5);
@@ -188,7 +188,7 @@
 
   // receive segment 5 with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(5));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.9, MARGIN); // window size drops to 0.7x of previous size
@@ -196,7 +196,7 @@
 
   // receive the last segment with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(nDataSegments - 1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, nDataSegments);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.9, MARGIN); // conservative window adaption (window size should not decrease)
@@ -219,13 +219,13 @@
   BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segments 0 to 4
   for (uint64_t i = 0; i < 5; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 5);
@@ -233,7 +233,7 @@
 
   // receive segment 5 with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(5));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 4.9, MARGIN); // window size drops to 0.7x of previous size
@@ -241,7 +241,7 @@
 
   // receive the last segment with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(nDataSegments - 1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, nDataSegments);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 3.43, MARGIN); // window size should decrease, as cwa is disabled
@@ -264,13 +264,13 @@
   BOOST_REQUIRE_CLOSE(pipeline->m_cwnd, 2, MARGIN);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 2);
 
   // receive segments 0 to 5
   for (uint64_t i = 0; i < 6; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1));
+    advanceClocks(time::nanoseconds(1));
   }
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 6);
@@ -279,7 +279,7 @@
 
   // receive the last segment with congestion mark
   face.receive(*makeDataWithSegmentAndCongMark(nDataSegments - 1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, nDataSegments);
   BOOST_CHECK_CLOSE(pipeline->m_cwnd, 9.0, MARGIN); // window size increases
@@ -297,13 +297,13 @@
   nDataSegments = 5;
   pipeline->m_cwnd = 10.0;
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   face.receive(*makeDataWithSegment(0));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   face.receive(*makeDataWithSegment(1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 2);
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 10);
@@ -311,7 +311,7 @@
   // receive a nack with NackReason::DUPLICATE for segment 1
   auto nack1 = makeNack(face.sentInterests[1], lp::NackReason::DUPLICATE);
   face.receive(nack1);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // nack1 is ignored
   BOOST_CHECK_EQUAL(hasFailed, false);
@@ -321,7 +321,7 @@
   // receive a nack with NackReason::CONGESTION for segment 2
   auto nack2 = makeNack(face.sentInterests[2], lp::NackReason::CONGESTION);
   face.receive(nack2);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // segment 2 is retransmitted
   BOOST_CHECK_EQUAL(pipeline->m_retxCount[2], 1);
@@ -329,7 +329,7 @@
   // receive a nack with NackReason::NONE for segment 3
   auto nack3 = makeNack(face.sentInterests[3], lp::NackReason::NONE);
   face.receive(nack3);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // Other types of Nack will trigger a failure
   BOOST_CHECK_EQUAL(hasFailed, true);
@@ -341,11 +341,11 @@
   nDataSegments = 4;
   pipeline->m_cwnd = 4;
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 0 without FinalBlockId
   face.receive(*makeDataWithSegment(0, false));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // interests for segment 0 - 5 have been sent
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 6);
@@ -356,7 +356,7 @@
 
   // receive segment 1 with FinalBlockId
   face.receive(*makeDataWithSegment(1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 2);
   BOOST_CHECK_EQUAL(pipeline->m_hasFinalBlockId, true);
 
@@ -373,15 +373,15 @@
   nDataSegments = 4;
   pipeline->m_cwnd = 4;
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 0 without FinalBlockId
   face.receive(*makeDataWithSegment(0, false));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 1 without FinalBlockId
   face.receive(*makeDataWithSegment(1, false));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // interests for segment 0 - 7 have been sent
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 8);
@@ -389,7 +389,7 @@
   // receive nack with NackReason::NONE for segment 3
   auto nack = makeNack(face.sentInterests[3], lp::NackReason::NONE);
   face.receive(nack);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // error not triggered
   // pending interests for segment > 3 haven been removed
@@ -398,7 +398,7 @@
 
   // receive segment 2 with FinalBlockId
   face.receive(*makeDataWithSegment(2));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // error triggered since segment 3 is part of the content
   BOOST_CHECK_EQUAL(hasFailed, true);
@@ -413,15 +413,15 @@
   nDataSegments = 4;
   pipeline->m_cwnd = 4;
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 0 without FinalBlockId
   face.receive(*makeDataWithSegment(0, false));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 1 without FinalBlockId
   face.receive(*makeDataWithSegment(1, false));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // interests for segment 0 - 7 have been sent
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 8);
@@ -429,7 +429,7 @@
   // receive nack with NackReason::NONE for segment 4
   auto nack = makeNack(face.sentInterests[4], lp::NackReason::NONE);
   face.receive(nack);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // error not triggered
   // pending interests for segment > 3 have been removed
@@ -438,17 +438,17 @@
 
   // receive segment 2 with FinalBlockId
   face.receive(*makeDataWithSegment(2));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // timeout segment 3
-  advanceClocks(io, time::seconds(1));
+  advanceClocks(time::seconds(1));
 
   // segment 3 is retransmitted
   BOOST_CHECK_EQUAL(pipeline->m_retxCount[3], 1);
 
   // receive segment 3
   face.receive(*makeDataWithSegment(3));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(hasFailed, false);
 }
@@ -461,15 +461,15 @@
   nDataSegments = 3;
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 0
   face.receive(*makeDataWithSegment(0));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // receive segment 1
   face.receive(*makeDataWithSegment(1));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 3);
 
@@ -479,7 +479,7 @@
   BOOST_CHECK(it->second.state == SegmentState::FirstTimeSent);
 
   // timeout segment 2 twice
-  advanceClocks(io, time::milliseconds(400), 3);
+  advanceClocks(time::milliseconds(400), 3);
 
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 5);
 
@@ -493,7 +493,7 @@
 
   // receive segment 2 the first time
   face.receive(*makeDataWithSegment(2));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // check if segment 2 was erased from m_segmentInfo
   it = pipeline->m_segmentInfo.find(2);
@@ -504,7 +504,7 @@
 
   // receive segment 2 the second time
   face.receive(*makeDataWithSegment(2));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   // nothing changed
   it = pipeline->m_segmentInfo.find(2);
@@ -548,10 +548,10 @@
   nDataSegments = 1;
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   face.receive(*makeDataWithSegment(0));
-  advanceClocks(io, time::nanoseconds(1));
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_hasFinalBlockId, true);
   BOOST_CHECK_EQUAL(pipeline->m_segmentInfo.size(), 0);
diff --git a/tests/chunks/pipeline-interests-fixed.t.cpp b/tests/chunks/pipeline-interests-fixed.t.cpp
index f4979a2..872fe4e 100644
--- a/tests/chunks/pipeline-interests-fixed.t.cpp
+++ b/tests/chunks/pipeline-interests-fixed.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2020, Regents of the University of California,
  *                          Colorado State University,
  *                          University Pierre & Marie Curie, Sorbonne University.
  *
@@ -67,12 +67,12 @@
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1), 1);
+  advanceClocks(time::nanoseconds(1));
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
   for (uint64_t i = 0; i < nDataSegments - 1; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1), 1);
+    advanceClocks(time::nanoseconds(1));
     BOOST_CHECK_EQUAL(pipeline->m_nReceived, i + 1);
 
     if (i < nDataSegments - opt.maxPipelineSize) {
@@ -92,7 +92,7 @@
 
   BOOST_CHECK_EQUAL(hasFailed, false);
 
-  advanceClocks(io, ndn::DEFAULT_INTEREST_LIFETIME, opt.maxRetriesOnTimeoutOrNack + 1);
+  advanceClocks(ndn::DEFAULT_INTEREST_LIFETIME, opt.maxRetriesOnTimeoutOrNack + 1);
   BOOST_CHECK_EQUAL(hasFailed, true);
 }
 
@@ -102,11 +102,11 @@
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1), 1);
+  advanceClocks(time::nanoseconds(1));
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
   for (int i = 0; i < opt.maxRetriesOnTimeoutOrNack; ++i) {
-    advanceClocks(io, opt.interestLifetime, 1);
+    advanceClocks(opt.interestLifetime);
     BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize * (i + 2));
     BOOST_CHECK_EQUAL(pipeline->m_nReceived, 0);
 
@@ -117,7 +117,7 @@
     }
   }
 
-  advanceClocks(io, opt.interestLifetime, 1);
+  advanceClocks(opt.interestLifetime);
   BOOST_CHECK_EQUAL(hasFailed, true);
 }
 
@@ -130,23 +130,23 @@
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1), 1);
+  advanceClocks(time::nanoseconds(1));
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
   // send a single segment for each pipeline element but not the first element
-  advanceClocks(io, opt.interestLifetime, 1);
+  advanceClocks(opt.interestLifetime);
   for (uint64_t i = 1; i < opt.maxPipelineSize; ++i) {
     face.receive(*makeDataWithSegment(i));
-    advanceClocks(io, time::nanoseconds(1), 1);
+    advanceClocks(time::nanoseconds(1));
   }
 
   // send a single data packet for each pipeline element
-  advanceClocks(io, opt.interestLifetime, opt.maxRetriesOnTimeoutOrNack - 1);
+  advanceClocks(opt.interestLifetime, opt.maxRetriesOnTimeoutOrNack - 1);
   for (uint64_t i = 0; i < opt.maxPipelineSize; ++i) {
     face.receive(*makeDataWithSegment(opt.maxPipelineSize + i));
-    advanceClocks(io, time::nanoseconds(1), 1);
+    advanceClocks(time::nanoseconds(1));
   }
-  advanceClocks(io, opt.interestLifetime, 1);
+  advanceClocks(opt.interestLifetime);
 
   size_t interestAfterFailure = face.sentInterests.size();
 
@@ -154,14 +154,14 @@
   BOOST_CHECK_EQUAL(hasFailed, true);
 
   // these new segments should not generate new interests
-  advanceClocks(io, opt.interestLifetime, 1);
+  advanceClocks(opt.interestLifetime);
   for (uint64_t i = 0; i < opt.maxPipelineSize; ++i) {
     face.receive(*makeDataWithSegment(opt.maxPipelineSize * 2 + i - 1));
-    advanceClocks(io, time::nanoseconds(1), 1);
+    advanceClocks(time::nanoseconds(1));
   }
 
   // no more interests after a failure
-  advanceClocks(io, opt.interestLifetime, opt.maxRetriesOnTimeoutOrNack);
+  advanceClocks(opt.interestLifetime, opt.maxRetriesOnTimeoutOrNack);
   BOOST_CHECK_EQUAL(interestAfterFailure, face.sentInterests.size());
   BOOST_CHECK_EQUAL(face.getNPendingInterests(), 0);
 }
@@ -175,13 +175,13 @@
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1), 1);
+  advanceClocks(time::nanoseconds(1));
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
-  advanceClocks(io, opt.interestLifetime, 1);
+  advanceClocks(opt.interestLifetime);
   for (uint64_t i = 2; i < opt.maxPipelineSize; ++i) {
     face.receive(*makeDataWithSegment(i, false));
-    advanceClocks(io, time::nanoseconds(1), 1);
+    advanceClocks(time::nanoseconds(1));
 
     const auto& lastInterest = face.sentInterests.back();
     BOOST_CHECK_EQUAL(getSegmentFromPacket(lastInterest), opt.maxPipelineSize + i - 2);
@@ -195,7 +195,7 @@
 
   // all the pipeline elements are two retries near the timeout error, but not the
   // second (segment #1) that is only one retry near the timeout
-  advanceClocks(io, opt.interestLifetime, opt.maxRetriesOnTimeoutOrNack - 1);
+  advanceClocks(opt.interestLifetime, opt.maxRetriesOnTimeoutOrNack - 1);
   BOOST_CHECK_EQUAL(hasFailed, false);
 
   // data for the first pipeline element (segment #0)
@@ -210,10 +210,10 @@
     else {
       face.receive(*makeDataWithSegment(i, false));
     }
-    advanceClocks(io, time::nanoseconds(1), 1);
+    advanceClocks(time::nanoseconds(1));
   }
   // timeout for the second pipeline element (segment #1), this should trigger an error
-  advanceClocks(io, opt.interestLifetime, 1);
+  advanceClocks(opt.interestLifetime);
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, nDataSegments - 1);
   BOOST_CHECK_EQUAL(hasFailed, true);
@@ -228,10 +228,10 @@
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1), 1);
+  advanceClocks(time::nanoseconds(1));
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
-  advanceClocks(io, opt.interestLifetime, 1);
+  advanceClocks(opt.interestLifetime);
 
   // nack for the first pipeline element (segment #0)
   auto nack = make_shared<lp::Nack>(face.sentInterests[opt.maxPipelineSize]);
@@ -240,13 +240,13 @@
   BOOST_CHECK_EQUAL(hasFailed, false);
 
   // timeout for all the pipeline elements, but not the first (segment #0)
-  advanceClocks(io, opt.interestLifetime, opt.maxRetriesOnTimeoutOrNack);
+  advanceClocks(opt.interestLifetime, opt.maxRetriesOnTimeoutOrNack);
   BOOST_CHECK_EQUAL(hasFailed, false);
 
   // data for the first pipeline element (segment #0), this should trigger an error because the
   // other pipeline elements failed
   face.receive(*makeDataWithSegment(0, false));
-  advanceClocks(io, time::nanoseconds(1), 1);
+  advanceClocks(time::nanoseconds(1));
 
   BOOST_CHECK_EQUAL(pipeline->m_nReceived, 1);
   BOOST_CHECK_EQUAL(hasFailed, true);
@@ -258,7 +258,7 @@
   BOOST_ASSERT(nDataSegments > opt.maxPipelineSize);
 
   run(name);
-  advanceClocks(io, time::nanoseconds(1), 1);
+  advanceClocks(time::nanoseconds(1));
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize);
 
   // send nack for all the pipeline elements first interest
@@ -266,7 +266,7 @@
     auto nack = make_shared<lp::Nack>(face.sentInterests[i]);
     nack->setReason(lp::NackReason::CONGESTION);
     face.receive(*nack);
-    advanceClocks(io, time::nanoseconds(1), 1);
+    advanceClocks(time::nanoseconds(1));
   }
 
   // send nack for all the pipeline elements interests after the first
@@ -275,7 +275,7 @@
     if (backoffTime > DataFetcher::MAX_CONGESTION_BACKOFF_TIME)
       backoffTime = DataFetcher::MAX_CONGESTION_BACKOFF_TIME;
 
-    advanceClocks(io, backoffTime, 1);
+    advanceClocks(backoffTime);
     BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize * (i +1));
 
     // A single retry for every pipeline element
@@ -288,7 +288,7 @@
       auto nack = make_shared<lp::Nack>(face.sentInterests[(opt.maxPipelineSize * i) + j]);
       nack->setReason(lp::NackReason::CONGESTION);
       face.receive(*nack);
-      advanceClocks(io, time::nanoseconds(1), 1);
+      advanceClocks(time::nanoseconds(1));
     }
   }
 
diff --git a/tests/chunks/pipeline-interests-fixture.hpp b/tests/chunks/pipeline-interests-fixture.hpp
index dc7eabd..643047a 100644
--- a/tests/chunks/pipeline-interests-fixture.hpp
+++ b/tests/chunks/pipeline-interests-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2020, Regents of the University of California,
  *                          Colorado State University,
  *                          University Pierre & Marie Curie, Sorbonne University.
  *
@@ -32,6 +32,7 @@
 #include "tools/chunks/catchunks/pipeline-interests.hpp"
 
 #include "tests/test-common.hpp"
+#include "tests/io-fixture.hpp"
 
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
@@ -41,7 +42,7 @@
 
 using namespace ndn::tests;
 
-class PipelineInterestsFixture : public UnitTestTimeFixture
+class PipelineInterestsFixture : public IoFixture
 {
 protected:
   void
@@ -78,8 +79,7 @@
   }
 
 protected:
-  boost::asio::io_service io;
-  util::DummyClientFace face{io};
+  util::DummyClientFace face{m_io};
   Name name{"/ndn/chunks/test"};
   uint64_t nDataSegments = 0;
   bool hasFailed = false;
diff --git a/tests/chunks/producer.t.cpp b/tests/chunks/producer.t.cpp
index 6b46320..6934fa4 100644
--- a/tests/chunks/producer.t.cpp
+++ b/tests/chunks/producer.t.cpp
@@ -26,7 +26,7 @@
 #include "tools/chunks/putchunks/producer.hpp"
 
 #include "tests/test-common.hpp"
-#include "tests/identity-management-fixture.hpp"
+#include "tests/key-chain-fixture.hpp"
 
 #include <ndn-cxx/metadata-object.hpp>
 #include <ndn-cxx/security/pib/identity.hpp>
@@ -42,7 +42,7 @@
 
 using namespace ndn::tests;
 
-class ProducerFixture : public IdentityManagementFixture
+class ProducerFixture : public KeyChainFixture
 {
 protected:
   ProducerFixture()
diff --git a/tests/clock-fixture.cpp b/tests/clock-fixture.cpp
new file mode 100644
index 0000000..564f128
--- /dev/null
+++ b/tests/clock-fixture.cpp
@@ -0,0 +1,60 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2020,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of ndn-tools (Named Data Networking Essential Tools).
+ * See AUTHORS.md for complete list of ndn-tools authors and contributors.
+ *
+ * ndn-tools 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.
+ *
+ * ndn-tools 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
+ * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "tests/clock-fixture.hpp"
+
+namespace ndn {
+namespace tests {
+
+ClockFixture::ClockFixture()
+  : m_steadyClock(make_shared<time::UnitTestSteadyClock>())
+  , m_systemClock(make_shared<time::UnitTestSystemClock>())
+{
+  time::setCustomClocks(m_steadyClock, m_systemClock);
+}
+
+ClockFixture::~ClockFixture()
+{
+  time::setCustomClocks(nullptr, nullptr);
+}
+
+void
+ClockFixture::advanceClocks(time::nanoseconds tick, time::nanoseconds total)
+{
+  BOOST_ASSERT(tick > time::nanoseconds::zero());
+  BOOST_ASSERT(total >= time::nanoseconds::zero());
+
+  while (total > time::nanoseconds::zero()) {
+    auto t = std::min(tick, total);
+    m_steadyClock->advance(t);
+    m_systemClock->advance(t);
+    total -= t;
+
+    afterTick();
+  }
+}
+
+} // namespace tests
+} // namespace ndn
diff --git a/tests/clock-fixture.hpp b/tests/clock-fixture.hpp
new file mode 100644
index 0000000..f05babe
--- /dev/null
+++ b/tests/clock-fixture.hpp
@@ -0,0 +1,89 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2020,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of ndn-tools (Named Data Networking Essential Tools).
+ * See AUTHORS.md for complete list of ndn-tools authors and contributors.
+ *
+ * ndn-tools 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.
+ *
+ * ndn-tools 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
+ * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NDN_TOOLS_TESTS_CLOCK_FIXTURE_HPP
+#define NDN_TOOLS_TESTS_CLOCK_FIXTURE_HPP
+
+#include <ndn-cxx/util/time-unit-test-clock.hpp>
+
+namespace ndn {
+namespace tests {
+
+/** \brief A test fixture that overrides steady clock and system clock.
+ */
+class ClockFixture
+{
+public:
+  virtual
+  ~ClockFixture();
+
+  /** \brief Advance steady and system clocks.
+   *
+   *  Clocks are advanced in increments of \p tick for \p nTicks ticks.
+   *  afterTick() is called after each tick.
+   *
+   *  Exceptions thrown during I/O events are propagated to the caller.
+   *  Clock advancement will stop in the event of an exception.
+   */
+  void
+  advanceClocks(time::nanoseconds tick, size_t nTicks = 1)
+  {
+    advanceClocks(tick, tick * nTicks);
+  }
+
+  /** \brief Advance steady and system clocks.
+   *
+   *  Clocks are advanced in increments of \p tick for \p total time.
+   *  The last increment might be shorter than \p tick.
+   *  afterTick() is called after each tick.
+   *
+   *  Exceptions thrown during I/O events are propagated to the caller.
+   *  Clock advancement will stop in the event of an exception.
+   */
+  void
+  advanceClocks(time::nanoseconds tick, time::nanoseconds total);
+
+protected:
+  ClockFixture();
+
+private:
+  /** \brief Called by advanceClocks() after each clock advancement (tick).
+   *
+   *  The base class implementation is a no-op.
+   */
+  virtual void
+  afterTick()
+  {
+  }
+
+protected:
+  shared_ptr<time::UnitTestSteadyClock> m_steadyClock;
+  shared_ptr<time::UnitTestSystemClock> m_systemClock;
+};
+
+} // namespace tests
+} // namespace ndn
+
+#endif // NDN_TOOLS_TESTS_CLOCK_FIXTURE_HPP
diff --git a/tests/dissect-wireshark/bug3603.pcap b/tests/dissect-wireshark/bug3603.pcap
old mode 100755
new mode 100644
Binary files differ
diff --git a/tests/dump/ndndump.t.cpp b/tests/dump/ndndump.t.cpp
index 44e2998..f266d92 100644
--- a/tests/dump/ndndump.t.cpp
+++ b/tests/dump/ndndump.t.cpp
@@ -20,7 +20,6 @@
 
 #include "tools/dump/ndndump.hpp"
 
-#include "tests/identity-management-fixture.hpp"
 #include "tests/test-common.hpp"
 
 #include <net/ethernet.h>
@@ -66,7 +65,7 @@
   std::streambuf* originalBuffer;
 };
 
-class NdnDumpFixture : public IdentityManagementFixture
+class NdnDumpFixture
 {
 protected:
   NdnDumpFixture()
diff --git a/tests/global-configuration.cpp b/tests/global-configuration.cpp
index d4ee782..f0c136a 100644
--- a/tests/global-configuration.cpp
+++ b/tests/global-configuration.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California.
+ * Copyright (c) 2014-2020,  Regents of the University of California.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -17,14 +17,15 @@
  * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "boost-test.hpp"
+#include "core/common.hpp"
+
+#include "tests/boost-test.hpp"
 
 #include <boost/filesystem.hpp>
 #include <fstream>
 #include <stdlib.h>
 
 namespace ndn {
-namespace tools {
 namespace tests {
 
 class GlobalConfiguration
@@ -36,19 +37,22 @@
     if (envHome)
       m_home = envHome;
 
-    boost::filesystem::path dir{TMP_TESTS_PATH};
-    dir /= "test-home";
-    ::setenv("HOME", dir.c_str(), 1);
+    auto testHome = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "test-home";
+    if (::setenv("HOME", testHome.c_str(), 1) != 0)
+      NDN_THROW(std::runtime_error("setenv() failed"));
 
-    boost::filesystem::create_directories(dir);
-    std::ofstream clientConf((dir / ".ndn" / "client.conf").c_str());
+    boost::filesystem::create_directories(testHome);
+
+    std::ofstream clientConf((testHome / ".ndn" / "client.conf").c_str());
     clientConf << "pib=pib-sqlite3" << std::endl
                << "tpm=tpm-file" << std::endl;
   }
 
-  ~GlobalConfiguration()
+  ~GlobalConfiguration() noexcept
   {
-    if (!m_home.empty())
+    if (m_home.empty())
+      ::unsetenv("HOME");
+    else
       ::setenv("HOME", m_home.data(), 1);
   }
 
@@ -65,5 +69,4 @@
 #endif
 
 } // namespace tests
-} // namespace tools
 } // namespace ndn
diff --git a/tests/identity-management-fixture.cpp b/tests/identity-management-fixture.cpp
deleted file mode 100644
index b4097d2..0000000
--- a/tests/identity-management-fixture.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2020,  Regents of the University of California.
- *
- * This file is part of ndn-tools (Named Data Networking Essential Tools).
- * See AUTHORS.md for complete list of ndn-tools authors and contributors.
- *
- * ndn-tools 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.
- *
- * ndn-tools 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
- * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "identity-management-fixture.hpp"
-
-#include <ndn-cxx/security/certificate.hpp>
-#include <ndn-cxx/security/pib/identity.hpp>
-#include <ndn-cxx/security/pib/key.hpp>
-#include <ndn-cxx/security/pib/pib.hpp>
-#include <ndn-cxx/util/io.hpp>
-
-#include <boost/filesystem.hpp>
-
-namespace ndn {
-namespace tests {
-
-IdentityManagementFixture::IdentityManagementFixture()
-  : m_keyChain("pib-memory:", "tpm-memory:")
-{
-}
-
-IdentityManagementFixture::~IdentityManagementFixture()
-{
-  boost::system::error_code ec;
-  for (const auto& certFile : m_certFiles) {
-    boost::filesystem::remove(certFile, ec);
-  }
-}
-
-bool
-IdentityManagementFixture::addIdentity(const Name& identity, const KeyParams& params)
-{
-  try {
-    m_keyChain.createIdentity(identity, params);
-    return true;
-  }
-  catch (const std::runtime_error&) {
-    return false;
-  }
-}
-
-bool
-IdentityManagementFixture::saveIdentityCertificate(const Name& identity, const std::string& filename, bool wantAdd)
-{
-  security::Certificate cert;
-  try {
-    cert = m_keyChain.getPib().getIdentity(identity).getDefaultKey().getDefaultCertificate();
-  }
-  catch (const security::Pib::Error&) {
-    if (wantAdd && this->addIdentity(identity)) {
-      return this->saveIdentityCertificate(identity, filename, false);
-    }
-    return false;
-  }
-
-  m_certFiles.push_back(filename);
-  try {
-    io::save(cert, filename);
-    return true;
-  }
-  catch (const io::Error&) {
-    return false;
-  }
-}
-
-} // namespace tests
-} // namespace ndn
diff --git a/tests/identity-management-fixture.hpp b/tests/identity-management-fixture.hpp
deleted file mode 100644
index a0fac2e..0000000
--- a/tests/identity-management-fixture.hpp
+++ /dev/null
@@ -1,72 +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-tools (Named Data Networking Essential Tools).
- * See AUTHORS.md for complete list of ndn-tools authors and contributors.
- *
- * ndn-tools 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.
- *
- * ndn-tools 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
- * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NDN_TOOLS_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
-#define NDN_TOOLS_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
-
-#include "tests/test-common.hpp"
-
-namespace ndn {
-namespace tests {
-
-/** \brief a fixture providing an in-memory KeyChain
- */
-class IdentityManagementFixture
-{
-public:
-  IdentityManagementFixture();
-
-  /** \brief deletes saved certificate files
-   */
-  ~IdentityManagementFixture();
-
-  /** \brief add identity
-   *  \return whether successful
-   */
-  bool
-  addIdentity(const Name& identity, const KeyParams& params = KeyChain::getDefaultKeyParams());
-
-  /** \brief save identity certificate to a file
-   *  \param identity identity name
-   *  \param filename file name, should be writable
-   *  \param wantAdd if true, add new identity when necessary
-   *  \return whether successful
-   */
-  bool
-  saveIdentityCertificate(const Name& identity, const std::string& filename, bool wantAdd = false);
-
-protected:
-  KeyChain m_keyChain;
-
-private:
-  std::vector<std::string> m_certFiles;
-};
-
-/** \brief convenience base class for inheriting from both UnitTestTimeFixture
- *         and IdentityManagementFixture
- */
-class IdentityManagementTimeFixture : public UnitTestTimeFixture
-                                    , public IdentityManagementFixture
-{
-};
-
-} // namespace tests
-} // namespace ndn
-
-#endif // NDN_TOOLS_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
diff --git a/tests/io-fixture.hpp b/tests/io-fixture.hpp
new file mode 100644
index 0000000..881065c
--- /dev/null
+++ b/tests/io-fixture.hpp
@@ -0,0 +1,59 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2020,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of ndn-tools (Named Data Networking Essential Tools).
+ * See AUTHORS.md for complete list of ndn-tools authors and contributors.
+ *
+ * ndn-tools 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.
+ *
+ * ndn-tools 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
+ * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NDN_TOOLS_TESTS_IO_FIXTURE_HPP
+#define NDN_TOOLS_TESTS_IO_FIXTURE_HPP
+
+#include "tests/clock-fixture.hpp"
+
+#include <boost/asio/io_service.hpp>
+
+namespace ndn {
+namespace tests {
+
+class IoFixture : public ClockFixture
+{
+private:
+  void
+  afterTick() final
+  {
+    if (m_io.stopped()) {
+#if BOOST_VERSION >= 106600
+      m_io.restart();
+#else
+      m_io.reset();
+#endif
+    }
+    m_io.poll();
+  }
+
+protected:
+  boost::asio::io_service m_io;
+};
+
+} // namespace tests
+} // namespace ndn
+
+#endif // NDN_TOOLS_TESTS_IO_FIXTURE_HPP
diff --git a/tests/key-chain-fixture.cpp b/tests/key-chain-fixture.cpp
new file mode 100644
index 0000000..b4911df
--- /dev/null
+++ b/tests/key-chain-fixture.cpp
@@ -0,0 +1,117 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2020,  Regents of the University of California.
+ *
+ * This file is part of ndn-tools (Named Data Networking Essential Tools).
+ * See AUTHORS.md for complete list of ndn-tools authors and contributors.
+ *
+ * ndn-tools 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.
+ *
+ * ndn-tools 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
+ * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "tests/key-chain-fixture.hpp"
+
+#include <ndn-cxx/util/io.hpp>
+
+#include <boost/filesystem.hpp>
+
+namespace ndn {
+namespace tests {
+
+using namespace ndn::security;
+
+KeyChainFixture::KeyChainFixture()
+  : m_keyChain("pib-memory:", "tpm-memory:")
+{
+}
+
+KeyChainFixture::~KeyChainFixture()
+{
+  boost::system::error_code ec;
+  for (const auto& certFile : m_certFiles) {
+    boost::filesystem::remove(certFile, ec); // ignore error
+  }
+}
+
+Certificate
+KeyChainFixture::makeCert(const Key& key, const std::string& issuer, const Key& signingKey)
+{
+  Certificate cert;
+  cert.setName(Name(key.getName())
+               .append(issuer)
+               .appendVersion());
+
+  // set metainfo
+  cert.setContentType(tlv::ContentType_Key);
+  cert.setFreshnessPeriod(1_h);
+
+  // set content
+  cert.setContent(key.getPublicKey().data(), key.getPublicKey().size());
+
+  // set signature info
+  ndn::SignatureInfo info;
+  auto now = time::system_clock::now();
+  info.setValidityPeriod(ValidityPeriod(now - 30_days, now + 30_days));
+
+  m_keyChain.sign(cert, signingByKey(signingKey ? signingKey : key).setSignatureInfo(info));
+  return cert;
+}
+
+bool
+KeyChainFixture::saveCert(const Data& cert, const std::string& filename)
+{
+  m_certFiles.push_back(filename);
+  try {
+    ndn::io::save(cert, filename);
+    return true;
+  }
+  catch (const ndn::io::Error&) {
+    return false;
+  }
+}
+
+bool
+KeyChainFixture::saveIdentityCert(const Identity& identity, const std::string& filename)
+{
+  Certificate cert;
+  try {
+    cert = identity.getDefaultKey().getDefaultCertificate();
+  }
+  catch (const Pib::Error&) {
+    return false;
+  }
+
+  return saveCert(cert, filename);
+}
+
+bool
+KeyChainFixture::saveIdentityCert(const Name& identityName, const std::string& filename,
+                                  bool allowCreate)
+{
+  Identity id;
+  try {
+    id = m_keyChain.getPib().getIdentity(identityName);
+  }
+  catch (const Pib::Error&) {
+    if (allowCreate) {
+      id = m_keyChain.createIdentity(identityName);
+    }
+  }
+
+  if (!id) {
+    return false;
+  }
+
+  return saveIdentityCert(id, filename);
+}
+
+} // namespace tests
+} // namespace ndn
diff --git a/tests/key-chain-fixture.hpp b/tests/key-chain-fixture.hpp
new file mode 100644
index 0000000..f86de19
--- /dev/null
+++ b/tests/key-chain-fixture.hpp
@@ -0,0 +1,93 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2020,  Regents of the University of California.
+ *
+ * This file is part of ndn-tools (Named Data Networking Essential Tools).
+ * See AUTHORS.md for complete list of ndn-tools authors and contributors.
+ *
+ * ndn-tools 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.
+ *
+ * ndn-tools 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
+ * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NDN_TOOLS_TESTS_KEY_CHAIN_FIXTURE_HPP
+#define NDN_TOOLS_TESTS_KEY_CHAIN_FIXTURE_HPP
+
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/security/signing-helpers.hpp>
+
+namespace ndn {
+namespace tests {
+
+/**
+ * @brief A fixture providing an in-memory KeyChain.
+ *
+ * Test cases can use this fixture to create identities. Identities, certificates, and
+ * saved certificates are automatically removed during test teardown.
+ */
+class KeyChainFixture
+{
+protected:
+  using Certificate = ndn::security::Certificate;
+  using Identity    = ndn::security::Identity;
+  using Key         = ndn::security::Key;
+
+public:
+  /**
+   * @brief Creates and returns a certificate for a given key
+   * @param key The key for which to make a certificate
+   * @param issuer The IssuerId to include in the certificate name
+   * @param signingKey The key with which to sign the certificate; if not provided, the
+   *                   certificate will be self-signed
+   */
+  Certificate
+  makeCert(const Key& key, const std::string& issuer, const Key& signingKey = Key());
+
+  /**
+   * @brief Saves an NDN certificate to a file
+   * @return true if successful, false otherwise
+   */
+  bool
+  saveCert(const Data& cert, const std::string& filename);
+
+  /**
+   * @brief Saves the default certificate of @p identity to a file
+   * @return true if successful, false otherwise
+   */
+  bool
+  saveIdentityCert(const Identity& identity, const std::string& filename);
+
+  /**
+   * @brief Saves the default certificate of the identity named @p identityName to a file
+   * @param identityName Name of the identity
+   * @param filename File name, must be writable
+   * @param allowCreate If true, create the identity if it does not exist
+   * @return true if successful, false otherwise
+   */
+  bool
+  saveIdentityCert(const Name& identityName, const std::string& filename,
+                   bool allowCreate = false);
+
+protected:
+  KeyChainFixture();
+
+  ~KeyChainFixture();
+
+protected:
+  ndn::KeyChain m_keyChain;
+
+private:
+  std::vector<std::string> m_certFiles;
+};
+
+} // namespace tests
+} // namespace ndn
+
+#endif // NDN_TOOLS_TESTS_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/peek/ndnpeek.t.cpp b/tests/peek/ndnpeek.t.cpp
index 0e0840a..9951e5c 100644
--- a/tests/peek/ndnpeek.t.cpp
+++ b/tests/peek/ndnpeek.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Arizona Board of Regents.
+ * Copyright (c) 2014-2020,  Arizona Board of Regents.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -20,6 +20,7 @@
 #include "tools/peek/ndnpeek/ndnpeek.hpp"
 
 #include "tests/test-common.hpp"
+#include "tests/io-fixture.hpp"
 
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
@@ -63,7 +64,7 @@
   return opt;
 }
 
-class NdnPeekFixture : public UnitTestTimeFixture
+class NdnPeekFixture : public IoFixture
 {
 protected:
   void
@@ -73,8 +74,7 @@
   }
 
 protected:
-  boost::asio::io_service io;
-  ndn::util::DummyClientFace face{io};
+  ndn::util::DummyClientFace face{m_io};
   output_test_stream output;
   unique_ptr<NdnPeek> peek;
 };
@@ -149,7 +149,7 @@
   {
     CoutRedirector redir(output);
     peek->start();
-    this->advanceClocks(io, 25_ms, 4);
+    this->advanceClocks(25_ms, 4);
     face.receive(*data);
   }
 
@@ -181,7 +181,7 @@
   {
     CoutRedirector redir(output);
     peek->start();
-    this->advanceClocks(io, 25_ms, 4);
+    this->advanceClocks(25_ms, 4);
     face.receive(*data);
   }
 
@@ -205,7 +205,7 @@
   {
     CoutRedirector redir(output);
     peek->start();
-    this->advanceClocks(io, 25_ms, 4);
+    this->advanceClocks(25_ms, 4);
     nack = makeNack(face.sentInterests.at(0), lp::NackReason::NO_ROUTE);
     face.receive(nack);
   }
@@ -224,7 +224,7 @@
   {
     CoutRedirector redir(output);
     peek->start();
-    this->advanceClocks(io, 25_ms, 4);
+    this->advanceClocks(25_ms, 4);
     nack = makeNack(face.sentInterests.at(0), lp::NackReason::NONE);
     face.receive(nack);
   }
@@ -241,7 +241,7 @@
   initialize(options);
 
   peek->start();
-  this->advanceClocks(io, 25_ms, 4);
+  this->advanceClocks(25_ms, 4);
 
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
   BOOST_CHECK_EQUAL(face.sentInterests.back().getCanBePrefix(), false);
@@ -262,12 +262,12 @@
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 0);
 
   peek->start();
-  this->advanceClocks(io, 100_ms, 9);
+  this->advanceClocks(100_ms, 9);
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
   BOOST_CHECK_EQUAL(face.getNPendingInterests(), 1);
   BOOST_CHECK(peek->getResult() == NdnPeek::Result::UNKNOWN);
 
-  this->advanceClocks(io, 100_ms, 2);
+  this->advanceClocks(100_ms, 2);
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
   BOOST_CHECK_EQUAL(face.getNPendingInterests(), 0);
   BOOST_CHECK(peek->getResult() == NdnPeek::Result::TIMEOUT);
@@ -283,7 +283,7 @@
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 0);
 
   peek->start();
-  this->advanceClocks(io, 25_ms, 6);
+  this->advanceClocks(25_ms, 6);
 
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
   BOOST_CHECK_EQUAL(face.getNPendingInterests(), 0);
@@ -300,7 +300,7 @@
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 0);
 
   peek->start();
-  this->advanceClocks(io, 25_ms, 4);
+  this->advanceClocks(25_ms, 4);
 
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 1);
   BOOST_CHECK_EQUAL(face.getNPendingInterests(), 0);
@@ -314,7 +314,7 @@
   initialize(options);
 
   peek->start();
-  BOOST_CHECK_THROW(this->advanceClocks(io, 1_ms, 10), Face::OversizedPacketError);
+  BOOST_CHECK_THROW(this->advanceClocks(1_ms, 10), Face::OversizedPacketError);
 
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 0);
 }
diff --git a/tests/peek/ndnpoke.t.cpp b/tests/peek/ndnpoke.t.cpp
index 09a562c..617b516 100644
--- a/tests/peek/ndnpoke.t.cpp
+++ b/tests/peek/ndnpoke.t.cpp
@@ -26,7 +26,8 @@
 #include "tools/peek/ndnpoke/ndnpoke.hpp"
 
 #include "tests/test-common.hpp"
-#include "tests/identity-management-fixture.hpp"
+#include "tests/io-fixture.hpp"
+#include "tests/key-chain-fixture.hpp"
 
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
@@ -37,7 +38,7 @@
 using namespace ndn::tests;
 
 template<bool WANT_PREFIX_REG_REPLY = true>
-class NdnPokeFixture : public IdentityManagementTimeFixture
+class NdnPokeFixture : public IoFixture, public KeyChainFixture
 {
 protected:
   NdnPokeFixture()
@@ -60,8 +61,7 @@
   }
 
 protected:
-  boost::asio::io_service io;
-  ndn::util::DummyClientFace face{io, m_keyChain, {true, WANT_PREFIX_REG_REPLY}};
+  ndn::util::DummyClientFace face{m_io, m_keyChain, {true, WANT_PREFIX_REG_REPLY}};
   std::stringstream payload{"Hello, world!\n"};
   unique_ptr<NdnPoke> poke;
 };
@@ -74,14 +74,14 @@
   initialize();
 
   poke->start();
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   // Check for prefix registration
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
   BOOST_CHECK_EQUAL(face.sentInterests.front().getName().getPrefix(4), "/localhost/nfd/rib/register");
 
   face.receive(*makeInterest("/poke/test"));
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   BOOST_CHECK(poke->getResult() == NdnPoke::Result::DATA_SENT);
   BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
@@ -102,16 +102,16 @@
   initialize();
 
   poke->start();
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   face.receive(*makeInterest("/poke/test/foo"));
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   BOOST_CHECK(poke->getResult() == NdnPoke::Result::UNKNOWN);
   BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 
   face.receive(*makeInterest("/poke/test"));
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   BOOST_CHECK(poke->getResult() == NdnPoke::Result::DATA_SENT);
   BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
@@ -125,10 +125,10 @@
   initialize(options);
 
   poke->start();
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   face.receive(*makeInterest("/poke/test"));
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   BOOST_CHECK(poke->getResult() == NdnPoke::Result::DATA_SENT);
   BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
@@ -146,10 +146,10 @@
   initialize(options);
 
   poke->start();
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   face.receive(*makeInterest(options.name));
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   BOOST_CHECK(poke->getResult() == NdnPoke::Result::DATA_SENT);
   BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
@@ -167,10 +167,10 @@
   initialize(options);
 
   poke->start();
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   face.receive(*makeInterest("/poke/test"));
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   BOOST_CHECK(poke->getResult() == NdnPoke::Result::DATA_SENT);
   BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
@@ -187,7 +187,7 @@
   initialize(options);
 
   poke->start();
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   BOOST_CHECK(poke->getResult() == NdnPoke::Result::DATA_SENT);
   BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
@@ -204,13 +204,13 @@
   initialize(options);
 
   poke->start();
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   // Check for prefix registration
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
   BOOST_CHECK_EQUAL(face.sentInterests.front().getName().getPrefix(4), "/localhost/nfd/rib/register");
 
-  this->advanceClocks(io, 1_s, 4);
+  this->advanceClocks(1_s, 4);
 
   BOOST_CHECK(poke->getResult() == NdnPoke::Result::TIMEOUT);
   BOOST_CHECK_EQUAL(face.sentData.size(), 0);
@@ -225,13 +225,13 @@
   initialize();
 
   poke->start();
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   // Check for prefix registration
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
   BOOST_CHECK_EQUAL(face.sentInterests.front().getName().getPrefix(4), "/localhost/nfd/rib/register");
 
-  this->advanceClocks(io, 1_s, 10);
+  this->advanceClocks(1_s, 10);
 
   BOOST_CHECK(poke->getResult() == NdnPoke::Result::PREFIX_REG_FAIL);
   BOOST_CHECK_EQUAL(face.sentData.size(), 0);
@@ -243,7 +243,7 @@
   initialize();
 
   poke->start();
-  this->advanceClocks(io, 1_ms, 10);
+  this->advanceClocks(1_ms, 10);
 
   face.receive(*makeInterest("/poke/test"));
   BOOST_CHECK_THROW(face.processEvents(), Face::OversizedPacketError);
diff --git a/tests/ping/client/ping.t.cpp b/tests/ping/client/ping.t.cpp
index 67d7ddc..cef62d6 100644
--- a/tests/ping/client/ping.t.cpp
+++ b/tests/ping/client/ping.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Arizona Board of Regents.
+ * Copyright (c) 2014-2020,  Arizona Board of Regents.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -20,6 +20,8 @@
 #include "tools/ping/client/ping.hpp"
 
 #include "tests/test-common.hpp"
+#include "tests/io-fixture.hpp"
+
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
 namespace ndn {
@@ -34,20 +36,18 @@
 
 using ping::client::Ping;
 
-BOOST_FIXTURE_TEST_CASE(Basic, UnitTestTimeFixture)
+BOOST_FIXTURE_TEST_CASE(Basic, IoFixture)
 {
+  util::DummyClientFace face(m_io, {true, true});
   Options pingOptions;
-  pingOptions.prefix = "ndn:/test-prefix";
+  pingOptions.prefix = "/test-prefix";
   pingOptions.shouldAllowStaleData = false;
   pingOptions.shouldGenerateRandomSeq = false;
   pingOptions.shouldPrintTimestamp = false;
   pingOptions.nPings = 4;
-  pingOptions.interval = time::milliseconds(100);
-  pingOptions.timeout = time::milliseconds(2000);
+  pingOptions.interval = 100_ms;
+  pingOptions.timeout = 2_s;
   pingOptions.startSeq = 1000;
-
-  boost::asio::io_service io;
-  util::DummyClientFace face(io, {true, true});
   Ping ping(face, pingOptions);
 
   int nFinishSignals = 0;
@@ -73,29 +73,24 @@
 
   ping.start();
 
-  this->advanceClocks(io, time::milliseconds(1), 500);
+  this->advanceClocks(1_ms, 500);
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 4);
 
   auto data = makeData("/test-prefix/ping/1000");
   data->setFreshnessPeriod(1_s);
   face.receive(*data);
 
-  lp::Nack nack(face.sentInterests[1]);
-  nack.setReason(lp::NackReason::DUPLICATE);
-  face.receive(nack);
+  face.receive(makeNack(face.sentInterests[1], lp::NackReason::DUPLICATE));
 
   data = makeData("/test-prefix/ping/1002");
   data->setFreshnessPeriod(1_s);
   face.receive(*data);
 
-  this->advanceClocks(io, time::milliseconds(100), 20);
+  this->advanceClocks(100_ms, 20);
 
-  // ndn:/test-prefix/ping/1003 is unanswered and will timeout
+  // /test-prefix/ping/1003 is unanswered and will timeout
 
   BOOST_CHECK_EQUAL(nFinishSignals, 1);
-
-  face.shutdown();
-  io.stop();
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestPing
diff --git a/tests/ping/integrated.t.cpp b/tests/ping/integrated.t.cpp
index 84c13e5..eafc52b 100644
--- a/tests/ping/integrated.t.cpp
+++ b/tests/ping/integrated.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2015-2018,  Arizona Board of Regents.
+ * Copyright (c) 2015-2020,  Arizona Board of Regents.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -17,10 +17,13 @@
  * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "tools/ping/server/ping-server.hpp"
 #include "tools/ping/client/ping.hpp"
+#include "tools/ping/server/ping-server.hpp"
 
-#include "tests/identity-management-fixture.hpp"
+#include "tests/test-common.hpp"
+#include "tests/io-fixture.hpp"
+#include "tests/key-chain-fixture.hpp"
+
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
 namespace ndn {
@@ -29,25 +32,25 @@
 
 using namespace ndn::tests;
 
-class PingIntegratedFixture : public IdentityManagementTimeFixture
+class PingIntegratedFixture : public IoFixture, public KeyChainFixture
 {
 public:
   PingIntegratedFixture()
-    : serverFace(io, m_keyChain, {false, true})
-    , clientFace(io, m_keyChain, {false, true})
+    : serverFace(m_io, m_keyChain, {false, true})
+    , clientFace(m_io, m_keyChain, {false, true})
     , wantLoss(false)
   {
     serverFace.onSendInterest.connect([this] (const Interest& interest) {
-      io.post([=] { if (!wantLoss) { clientFace.receive(interest); } });
+      m_io.post([=] { if (!wantLoss) { clientFace.receive(interest); } });
     });
     clientFace.onSendInterest.connect([this] (const Interest& interest) {
-      io.post([=] { if (!wantLoss) { serverFace.receive(interest); } });
+      m_io.post([=] { if (!wantLoss) { serverFace.receive(interest); } });
     });
     serverFace.onSendData.connect([this] (const Data& data) {
-      io.post([=] { if (!wantLoss) { clientFace.receive(data); } });
+      m_io.post([=] { if (!wantLoss) { clientFace.receive(data); } });
     });
     clientFace.onSendData.connect([this] (const Data& data) {
-      io.post([=] { if (!wantLoss) { serverFace.receive(data); } });
+      m_io.post([=] { if (!wantLoss) { serverFace.receive(data); } });
     });
   }
 
@@ -55,11 +58,10 @@
   {
     serverFace.shutdown();
     clientFace.shutdown();
-    io.stop();
+    m_io.stop();
   }
 
 public:
-  boost::asio::io_service io;
   util::DummyClientFace serverFace;
   util::DummyClientFace clientFace;
   std::unique_ptr<server::PingServer> server;
@@ -92,11 +94,11 @@
   clientOpts.timeout = 2_s;
   clientOpts.startSeq = 1000;
   client = make_unique<client::Ping>(clientFace, clientOpts);
-  client->afterFinish.connect(bind(&PingIntegratedFixture::onFinish, this));
+  client->afterFinish.connect([this] { onFinish(); });
   client->start();
 
-  advanceClocks(io, 1_ms, 400);
-  io.run();
+  advanceClocks(1_ms, 400);
+  m_io.run();
 
   BOOST_CHECK_EQUAL(4, server->getNPings());
 }
@@ -125,11 +127,11 @@
   clientOpts.timeout = 500_ms;
   clientOpts.startSeq = 1000;
   client = make_unique<client::Ping>(clientFace, clientOpts);
-  client->afterFinish.connect(bind(&PingIntegratedFixture::onFinish, this));
+  client->afterFinish.connect([this] { onFinish(); });
   client->start();
 
-  advanceClocks(io, 1_ms, 1000);
-  io.run();
+  advanceClocks(1_ms, 1000);
+  m_io.run();
 
   BOOST_CHECK_EQUAL(0, server->getNPings());
 }
diff --git a/tests/ping/server/ping-server.t.cpp b/tests/ping/server/ping-server.t.cpp
index 1fe5b35..f7ff66f 100644
--- a/tests/ping/server/ping-server.t.cpp
+++ b/tests/ping/server/ping-server.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Arizona Board of Regents.
+ * Copyright (c) 2014-2020,  Arizona Board of Regents.
  *
  * This file is part of ndn-tools (Named Data Networking Essential Tools).
  * See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -20,7 +20,8 @@
 #include "tools/ping/server/ping-server.hpp"
 
 #include "tests/test-common.hpp"
-#include "../../identity-management-fixture.hpp"
+#include "tests/io-fixture.hpp"
+#include "tests/key-chain-fixture.hpp"
 
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
@@ -34,11 +35,11 @@
 BOOST_AUTO_TEST_SUITE(Ping)
 BOOST_AUTO_TEST_SUITE(TestPingServer)
 
-class CreatePingServerFixture : public IdentityManagementTimeFixture
+class CreatePingServerFixture : public IoFixture, public KeyChainFixture
 {
 protected:
   CreatePingServerFixture()
-    : face(io, m_keyChain, {false, true})
+    : face(m_io, m_keyChain, {false, true})
     , pingOptions(makeOptions())
     , pingServer(face, m_keyChain, pingOptions)
   {
@@ -72,7 +73,6 @@
   }
 
 protected:
-  boost::asio::io_service io;
   util::DummyClientFace face;
   Options pingOptions;
   PingServer pingServer;
@@ -83,12 +83,12 @@
   BOOST_REQUIRE_EQUAL(0, pingServer.getNPings());
   pingServer.start();
 
-  advanceClocks(io, 1_ms, 200);
+  advanceClocks(1_ms, 200);
 
   face.receive(makePingInterest(1000));
   face.receive(makePingInterest(1001));
 
-  io.run();
+  m_io.run();
 
   BOOST_CHECK_EQUAL(2, pingServer.getNPings());
 }
diff --git a/tests/test-case.t.cpp.sample b/tests/test-case.t.cpp.sample
index 44223a6..8f6584b 100644
--- a/tests/test-case.t.cpp.sample
+++ b/tests/test-case.t.cpp.sample
@@ -23,6 +23,8 @@
 //#include "unit-under-test.hpp"
 
 #include "tests/test-common.hpp"
+#include "tests/io-fixture.hpp"           // optional, for IoFixture
+//#include "tests/key-chain-fixture.hpp"  // optional, for KeyChainFixture
 
 namespace ndn {
 namespace tool_name {
@@ -46,12 +48,11 @@
   BOOST_CHECK_EQUAL(i, 1);
 }
 
-// Use UnitTestTimeFixture to mock clocks.
-BOOST_FIXTURE_TEST_CASE(Test2, UnitTestTimeFixture)
+// Use ClockFixture or IoFixture to mock clocks.
+BOOST_FIXTURE_TEST_CASE(Test2, IoFixture)
 {
   // advanceClocks() increments mock clocks.
-  boost::asio::io_service io;
-  this->advanceClocks(io, time::milliseconds(500));
+  advanceClocks(500_ms);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
index e1b2431..98fa188 100644
--- a/tests/test-common.cpp
+++ b/tests/test-common.cpp
@@ -23,64 +23,20 @@
  * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "test-common.hpp"
-
-#include <ndn-cxx/security/signature-sha256-with-rsa.hpp>
+#include "tests/test-common.hpp"
 
 namespace ndn {
 namespace tests {
 
-UnitTestTimeFixture::UnitTestTimeFixture()
-  : steadyClock(make_shared<time::UnitTestSteadyClock>())
-  , systemClock(make_shared<time::UnitTestSystemClock>())
-{
-  time::setCustomClocks(steadyClock, systemClock);
-}
-
-UnitTestTimeFixture::~UnitTestTimeFixture()
-{
-  time::setCustomClocks(nullptr, nullptr);
-}
-
-void
-UnitTestTimeFixture::advanceClocks(boost::asio::io_service& io,
-                                   time::nanoseconds tick, size_t nTicks)
-{
-  this->advanceClocks(io, tick, tick * nTicks);
-}
-
-void
-UnitTestTimeFixture::advanceClocks(boost::asio::io_service& io,
-                                   time::nanoseconds tick, time::nanoseconds total)
-{
-  BOOST_ASSERT(tick > time::nanoseconds::zero());
-  BOOST_ASSERT(total >= time::nanoseconds::zero());
-
-  time::nanoseconds remaining = total;
-  while (remaining > time::nanoseconds::zero()) {
-    if (remaining >= tick) {
-      steadyClock->advance(tick);
-      systemClock->advance(tick);
-      remaining -= tick;
-    }
-    else {
-      steadyClock->advance(remaining);
-      systemClock->advance(remaining);
-      remaining = time::nanoseconds::zero();
-    }
-
-    if (io.stopped())
-      io.reset();
-    io.poll();
-  }
-}
-
 shared_ptr<Interest>
-makeInterest(const Name& name, bool canBePrefix, time::milliseconds lifetime,
+makeInterest(const Name& name, bool canBePrefix, optional<time::milliseconds> lifetime,
              optional<Interest::Nonce> nonce)
 {
-  auto interest = make_shared<Interest>(name, lifetime);
+  auto interest = std::make_shared<Interest>(name);
   interest->setCanBePrefix(canBePrefix);
+  if (lifetime) {
+    interest->setInterestLifetime(*lifetime);
+  }
   interest->setNonce(nonce);
   return interest;
 }
@@ -88,16 +44,15 @@
 shared_ptr<Data>
 makeData(const Name& name)
 {
-  auto data = make_shared<Data>(name);
+  auto data = std::make_shared<Data>(name);
   return signData(data);
 }
 
 Data&
 signData(Data& data)
 {
-  ndn::SignatureSha256WithRsa fakeSignature;
-  fakeSignature.setValue(ndn::encoding::makeEmptyBlock(tlv::SignatureValue));
-  data.setSignature(fakeSignature);
+  data.setSignatureInfo(SignatureInfo(tlv::NullSignature));
+  data.setSignatureValue(std::make_shared<Buffer>());
   data.wireEncode();
   return data;
 }
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 7cf5671..5fa2a8d 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -26,73 +26,36 @@
 #ifndef NDN_TOOLS_TESTS_TEST_COMMON_HPP
 #define NDN_TOOLS_TESTS_TEST_COMMON_HPP
 
-#include "boost-test.hpp"
 #include "core/common.hpp"
-
-#include <ndn-cxx/util/time-unit-test-clock.hpp>
+#include "tests/boost-test.hpp"
 
 namespace ndn {
 namespace tests {
 
-/** \brief a test fixture that overrides steady clock and system clock
- */
-class UnitTestTimeFixture
-{
-protected:
-  UnitTestTimeFixture();
-
-  ~UnitTestTimeFixture();
-
-  /** \brief advance steady and system clocks
-   *
-   *  Clocks are advanced in increments of \p tick for \p nTicks ticks.
-   *  After each tick, the supplied io_service is polled to process pending I/O events.
-   *
-   *  Exceptions thrown during I/O events are propagated to the caller.
-   *  Clock advancing would stop in case of an exception.
-   */
-  void
-  advanceClocks(boost::asio::io_service& io,
-                time::nanoseconds tick, size_t nTicks = 1);
-
-  /** \brief advance steady and system clocks
-   *
-   *  Clocks are advanced in increments of \p tick for \p total time.
-   *  The last increment might be shorter than \p tick.
-   *  After each tick, the supplied io_service is polled to process pending I/O events.
-   *
-   *  Exceptions thrown during I/O events are propagated to the caller.
-   *  Clock advancing would stop in case of an exception.
-   */
-  void
-  advanceClocks(boost::asio::io_service& io,
-                time::nanoseconds tick, time::nanoseconds total);
-
-protected:
-  shared_ptr<time::UnitTestSteadyClock> steadyClock;
-  shared_ptr<time::UnitTestSystemClock> systemClock;
-};
-
-/** \brief create an Interest
+/**
+ * \brief Create an Interest
  */
 shared_ptr<Interest>
 makeInterest(const Name& name, bool canBePrefix = false,
-             time::milliseconds lifetime = DEFAULT_INTEREST_LIFETIME,
+             optional<time::milliseconds> lifetime = nullopt,
              optional<Interest::Nonce> nonce = nullopt);
 
-/** \brief create a Data with fake signature
- *  \note Data may be modified afterwards without losing the fake signature.
- *        If a real signature is desired, sign again with KeyChain.
+/**
+ * \brief Create a Data with a null (i.e., empty) signature
+ *
+ * If a "real" signature is desired, use KeyChainFixture and sign again with `m_keyChain`.
  */
 shared_ptr<Data>
 makeData(const Name& name);
 
-/** \brief add a fake signature to Data
+/**
+ * \brief Add a null signature to \p data
  */
 Data&
 signData(Data& data);
 
-/** \brief add a fake signature to Data
+/**
+ * \brief Add a null signature to \p data
  */
 inline shared_ptr<Data>
 signData(shared_ptr<Data> data)
@@ -101,11 +64,27 @@
   return data;
 }
 
-/** \brief create a Nack
+/**
+ * \brief Create a Nack
  */
 lp::Nack
 makeNack(Interest interest, lp::NackReason reason);
 
+/**
+ * \brief Replace a name component in a packet
+ * \param[inout] pkt the packet
+ * \param index the index of the name component to replace
+ * \param args arguments to name::Component constructor
+ */
+template<typename Packet, typename ...Args>
+void
+setNameComponent(Packet& pkt, ssize_t index, Args&& ...args)
+{
+  Name name = pkt.getName();
+  name.set(index, name::Component(std::forward<Args>(args)...));
+  pkt.setName(name);
+}
+
 } // namespace tests
 } // namespace ndn
 
diff --git a/tests/wscript b/tests/wscript
index 32c89f4..19bb8e7 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -5,11 +5,11 @@
     if not bld.env.WITH_TESTS:
         return
 
-    tmp_path = 'TMP_TESTS_PATH="%s"' % bld.bldnode.make_node('tmp-files')
+    tmpdir = 'UNIT_TESTS_TMPDIR="%s"' % bld.bldnode.make_node('tmp-files')
     bld.program(
         target='../unit-tests',
         name='unit-tests',
         source=bld.path.ant_glob(['*.cpp'] + ['%s/**/*.cpp' % tool for tool in bld.env.BUILD_TOOLS]),
         use=['core-objects'] + ['%s-objects' % tool for tool in bld.env.BUILD_TOOLS],
-        defines=[tmp_path],
+        defines=[tmpdir],
         install_path=None)
