diff --git a/tests/daemon/face/tcp-transport.t.cpp b/tests/daemon/face/tcp-transport.t.cpp
index ef23ca6..96cba88 100644
--- a/tests/daemon/face/tcp-transport.t.cpp
+++ b/tests/daemon/face/tcp-transport.t.cpp
@@ -80,7 +80,7 @@
       limitedIo.afterOp();
     });
   remoteSocket.close();
-  BOOST_REQUIRE_EQUAL(limitedIo.run(1, time::seconds(1)), LimitedIo::EXCEED_OPS);
+  BOOST_REQUIRE_EQUAL(limitedIo.run(1, 1_s), LimitedIo::EXCEED_OPS);
 
   bool didStateChange = false;
   transport->afterStateChange.connectSingleShot(
@@ -104,7 +104,7 @@
       this->limitedIo.afterOp();
     });
   this->remoteSocket.close();
-  BOOST_REQUIRE_EQUAL(this->limitedIo.run(1, time::seconds(1)), LimitedIo::EXCEED_OPS);
+  BOOST_REQUIRE_EQUAL(this->limitedIo.run(1, 1_s), LimitedIo::EXCEED_OPS);
 
   this->transport->afterStateChange.connectSingleShot(
     [this] (TransportState oldState, TransportState newState) {
@@ -112,7 +112,7 @@
       BOOST_CHECK_EQUAL(newState, TransportState::UP);
       this->limitedIo.afterOp();
     });
-  BOOST_REQUIRE_EQUAL(this->limitedIo.run(1, time::seconds(1)), LimitedIo::EXCEED_OPS);
+  BOOST_REQUIRE_EQUAL(this->limitedIo.run(1, 1_s), LimitedIo::EXCEED_OPS);
 }
 
 class PermanentTcpTransportReconnectObserver : public TcpTransport
@@ -174,7 +174,7 @@
     BOOST_REQUIRE_EQUAL(error, boost::system::errc::success);
     this->limitedIo.afterOp();
   });
-  BOOST_REQUIRE_EQUAL(this->limitedIo.run(2, time::seconds(1)), LimitedIo::EXCEED_OPS);
+  BOOST_REQUIRE_EQUAL(this->limitedIo.run(2, 1_s), LimitedIo::EXCEED_OPS);
 
   auto transportObserver =
     make_unique<PermanentTcpTransportReconnectObserver>(std::move(sock), std::ref(this->limitedIo));
@@ -188,23 +188,23 @@
   auto retryTime1 = time::steady_clock::now();
 
   auto expectedWait1 = TcpTransport::s_initialReconnectWait;
-  BOOST_REQUIRE_EQUAL(this->limitedIo.run(2, expectedWait1 + time::seconds(1)), // add some slack
+  BOOST_REQUIRE_EQUAL(this->limitedIo.run(2, expectedWait1 + 1_s), // add some slack
                       LimitedIo::EXCEED_OPS);
   auto retryTime2 = time::steady_clock::now();
   BOOST_CHECK_EQUAL(transportObserver->getState(), TransportState::DOWN);
 
   auto expectedWait2 = time::duration_cast<time::nanoseconds>(expectedWait1 *
                                                               TcpTransport::s_reconnectWaitMultiplier);
-  BOOST_REQUIRE_EQUAL(this->limitedIo.run(2, expectedWait2 + time::seconds(1)), // add some slack
+  BOOST_REQUIRE_EQUAL(this->limitedIo.run(2, expectedWait2 + 1_s), // add some slack
                       LimitedIo::EXCEED_OPS);
   auto retryTime3 = time::steady_clock::now();
   BOOST_CHECK_EQUAL(transportObserver->getState(), TransportState::DOWN);
 
   // check that the backoff algorithm works
   BOOST_CHECK_CLOSE(asFloatMilliseconds(retryTime2 - retryTime1),
-                    asFloatMilliseconds(expectedWait1), 10.0);
+                    asFloatMilliseconds(expectedWait1), 20.0); // 200ms tolerance
   BOOST_CHECK_CLOSE(asFloatMilliseconds(retryTime3 - retryTime2),
-                    asFloatMilliseconds(expectedWait2), 10.0);
+                    asFloatMilliseconds(expectedWait2), 10.0); // 200ms tolerance
 
   // reestablish the TCP connection
   this->startAccept(remoteEp);
@@ -212,7 +212,7 @@
   auto expectedWait3 = time::duration_cast<time::nanoseconds>(expectedWait2 *
                                                               TcpTransport::s_reconnectWaitMultiplier);
   BOOST_REQUIRE_EQUAL(this->limitedIo.run(3, // reconnect, handleReconnect, async_accept
-                                          expectedWait3 + time::seconds(1)), LimitedIo::EXCEED_OPS);
+                                          expectedWait3 + 1_s), LimitedIo::EXCEED_OPS);
   BOOST_CHECK_EQUAL(transportObserver->getState(), TransportState::UP);
 
   // break the TCP connection again
@@ -221,14 +221,14 @@
 
   // measure retry intervals
   auto retryTime4 = time::steady_clock::now();
-  BOOST_REQUIRE_EQUAL(this->limitedIo.run(2, expectedWait1 + time::seconds(1)), // add some slack
+  BOOST_REQUIRE_EQUAL(this->limitedIo.run(2, expectedWait1 + 1_s), // add some slack
                       LimitedIo::EXCEED_OPS);
   auto retryTime5 = time::steady_clock::now();
   BOOST_CHECK_EQUAL(transportObserver->getState(), TransportState::DOWN);
 
   // check that the timeout restarts from the initial value after a successful reconnection
   BOOST_CHECK_CLOSE(asFloatMilliseconds(retryTime5 - retryTime4),
-                    asFloatMilliseconds(expectedWait1), 10.0);
+                    asFloatMilliseconds(expectedWait1), 20.0); // 200ms tolerance
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestTcpTransport
diff --git a/tests/daemon/face/websocket-channel.t.cpp b/tests/daemon/face/websocket-channel.t.cpp
index 439422f..5c4f433 100644
--- a/tests/daemon/face/websocket-channel.t.cpp
+++ b/tests/daemon/face/websocket-channel.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -49,8 +49,8 @@
 
   void
   listen(const ip::address& addr,
-         const time::milliseconds& pingInterval = time::seconds(10),
-         const time::milliseconds& pongTimeout = time::seconds(1))
+         const time::milliseconds& pingInterval = 10_s,
+         const time::milliseconds& pongTimeout = 1_s)
   {
     listenerEp = websocket::Endpoint(addr, 20030);
     listenerChannel = makeChannel(addr, 20030);
@@ -80,13 +80,13 @@
 
   void
   initialize(const ip::address& addr,
-             const time::milliseconds& pingInterval = time::seconds(10),
-             const time::milliseconds& pongTimeout = time::seconds(1))
+             const time::milliseconds& pingInterval = 10_s,
+             const time::milliseconds& pongTimeout = 1_s)
   {
     listen(addr, pingInterval, pongTimeout);
     clientConnect(client);
     BOOST_REQUIRE_EQUAL(limitedIo.run(2, // listenerOnFaceCreated, clientHandleOpen
-                        time::seconds(1)), LimitedIo::EXCEED_OPS);
+                                      1_s), LimitedIo::EXCEED_OPS);
     BOOST_REQUIRE_EQUAL(listenerChannel->size(), 1);
   }
 
@@ -150,8 +150,9 @@
   std::vector<std::string> clientReceivedMessages;
 
   time::steady_clock::Duration measuredPingInterval;
-  bool clientShouldPong = true; // set clientShouldPong false to disable the pong response,
-                                // which will cause timeout in listenerChannel
+  // set clientShouldPong to false to disable the pong response,
+  // which will eventually cause a timeout in listenerChannel
+  bool clientShouldPong = true;
 
 private:
   time::steady_clock::TimePoint m_prevPingRecvTime;
@@ -193,7 +194,7 @@
   this->clientConnect(client1);
 
   BOOST_CHECK_EQUAL(limitedIo.run(2, // listenerOnFaceCreated, clientHandleOpen
-                    time::seconds(1)), LimitedIo::EXCEED_OPS);
+                                  1_s), LimitedIo::EXCEED_OPS);
   BOOST_CHECK_EQUAL(listenerChannel->size(), 1);
 
   websocket::Client client2;
@@ -202,7 +203,7 @@
   this->clientConnect(client3);
 
   BOOST_CHECK_EQUAL(limitedIo.run(4, // 2 listenerOnFaceCreated, 2 clientHandleOpen
-                    time::seconds(2)), LimitedIo::EXCEED_OPS);
+                                  2_s), LimitedIo::EXCEED_OPS);
   BOOST_CHECK_EQUAL(listenerChannel->size(), 3);
 
   // check face persistency
@@ -219,14 +220,14 @@
   auto transport = listenerFaces.front()->getTransport();
 
   Block pkt1 = ndn::encoding::makeStringBlock(300, "hello");
-  transport->send(face::Transport::Packet(Block(pkt1)));
+  transport->send(Transport::Packet(Block(pkt1)));
   BOOST_CHECK_EQUAL(limitedIo.run(1, // clientHandleMessage
-                    time::seconds(1)), LimitedIo::EXCEED_OPS);
+                                  1_s), LimitedIo::EXCEED_OPS);
 
   Block pkt2 = ndn::encoding::makeStringBlock(301, "world!");
-  transport->send(face::Transport::Packet(Block(pkt2)));
+  transport->send(Transport::Packet(Block(pkt2)));
   BOOST_CHECK_EQUAL(limitedIo.run(1, // clientHandleMessage
-                    time::seconds(1)), LimitedIo::EXCEED_OPS);
+                                  1_s), LimitedIo::EXCEED_OPS);
 
   BOOST_REQUIRE_EQUAL(clientReceivedMessages.size(), 2);
   BOOST_CHECK_EQUAL_COLLECTIONS(
@@ -252,11 +253,11 @@
 
   clientSendInterest(*interest1);
   BOOST_CHECK_EQUAL(limitedIo.run(1, // faceAfterReceiveInterest
-                    time::seconds(1)), LimitedIo::EXCEED_OPS);
+                                  1_s), LimitedIo::EXCEED_OPS);
 
   clientSendInterest(*interest2);
   BOOST_CHECK_EQUAL(limitedIo.run(1, // faceAfterReceiveInterest
-                    time::seconds(1)), LimitedIo::EXCEED_OPS);
+                                  1_s), LimitedIo::EXCEED_OPS);
 
   BOOST_REQUIRE_EQUAL(faceReceivedInterests.size(), 2);
   BOOST_CHECK_EQUAL(faceReceivedInterests[0].getName(), interest1->getName());
@@ -281,19 +282,19 @@
 
   client.close(clientHandle, websocketpp::close::status::going_away, "");
   BOOST_CHECK_EQUAL(limitedIo.run(1, // faceClosedSignal
-                    time::seconds(1)), LimitedIo::EXCEED_OPS);
+                                  1_s), LimitedIo::EXCEED_OPS);
   BOOST_CHECK_EQUAL(listenerChannel->size(), 0);
 }
 
 BOOST_AUTO_TEST_CASE(SetPingInterval)
 {
-  const time::milliseconds pingInterval(800);
   auto address = getTestIp(AddressFamily::V4, AddressScope::Loopback);
   SKIP_IF_IP_UNAVAILABLE(address);
-  this->initialize(address, pingInterval, time::milliseconds(1000));
+  const auto pingInterval = 1200_ms;
+  this->initialize(address, pingInterval);
 
   BOOST_CHECK_EQUAL(limitedIo.run(2, // clientHandlePing
-                    pingInterval * 3), LimitedIo::EXCEED_OPS);
+                                  pingInterval * 3), LimitedIo::EXCEED_OPS);
   BOOST_CHECK_LE(measuredPingInterval, pingInterval * 1.1);
   BOOST_CHECK_GE(measuredPingInterval, pingInterval * 0.9);
 }
@@ -302,17 +303,18 @@
 {
   auto address = getTestIp(AddressFamily::V4, AddressScope::Loopback);
   SKIP_IF_IP_UNAVAILABLE(address);
-  this->initialize(address, time::milliseconds(500), time::milliseconds(300));
+  this->initialize(address, 600_ms, 300_ms);
   clientShouldPong = false;
 
   BOOST_CHECK_EQUAL(limitedIo.run(2, // clientHandlePing, faceClosedSignal
-                    time::seconds(2)), LimitedIo::EXCEED_OPS);
+                                  2_s), LimitedIo::EXCEED_OPS);
   BOOST_CHECK_EQUAL(listenerChannel->size(), 0);
 
-  auto transport = static_cast<face::WebSocketTransport*>(listenerFaces.front()->getTransport());
-  BOOST_CHECK(transport->getState() == face::TransportState::FAILED ||
-              transport->getState() == face::TransportState::CLOSED);
-  BOOST_CHECK_EQUAL(transport->getCounters().nOutPings, 1);
+  auto transport = static_cast<WebSocketTransport*>(listenerFaces.front()->getTransport());
+  BOOST_CHECK(transport->getState() == TransportState::FAILED ||
+              transport->getState() == TransportState::CLOSED);
+  BOOST_CHECK_GE(transport->getCounters().nOutPings, 1);
+  BOOST_CHECK_LE(transport->getCounters().nOutPings, 2);
   BOOST_CHECK_EQUAL(transport->getCounters().nInPongs, 0);
 }
 
diff --git a/tests/tools/ndn-autoconfig-server/program.t.cpp b/tests/tools/ndn-autoconfig-server/program.t.cpp
index afcf908..7a4a216 100644
--- a/tests/tools/ndn-autoconfig-server/program.t.cpp
+++ b/tests/tools/ndn-autoconfig-server/program.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,6 +26,7 @@
 #include "ndn-autoconfig-server/program.hpp"
 
 #include "tests/identity-management-fixture.hpp"
+
 #include <ndn-cxx/encoding/buffer.hpp>
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
@@ -48,11 +49,11 @@
   initialize(const Options& options)
   {
     program = make_unique<Program>(options, face, m_keyChain);
-    face.processEvents(time::milliseconds(1));
+    face.processEvents(500_ms);
     face.sentInterests.clear();
   }
 
-public:
+protected:
   util::DummyClientFace face;
   unique_ptr<Program> program;
 };
@@ -68,10 +69,10 @@
 
   Interest interest("/localhop/ndn-autoconf/hub");
   face.receive(interest);
-  face.processEvents(time::milliseconds(1));
+  face.processEvents(500_ms);
 
-  BOOST_CHECK_EQUAL(face.sentData.size(), 1);
-  const Name& dataName = face.sentData.at(0).getName();
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+  const Name& dataName = face.sentData[0].getName();
   BOOST_CHECK_EQUAL(dataName.size(), interest.getName().size() + 1);
   BOOST_CHECK(interest.getName().isPrefixOf(dataName));
   BOOST_CHECK(dataName.at(-1).isVersion());
@@ -79,7 +80,7 @@
   // interest2 asks for a different version, and should not be responded
   Interest interest2(Name(interest.getName()).appendVersion(dataName.at(-1).toVersion() - 1));
   face.receive(interest2);
-  face.processEvents(time::milliseconds(1));
+  face.processEvents(500_ms);
   BOOST_CHECK_EQUAL(face.sentData.size(), 1);
 }
 
@@ -87,18 +88,18 @@
 {
   Options options;
   options.hubFaceUri = FaceUri("udp4://192.0.2.1:6363");
-  const int nRoutablePrefixes = 2000;
-  for (int i = 0; i < nRoutablePrefixes; ++i) {
+  const size_t nRoutablePrefixes = 2000;
+  for (size_t i = 0; i < nRoutablePrefixes; ++i) {
     options.routablePrefixes.push_back(Name("/PREFIX").appendNumber(i));
   }
   this->initialize(options);
 
   Interest interest("/localhop/nfd/rib/routable-prefixes");
   face.receive(interest);
-  face.processEvents(time::milliseconds(1));
+  face.processEvents(500_ms);
 
-  BOOST_CHECK_EQUAL(face.sentData.size(), 1);
-  const Name& dataName0 = face.sentData.at(0).getName();
+  BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+  const Name& dataName0 = face.sentData[0].getName();
   BOOST_CHECK_EQUAL(dataName0.size(), interest.getName().size() + 2);
   BOOST_CHECK(interest.getName().isPrefixOf(dataName0));
   BOOST_CHECK(dataName0.at(-2).isVersion());
@@ -108,7 +109,7 @@
     const Name& lastName = face.sentData.back().getName();
     Interest interest2(lastName.getPrefix(-1).appendSegment(lastName.at(-1).toSegment() + 1));
     face.receive(interest2);
-    face.processEvents(time::milliseconds(1));
+    face.processEvents(500_ms);
   }
 
   auto buffer = make_shared<Buffer>();
@@ -119,9 +120,9 @@
 
   Block payload(tlv::Content, buffer);
   payload.parse();
-  BOOST_CHECK_EQUAL(payload.elements_size(), nRoutablePrefixes);
-  for (int i = 0; i < nRoutablePrefixes; ++i) {
-    BOOST_CHECK_EQUAL(Name(payload.elements().at(i)), options.routablePrefixes.at(i));
+  BOOST_REQUIRE_EQUAL(payload.elements_size(), nRoutablePrefixes);
+  for (size_t i = 0; i < nRoutablePrefixes; ++i) {
+    BOOST_CHECK_EQUAL(Name(payload.elements()[i]), options.routablePrefixes[i]);
   }
 }
 
@@ -133,7 +134,7 @@
 
   Interest interest("/localhop/nfd/rib/routable-prefixes");
   face.receive(interest);
-  face.processEvents(time::milliseconds(1));
+  face.processEvents(500_ms);
   BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 }
 
