diff --git a/tests/boost-multi-log-formatter.hpp b/tests/boost-multi-log-formatter.hpp
deleted file mode 100644
index ae37416..0000000
--- a/tests/boost-multi-log-formatter.hpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2015 Regents of the University of California.
- *
- * Based on work by Martin Ba (http://stackoverflow.com/a/26718189)
- *
- * This file is distributed under the Boost Software License, Version 1.0.
- * (See http://www.boost.org/LICENSE_1_0.txt)
- */
-
-#ifndef NDN_TESTS_BOOST_MULTI_LOG_FORMATTER_HPP
-#define NDN_TESTS_BOOST_MULTI_LOG_FORMATTER_HPP
-
-#include <boost/version.hpp>
-
-#if BOOST_VERSION >= 105900
-#include <boost/test/unit_test_parameters.hpp>
-#else
-#include <boost/test/detail/unit_test_parameters.hpp>
-#endif // BOOST_VERSION >= 105900
-
-#include <boost/test/unit_test_log_formatter.hpp>
-#include <boost/test/output/compiler_log_formatter.hpp>
-#include <boost/test/output/xml_log_formatter.hpp>
-
-namespace boost {
-namespace unit_test {
-namespace output {
-
-/**
- * @brief Log formatter for Boost.Test that outputs the logging to multiple formatters
- *
- * The log formatter is designed to output to one or multiple formatters at the same time.  For
- * example, one HRF formatter can output to the standard output, while XML formatter output to
- * the file.
- *
- * Usage:
- *
- *     // Call in init_unit_test_suite: (this will override the --log_format parameter)
- *     auto formatter = new boost::unit_test::output::multi_log_formatter; // same as already configured logger
- *
- *     // Prepare and add additional logger(s)
- *     formatter.add(std::make_shared<boost::unit_test::output::xml_log_formatter>(),
- *                   std::make_shared<std::ofstream>("out.xml"));
- *
- *      boost::unit_test::unit_test_log.set_formatter(formatter);
- *
- * @note Calling `boost::unit_test::unit_test_log.set_stream(...)` will change the stream for
- *       the original logger.
- */
-class multi_log_formatter : public unit_test_log_formatter
-{
-public:
-  /**
-   * @brief Create instance of the logger, based on the configured logger instance
-   */
-  multi_log_formatter()
-  {
-    auto format =
-#if BOOST_VERSION > 105900
-      runtime_config::get<output_format>(runtime_config::LOG_FORMAT);
-#else
-      runtime_config::log_format();
-#endif // BOOST_VERSION > 105900
-
-    switch (format) {
-      default:
-#if BOOST_VERSION >= 105900
-      case OF_CLF:
-#else
-      case CLF:
-#endif // BOOST_VERSION >= 105900
-        m_loggers.push_back({std::make_shared<compiler_log_formatter>(), nullptr});
-        break;
-#if BOOST_VERSION >= 105900
-      case OF_XML:
-#else
-      case XML:
-#endif // BOOST_VERSION >= 105900
-        m_loggers.push_back({std::make_shared<xml_log_formatter>(), nullptr});
-        break;
-    }
-  }
-
-  void
-  add(std::shared_ptr<unit_test_log_formatter> formatter, std::shared_ptr<std::ostream> os)
-  {
-    m_loggers.push_back({formatter, os});
-  }
-
-  // Formatter interface
-  void
-  log_start(std::ostream& os, counter_t test_cases_amount)
-  {
-    for (auto& l : m_loggers)
-      l.logger->log_start(l.os == nullptr ? os : *l.os, test_cases_amount);
-  }
-
-  void
-  log_finish(std::ostream& os)
-  {
-    for (auto& l : m_loggers)
-      l.logger->log_finish(l.os == nullptr ? os : *l.os);
-  }
-
-  void
-  log_build_info(std::ostream& os)
-  {
-    for (auto& l : m_loggers)
-      l.logger->log_build_info(l.os == nullptr ? os : *l.os);
-  }
-
-  void
-  test_unit_start(std::ostream& os, const test_unit& tu)
-  {
-    for (auto& l : m_loggers)
-      l.logger->test_unit_start(l.os == nullptr ? os : *l.os, tu);
-  }
-
-  void
-  test_unit_finish(std::ostream& os, const test_unit& tu, unsigned long elapsed)
-  {
-    for (auto& l : m_loggers)
-      l.logger->test_unit_finish(l.os == nullptr ? os : *l.os, tu, elapsed);
-  }
-
-  void
-  test_unit_skipped(std::ostream& os, const test_unit& tu)
-  {
-    for (auto& l : m_loggers)
-      l.logger->test_unit_skipped(l.os == nullptr ? os : *l.os, tu);
-  }
-
-#if BOOST_VERSION >= 105900
-  void
-  log_exception_start(std::ostream& os, const log_checkpoint_data& lcd, const execution_exception& ex)
-  {
-    for (auto& l : m_loggers)
-      l.logger->log_exception_start(l.os == nullptr ? os : *l.os, lcd, ex);
-  }
-
-  void
-  log_exception_finish(std::ostream& os)
-  {
-    for (auto& l : m_loggers)
-      l.logger->log_exception_finish(l.os == nullptr ? os : *l.os);
-  }
-#else
-  void
-  log_exception(std::ostream& os, const log_checkpoint_data& lcd, const execution_exception& ex)
-  {
-    for (auto& l : m_loggers)
-      l.logger->log_exception(l.os == nullptr ? os : *l.os, lcd, ex);
-  }
-#endif // BOOST_VERSION >= 105900
-
-  void
-  log_entry_start(std::ostream& os, const log_entry_data& entry_data, log_entry_types let)
-  {
-    for (auto& l : m_loggers)
-      l.logger->log_entry_start(l.os == nullptr ? os : *l.os, entry_data, let);
-  }
-
-  void
-  log_entry_value(std::ostream& os, const_string value)
-  {
-    for (auto& l : m_loggers)
-      l.logger->log_entry_value(l.os == nullptr ? os : *l.os, value);
-  }
-
-  void
-  log_entry_finish(std::ostream& os)
-  {
-    for (auto& l : m_loggers)
-      l.logger->log_entry_finish(l.os == nullptr ? os : *l.os);
-  }
-
-#if BOOST_VERSION >= 105900
-  void
-  entry_context_start(std::ostream& os, log_level level)
-  {
-    for (auto& l : m_loggers)
-      l.logger->entry_context_start(l.os == nullptr ? os : *l.os, level);
-  }
-
-  void
-  log_entry_context(std::ostream& os, const_string value)
-  {
-    for (auto& l : m_loggers)
-      l.logger->log_entry_context(l.os == nullptr ? os : *l.os, value);
-  }
-
-  void
-  entry_context_finish(std::ostream& os)
-  {
-    for (auto& l : m_loggers)
-      l.logger->entry_context_finish(l.os == nullptr ? os : *l.os);
-  }
-#endif // BOOST_VERSION >= 105900
-
-private:
-  struct LoggerInfo
-  {
-    std::shared_ptr<unit_test_log_formatter> logger;
-    std::shared_ptr<std::ostream> os;
-  };
-  std::vector<LoggerInfo> m_loggers;
-};
-
-} // namespace output
-} // namespace unit_test
-} // namespace boost
-
-#endif // NDN_TESTS_BOOST_MULTI_LOG_FORMATTER_HPP
diff --git a/tests/unit-test-common-fixtures.cpp b/tests/clock-fixture.cpp
similarity index 60%
rename from tests/unit-test-common-fixtures.cpp
rename to tests/clock-fixture.cpp
index f16e027..472e489 100644
--- a/tests/unit-test-common-fixtures.cpp
+++ b/tests/clock-fixture.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2020,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,56 +24,37 @@
  * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "test-common.hpp"
+#include "clock-fixture.hpp"
 
 namespace ndn {
 namespace ndns {
 namespace tests {
 
-BaseFixture::BaseFixture()
+ClockFixture::ClockFixture()
+  : m_steadyClock(make_shared<time::UnitTestSteadyClock>())
+  , m_systemClock(make_shared<time::UnitTestSystemClock>())
 {
+  time::setCustomClocks(m_steadyClock, m_systemClock);
 }
 
-UnitTestTimeFixture::UnitTestTimeFixture()
-  : steadyClock(make_shared<time::UnitTestSteadyClock>())
-  , systemClock(make_shared<time::UnitTestSystemClock>())
-{
-  time::setCustomClocks(steadyClock, systemClock);
-}
-
-UnitTestTimeFixture::~UnitTestTimeFixture()
+ClockFixture::~ClockFixture()
 {
   time::setCustomClocks(nullptr, nullptr);
 }
 
 void
-UnitTestTimeFixture::advanceClocks(const time::nanoseconds& tick, size_t nTicks)
-{
-  this->advanceClocks(tick, tick * nTicks);
-}
-
-void
-UnitTestTimeFixture::advanceClocks(const time::nanoseconds& tick, const time::nanoseconds& total)
+ClockFixture::advanceClocks(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();
-    }
+  while (total > time::nanoseconds::zero()) {
+    auto t = std::min(tick, total);
+    m_steadyClock->advance(t);
+    m_systemClock->advance(t);
+    total -= t;
 
-    if (m_io.stopped())
-      m_io.reset();
-    m_io.poll();
+    afterTick();
   }
 }
 
diff --git a/tests/clock-fixture.hpp b/tests/clock-fixture.hpp
new file mode 100644
index 0000000..48a0f73
--- /dev/null
+++ b/tests/clock-fixture.hpp
@@ -0,0 +1,92 @@
+/* -*- 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 NDNS (Named Data Networking Domain Name Service) and is
+ * based on the code written as part of NFD (Named Data Networking Daemon).
+ * See AUTHORS.md for complete list of NDNS authors and contributors.
+ *
+ * NDNS 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.
+ *
+ * NDNS 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
+ * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NDNS_TESTS_CLOCK_FIXTURE_HPP
+#define NDNS_TESTS_CLOCK_FIXTURE_HPP
+
+#include <ndn-cxx/util/time-unit-test-clock.hpp>
+
+namespace ndn {
+namespace ndns {
+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 ndns
+} // namespace ndn
+
+#endif // NDNS_TESTS_CLOCK_FIXTURE_HPP
diff --git a/tests/global-configuration-fixture.cpp b/tests/global-configuration.cpp
similarity index 66%
rename from tests/global-configuration-fixture.cpp
rename to tests/global-configuration.cpp
index a8ba286..de38e0e 100644
--- a/tests/global-configuration-fixture.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 NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -17,16 +17,18 @@
  * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
+
+#include <boost/filesystem.hpp>
+#include <stdlib.h>
 
 namespace ndn {
-namespace ndns {
 namespace tests {
 
-class GlobalConfigurationFixture : boost::noncopyable
+class GlobalConfiguration
 {
 public:
-  GlobalConfigurationFixture()
+  GlobalConfiguration()
   {
     if (getenv("HOME") != nullptr) {
       m_home = getenv("HOME");
@@ -38,25 +40,25 @@
       m_tpm = getenv("NDN_CLIENT_TPM");
     }
 
-    boost::filesystem::path dir(TEST_CONFIG_PATH);
-    dir /= "test-home";
-    setenv("HOME", dir.generic_string().c_str(), 1);
+    auto testHome = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "test-home";
+    setenv("HOME", testHome.c_str(), 1);
+
+    boost::filesystem::create_directories(testHome);
 
     setenv("NDN_CLIENT_PIB", "pib-sqlite3", 1);
     setenv("NDN_CLIENT_TPM", "tpm-file", 1);
-    boost::filesystem::create_directories(dir);
   }
 
-  ~GlobalConfigurationFixture()
+  ~GlobalConfiguration() noexcept
   {
     if (!m_home.empty()) {
-      setenv("HOME", m_home.c_str(), 1);
+      setenv("HOME", m_home.data(), 1);
     }
     if (!m_pib.empty()) {
-      setenv("NDN_CLIENT_PIB", m_home.c_str(), 1);
+      setenv("NDN_CLIENT_PIB", m_home.data(), 1);
     }
     if (!m_tpm.empty()) {
-      setenv("NDN_CLIENT_TPM", m_home.c_str(), 1);
+      setenv("NDN_CLIENT_TPM", m_home.data(), 1);
     }
   }
 
@@ -66,11 +68,13 @@
   std::string m_tpm;
 };
 
-BOOST_GLOBAL_FIXTURE(GlobalConfigurationFixture)
-#if (BOOST_VERSION >= 105900)
-;
-#endif // BOOST_VERSION >= 105900
+#if BOOST_VERSION >= 106500
+BOOST_TEST_GLOBAL_CONFIGURATION(GlobalConfiguration);
+#elif BOOST_VERSION >= 105900
+BOOST_GLOBAL_FIXTURE(GlobalConfiguration);
+#else
+BOOST_GLOBAL_FIXTURE(GlobalConfiguration)
+#endif
 
 } // namespace tests
-} // namespace ndns
 } // namespace ndn
diff --git a/tests/identity-management-fixture.cpp b/tests/identity-management-fixture.cpp
deleted file mode 100644
index 8215b75..0000000
--- a/tests/identity-management-fixture.cpp
+++ /dev/null
@@ -1,130 +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 NDNS (Named Data Networking Domain Name Service).
- * See AUTHORS.md for complete list of NDNS authors and contributors.
- *
- * NDNS 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.
- *
- * NDNS 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
- * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "identity-management-fixture.hpp"
-
-#include <ndn-cxx/util/io.hpp>
-#include <ndn-cxx/security/additional-description.hpp>
-
-#include <boost/filesystem.hpp>
-
-namespace ndn {
-namespace ndns {
-namespace tests {
-
-IdentityManagementBaseFixture::~IdentityManagementBaseFixture()
-{
-  boost::system::error_code ec;
-  for (const auto& certFile : m_certFiles) {
-    boost::filesystem::remove(certFile, ec); // ignore error
-  }
-}
-
-bool
-IdentityManagementBaseFixture::saveCertToFile(const Data& obj, const std::string& filename)
-{
-  m_certFiles.insert(filename);
-  try {
-    io::save(obj, filename);
-    return true;
-  }
-  catch (const io::Error&) {
-    return false;
-  }
-}
-
-IdentityManagementFixture::IdentityManagementFixture()
-  : m_keyChain("pib-memory:", "tpm-memory:")
-{
-}
-
-security::Identity
-IdentityManagementFixture::addIdentity(const Name& identityName, const KeyParams& params)
-{
-  auto identity = m_keyChain.createIdentity(identityName, params);
-  m_identities.insert(identityName);
-  return identity;
-}
-
-bool
-IdentityManagementFixture::saveIdentityCertificate(const security::Identity& identity,
-                                                     const std::string& filename)
-{
-  try {
-    auto cert = identity.getDefaultKey().getDefaultCertificate();
-    return saveCertToFile(cert, filename);
-  }
-  catch (const security::Pib::Error&) {
-    return false;
-  }
-}
-
-security::Identity
-IdentityManagementFixture::addSubCertificate(const Name& subIdentityName,
-                                               const security::Identity& issuer, const KeyParams& params)
-{
-  auto subIdentity = addIdentity(subIdentityName, params);
-
-  security::Certificate request = subIdentity.getDefaultKey().getDefaultCertificate();
-
-  request.setName(request.getKeyName().append("parent").appendVersion());
-
-  SignatureInfo info;
-  info.setValidityPeriod(security::ValidityPeriod(time::system_clock::now(),
-                                                  time::system_clock::now() + time::days(7300)));
-
-  security::AdditionalDescription description;
-  description.set("type", "sub-certificate");
-  info.addCustomTlv(description.wireEncode());
-
-  m_keyChain.sign(request, signingByIdentity(issuer).setSignatureInfo(info));
-  m_keyChain.setDefaultCertificate(subIdentity.getDefaultKey(), request);
-
-  return subIdentity;
-}
-
-security::Certificate
-IdentityManagementFixture::addCertificate(const security::Key& key, const std::string& issuer)
-{
-  Name certificateName = key.getName();
-  certificateName
-    .append(issuer)
-    .appendVersion();
-  security::Certificate certificate;
-  certificate.setName(certificateName);
-
-  // set metainfo
-  certificate.setContentType(tlv::ContentType_Key);
-  certificate.setFreshnessPeriod(time::hours(1));
-
-  // set content
-  certificate.setContent(key.getPublicKey().data(), key.getPublicKey().size());
-
-  // set signature-info
-  SignatureInfo info;
-  info.setValidityPeriod(security::ValidityPeriod(time::system_clock::now(),
-                                                  time::system_clock::now() + time::days(10)));
-
-  m_keyChain.sign(certificate, signingByKey(key).setSignatureInfo(info));
-  return certificate;
-}
-
-} // namespace tests
-} // namespace ndns
-} // namespace ndn
diff --git a/tests/identity-management-fixture.hpp b/tests/identity-management-fixture.hpp
deleted file mode 100644
index 5b4aff3..0000000
--- a/tests/identity-management-fixture.hpp
+++ /dev/null
@@ -1,102 +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 NDNS (Named Data Networking Domain Name Service).
- * See AUTHORS.md for complete list of NDNS authors and contributors.
- *
- * NDNS 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.
- *
- * NDNS 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
- * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NDN_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
-#define NDN_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
-
-#include "boost-test.hpp"
-#include "test-home-fixture.hpp"
-
-#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/security/signing-helpers.hpp>
-
-#include <vector>
-
-namespace ndn {
-namespace ndns {
-namespace tests {
-
-class IdentityManagementBaseFixture : public TestHomeFixture<DefaultPibDir>
-{
-public:
-  ~IdentityManagementBaseFixture();
-
-  bool
-  saveCertToFile(const Data& obj, const std::string& filename);
-
-protected:
-  std::set<Name> m_identities;
-  std::set<std::string> m_certFiles;
-};
-
-/**
- * @brief A test suite level fixture to help with identity management
- *
- * Test cases in the suite can use this fixture to create identities.  Identities,
- * certificates, and saved certificates are automatically removed during test teardown.
- */
-class IdentityManagementFixture : public IdentityManagementBaseFixture
-{
-public:
-  IdentityManagementFixture();
-
-  /**
-   * @brief Add identity @p identityName
-   * @return name of the created self-signed certificate
-   */
-  security::Identity
-  addIdentity(const Name& identityName, const KeyParams& params = security::KeyChain::getDefaultKeyParams());
-
-  /**
-   *  @brief Save identity certificate to a file
-   *  @param identity identity
-   *  @param filename file name, should be writable
-   *  @return whether successful
-   */
-  bool
-  saveIdentityCertificate(const security::Identity& identity, const std::string& filename);
-
-  /**
-   * @brief Issue a certificate for \p subIdentityName signed by \p issuer
-   *
-   *  If identity does not exist, it is created.
-   *  A new key is generated as the default key for identity.
-   *  A default certificate for the key is signed by the issuer using its default certificate.
-   *
-   *  @return the sub identity
-   */
-  security::Identity
-  addSubCertificate(const Name& subIdentityName, const security::Identity& issuer,
-                    const KeyParams& params = security::KeyChain::getDefaultKeyParams());
-
-  /**
-   * @brief Add a self-signed certificate to @p key with issuer ID @p issuer
-   */
-  security::Certificate
-  addCertificate(const security::Key& key, const std::string& issuer);
-
-protected:
-  security::KeyChain m_keyChain;
-};
-
-} // namespace tests
-} // namespace ndns
-} // namespace ndn
-
-#endif // NDN_TESTS_IDENTITY_MANAGEMENT_FIXTURE_HPP
diff --git a/tests/io-fixture.hpp b/tests/io-fixture.hpp
new file mode 100644
index 0000000..1917e6e
--- /dev/null
+++ b/tests/io-fixture.hpp
@@ -0,0 +1,62 @@
+/* -*- 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 NDNS (Named Data Networking Domain Name Service) and is
+ * based on the code written as part of NFD (Named Data Networking Daemon).
+ * See AUTHORS.md for complete list of NDNS authors and contributors.
+ *
+ * NDNS 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.
+ *
+ * NDNS 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
+ * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NDNS_TESTS_IO_FIXTURE_HPP
+#define NDNS_TESTS_IO_FIXTURE_HPP
+
+#include "clock-fixture.hpp"
+
+#include <boost/asio/io_service.hpp>
+
+namespace ndn {
+namespace ndns {
+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 ndns
+} // namespace ndn
+
+#endif // NDNS_TESTS_IO_FIXTURE_HPP
diff --git a/tests/key-chain-fixture.cpp b/tests/key-chain-fixture.cpp
new file mode 100644
index 0000000..c374fa3
--- /dev/null
+++ b/tests/key-chain-fixture.cpp
@@ -0,0 +1,119 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2013-2020 Regents of the University of California.
+ *
+ * This file is part of NDNS (Named Data Networking Domain Name Service).
+ * See AUTHORS.md for complete list of NDNS authors and contributors.
+ *
+ * NDNS 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.
+ *
+ * NDNS 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
+ * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "key-chain-fixture.hpp"
+
+#include <ndn-cxx/util/io.hpp>
+
+#include <boost/filesystem.hpp>
+
+namespace ndn {
+namespace ndns {
+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 ndns
+} // namespace ndn
diff --git a/tests/key-chain-fixture.hpp b/tests/key-chain-fixture.hpp
new file mode 100644
index 0000000..003149d
--- /dev/null
+++ b/tests/key-chain-fixture.hpp
@@ -0,0 +1,97 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2013-2020 Regents of the University of California.
+ *
+ * This file is part of NDNS (Named Data Networking Domain Name Service).
+ * See AUTHORS.md for complete list of NDNS authors and contributors.
+ *
+ * NDNS 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.
+ *
+ * NDNS 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
+ * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NDNS_TESTS_KEY_CHAIN_FIXTURE_HPP
+#define NDNS_TESTS_KEY_CHAIN_FIXTURE_HPP
+
+#include "test-home-fixture.hpp"
+
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/security/signing-helpers.hpp>
+
+namespace ndn {
+namespace ndns {
+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 : public TestHomeFixture<DefaultPibDir>
+{
+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 ndns
+} // namespace ndn
+
+#endif // NDNS_TESTS_KEY_CHAIN_FIXTURE_HPP
diff --git a/tests/main.cpp b/tests/main.cpp
index fc8f99a..3a1bd40 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -24,92 +24,5 @@
  * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#define BOOST_TEST_MODULE NDNS Unit Tests
-
-#include <boost/version.hpp>
-
-#if BOOST_VERSION >= 106200
-// Boost.Test v3.3 (Boost 1.62) natively supports multi-logger output
+#define BOOST_TEST_MODULE NDNS
 #include "boost-test.hpp"
-#else
-#define BOOST_TEST_ALTERNATIVE_INIT_API
-#define BOOST_TEST_NO_MAIN
-#include "boost-test.hpp"
-#include "boost-multi-log-formatter.hpp"
-
-#include <boost/program_options/options_description.hpp>
-#include <boost/program_options/variables_map.hpp>
-#include <boost/program_options/parsers.hpp>
-
-#include <fstream>
-#include <iostream>
-
-static bool
-init_tests()
-{
-  init_unit_test();
-
-  namespace po = boost::program_options;
-  namespace ut = boost::unit_test;
-
-  po::options_description extraOptions;
-  std::string logger;
-  std::string outputFile = "-";
-  extraOptions.add_options()
-    ("log_format2", po::value<std::string>(&logger), "Type of second log formatter: HRF or XML")
-    ("log_sink2", po::value<std::string>(&outputFile)->default_value(outputFile), "Second log sink, - for stdout")
-    ;
-  po::variables_map vm;
-  try {
-    po::store(po::command_line_parser(ut::framework::master_test_suite().argc,
-                                      ut::framework::master_test_suite().argv)
-                .options(extraOptions)
-                .run(),
-              vm);
-    po::notify(vm);
-  }
-  catch (const std::exception& e) {
-    std::cerr << "ERROR: " << e.what() << "\n"
-              << extraOptions << std::endl;
-    return false;
-  }
-
-  if (vm.count("log_format2") == 0) {
-    // second logger is not configured
-    return true;
-  }
-
-  std::shared_ptr<ut::unit_test_log_formatter> formatter;
-  if (logger == "XML") {
-    formatter = std::make_shared<ut::output::xml_log_formatter>();
-  }
-  else if (logger == "HRF") {
-    formatter = std::make_shared<ut::output::compiler_log_formatter>();
-  }
-  else {
-    std::cerr << "ERROR: only HRF or XML log formatter can be specified" << std::endl;
-    return false;
-  }
-
-  std::shared_ptr<std::ostream> output;
-  if (outputFile == "-") {
-    output = std::shared_ptr<std::ostream>(&std::cout, std::bind([]{}));
-  }
-  else {
-    output = std::make_shared<std::ofstream>(outputFile.c_str());
-  }
-
-  auto multiFormatter = new ut::output::multi_log_formatter;
-  multiFormatter->add(formatter, output);
-  ut::unit_test_log.set_formatter(multiFormatter);
-
-  return true;
-}
-
-int
-main(int argc, char* argv[])
-{
-  return ::boost::unit_test::unit_test_main(&init_tests, argc, argv);
-}
-
-#endif // BOOST_VERSION >= 106200
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
deleted file mode 100644
index edafcb4..0000000
--- a/tests/test-common.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2017, Regents of the University of California.
- *
- * This file is part of NDNS (Named Data Networking Domain Name Service).
- * See AUTHORS.md for complete list of NDNS authors and contributors.
- *
- * NDNS 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.
- *
- * NDNS 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
- * NDNS, 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>
-
-namespace ndn {
-namespace ndns {
-namespace tests {
-
-shared_ptr<Interest>
-makeInterest(const Name& name, uint32_t nonce)
-{
-  auto interest = make_shared<Interest>(name);
-  if (nonce != 0) {
-    interest->setNonce(nonce);
-  }
-  return interest;
-}
-
-shared_ptr<Data>
-makeData(const Name& name)
-{
-  auto data = 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.wireEncode();
-
-  return data;
-}
-
-lp::Nack
-makeNack(const Name& name, uint32_t nonce, lp::NackReason reason)
-{
-  Interest interest(name);
-  interest.setNonce(nonce);
-  lp::Nack nack(std::move(interest));
-  nack.setReason(reason);
-  return nack;
-}
-
-} // namespace tests
-} // namespace ndns
-} // namespace ndn
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
deleted file mode 100644
index 0746b83..0000000
--- a/tests/test-common.hpp
+++ /dev/null
@@ -1,116 +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 NDNS (Named Data Networking Domain Name Service).
- * See AUTHORS.md for complete list of NDNS authors and contributors.
- *
- * NDNS 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.
- *
- * NDNS 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
- * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NDNS_TESTS_TEST_COMMON_HPP
-#define NDNS_TESTS_TEST_COMMON_HPP
-
-#include "logger.hpp"
-#include "boost-test.hpp"
-#include "unit-test-common-fixtures.hpp"
-#include "identity-management-fixture.hpp"
-
-#include <ndn-cxx/name.hpp>
-#include <ndn-cxx/data.hpp>
-#include <ndn-cxx/interest.hpp>
-#include <ndn-cxx/link.hpp>
-#include <ndn-cxx/lp/nack.hpp>
-#include <ndn-cxx/util/dummy-client-face.hpp>
-#include <ndn-cxx/security/signing-helpers.hpp>
-
-#include <boost/version.hpp>
-#include <boost/asio.hpp>
-#include <boost/filesystem.hpp>
-
-#include <fstream>
-
-namespace ndn {
-namespace ndns {
-namespace tests {
-
-using ndn::security::KeyChain;
-using ndn::security::Identity;
-using ndn::security::pib::Key;
-using ndn::security::Certificate;
-
-/** \brief create an Interest
- *  \param name Interest name
- *  \param nonce if non-zero, set Nonce to this value
- *               (useful for creating Nack with same Nonce)
- */
-shared_ptr<Interest>
-makeInterest(const Name& name, uint32_t nonce = 0);
-
-/** \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.
- */
-shared_ptr<Data>
-makeData(const Name& name);
-
-/** \brief add a fake signature to Data
- */
-Data&
-signData(Data& data);
-
-/** \brief add a fake signature to Data
- */
-inline shared_ptr<Data>
-signData(shared_ptr<Data> data)
-{
-  signData(*data);
-  return data;
-}
-
-/** \brief create a Nack
- *  \param name Interest name
- *  \param nonce Interest nonce
- *  \param reason Nack reason
- */
-lp::Nack
-makeNack(const Name& name, uint32_t nonce, lp::NackReason reason);
-
-/** \brief replace a name component
- *  \param[inout] name name
- *  \param index name component index
- *  \param a arguments to name::Component constructor
- */
-template<typename...A>
-void
-setNameComponent(Name& name, ssize_t index, const A& ...a)
-{
-  Name name2 = name.getPrefix(index);
-  name2.append(name::Component(a...));
-  name2.append(name.getSubName(name2.size()));
-  name = name2;
-}
-
-template<typename Packet, typename...A>
-void
-setNameComponent(Packet& packet, ssize_t index, const A& ...a)
-{
-  Name name = packet.getName();
-  setNameComponent(name, index, a...);
-  packet.setName(name);
-}
-
-} // namespace tests
-} // namespace ndns
-} // namespace ndn
-
-#endif // NDNS_TESTS_TEST_COMMON_HPP
diff --git a/tests/test-home-fixture.hpp b/tests/test-home-fixture.hpp
index 08d2158..17e9abf 100644
--- a/tests/test-home-fixture.hpp
+++ b/tests/test-home-fixture.hpp
@@ -20,11 +20,12 @@
 #ifndef NDNS_TESTS_TEST_HOME_FIXTURE_HPP
 #define NDNS_TESTS_TEST_HOME_FIXTURE_HPP
 
-#include "boost-test.hpp"
-
-#include <boost/filesystem.hpp>
-#include <boost/algorithm/string.hpp>
+#include <cstdlib>
 #include <fstream>
+#include <initializer_list>
+
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/filesystem.hpp>
 
 namespace ndn {
 namespace ndns {
@@ -43,11 +44,11 @@
   PibDirFixture()
     : m_pibDir(Path().PATH)
   {
-    if (getenv("NDN_CLIENT_PIB") != nullptr) {
-      m_oldPib = getenv("NDN_CLIENT_PIB");
+    if (std::getenv("NDN_CLIENT_PIB") != nullptr) {
+      m_oldPib = std::getenv("NDN_CLIENT_PIB");
     }
-    if (getenv("NDN_CLIENT_TPM") != nullptr) {
-      m_oldTpm = getenv("NDN_CLIENT_TPM");
+    if (std::getenv("NDN_CLIENT_TPM") != nullptr) {
+      m_oldTpm = std::getenv("NDN_CLIENT_TPM");
     }
 
     /// @todo Consider change to an in-memory PIB/TPM
@@ -58,14 +59,14 @@
   ~PibDirFixture()
   {
     if (!m_oldPib.empty()) {
-      setenv("NDN_CLIENT_PIB", m_oldPib.c_str(), true);
+      setenv("NDN_CLIENT_PIB", m_oldPib.data(), true);
     }
     else {
       unsetenv("NDN_CLIENT_PIB");
     }
 
     if (!m_oldTpm.empty()) {
-      setenv("NDN_CLIENT_TPM", m_oldTpm.c_str(), true);
+      setenv("NDN_CLIENT_TPM", m_oldTpm.data(), true);
     }
     else {
       unsetenv("NDN_CLIENT_TPM");
@@ -91,7 +92,7 @@
 public:
   TestHomeFixture()
   {
-    setenv("TEST_HOME", this->m_pibDir.c_str(), true);
+    setenv("TEST_HOME", this->m_pibDir.data(), true);
   }
 
   ~TestHomeFixture()
@@ -100,7 +101,7 @@
   }
 
   void
-  createClientConf(std::initializer_list<std::string> lines)
+  createClientConf(std::initializer_list<std::string> lines) const
   {
     boost::filesystem::create_directories(boost::filesystem::path(this->m_pibDir) / ".ndn");
     std::ofstream of((boost::filesystem::path(this->m_pibDir) / ".ndn" / "client.conf").c_str());
diff --git a/tests/unit-test-common-fixtures.hpp b/tests/unit-test-common-fixtures.hpp
deleted file mode 100644
index 9e1c9ac..0000000
--- a/tests/unit-test-common-fixtures.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017,  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 NDNS (Named Data Networking Domain Name Service) and is
- * based on the code written as part of NFD (Named Data Networking Daemon).
- * See AUTHORS.md for complete list of NDNS authors and contributors.
- *
- * NDNS 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.
- *
- * NDNS 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
- * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NDNS_TESTS_UNIT_TEST_COMMON_FIXTURES_HPP
-#define NDNS_TESTS_UNIT_TEST_COMMON_FIXTURES_HPP
-
-#include "boost-test.hpp"
-
-#include <boost/asio.hpp>
-#include <ndn-cxx/util/time-unit-test-clock.hpp>
-
-namespace ndn {
-namespace ndns {
-namespace tests {
-
-/** \brief base test fixture
- *
- *  Every test case should be based on this fixture,
- *  to have per test case io_service initialization.
- */
-class BaseFixture
-{
-protected:
-  BaseFixture();
-
-protected:
-  /** \brief reference to global io_service
-   */
-  boost::asio::io_service m_io;
-};
-
-/** \brief a base test fixture that overrides steady clock and system clock
- */
-class UnitTestTimeFixture : public virtual BaseFixture
-{
-protected:
-  UnitTestTimeFixture();
-
-  ~UnitTestTimeFixture();
-
-  /** \brief advance steady and system clocks
-   *
-   *  Clocks are advanced in increments of \p tick for \p nTicks ticks.
-   *  After each tick, global 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(const 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, global 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(const time::nanoseconds& tick, const time::nanoseconds& total);
-
-protected:
-  shared_ptr<time::UnitTestSteadyClock> steadyClock;
-  shared_ptr<time::UnitTestSystemClock> systemClock;
-
-  friend class LimitedIo;
-};
-
-} // namespace tests
-} // namespace ndns
-} // namespace ndn
-
-#endif // NDNS_TESTS_UNIT_TEST_COMMON_FIXTURES_HPP
diff --git a/tests/unit/clients/iterative-query-controller.cpp b/tests/unit/clients/iterative-query-controller.t.cpp
similarity index 97%
rename from tests/unit/clients/iterative-query-controller.cpp
rename to tests/unit/clients/iterative-query-controller.t.cpp
index 46d11d4..6478156 100644
--- a/tests/unit/clients/iterative-query-controller.cpp
+++ b/tests/unit/clients/iterative-query-controller.t.cpp
@@ -20,9 +20,11 @@
 #include "clients/iterative-query-controller.hpp"
 #include "daemon/name-server.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
 #include "unit/database-test-data.hpp"
 
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
 namespace ndn {
 namespace ndns {
 namespace tests {
@@ -128,7 +130,6 @@
       }
     }
   }
-
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit/clients/query.cpp b/tests/unit/clients/query.t.cpp
similarity index 91%
rename from tests/unit/clients/query.cpp
rename to tests/unit/clients/query.t.cpp
index f7ed478..e4da482 100644
--- a/tests/unit/clients/query.cpp
+++ b/tests/unit/clients/query.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-2020, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -19,10 +19,10 @@
 
 #include "clients/query.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
+#include "key-chain-fixture.hpp"
 
 #include <boost/lexical_cast.hpp>
-#include <string>
 
 namespace ndn {
 namespace ndns {
@@ -30,9 +30,9 @@
 
 BOOST_AUTO_TEST_SUITE(Query)
 
-BOOST_FIXTURE_TEST_CASE(TestCase, IdentityManagementFixture)
+BOOST_FIXTURE_TEST_CASE(TestCase, KeyChainFixture)
 {
-  security::Identity certIdentity = addIdentity("/cert/name");
+  auto certIdentity = m_keyChain.createIdentity("/cert/name");
   Name zone("/net");
   name::Component qType = ndns::label::NDNS_ITERATIVE_QUERY;
   ndns::Query q(zone, qType);
@@ -77,7 +77,7 @@
   BOOST_CHECK_EQUAL(q5.fromInterest(zone, interest), true);
   BOOST_CHECK_EQUAL(q4, q5);
   BOOST_CHECK_NE(q2, q4);
- }
+}
 
 BOOST_AUTO_TEST_SUITE_END()
 
diff --git a/tests/unit/clients/response.cpp b/tests/unit/clients/response.t.cpp
similarity index 93%
rename from tests/unit/clients/response.cpp
rename to tests/unit/clients/response.t.cpp
index 88941c8..97a6fe0 100644
--- a/tests/unit/clients/response.cpp
+++ b/tests/unit/clients/response.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California.
+/*
+ * Copyright (c) 2014-2020, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -19,13 +19,14 @@
 
 #include "clients/response.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
+#include "key-chain-fixture.hpp"
 
 namespace ndn {
 namespace ndns {
 namespace tests {
 
-BOOST_FIXTURE_TEST_SUITE(Response, IdentityManagementFixture)
+BOOST_FIXTURE_TEST_SUITE(Response, KeyChainFixture)
 
 BOOST_AUTO_TEST_CASE(Basic)
 {
diff --git a/tests/unit/daemon/db-mgr.cpp b/tests/unit/daemon/db-mgr.t.cpp
similarity index 96%
rename from tests/unit/daemon/db-mgr.cpp
rename to tests/unit/daemon/db-mgr.t.cpp
index ffa38b8..0b69330 100644
--- a/tests/unit/daemon/db-mgr.cpp
+++ b/tests/unit/daemon/db-mgr.t.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 NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -18,9 +18,12 @@
  */
 
 #include "daemon/db-mgr.hpp"
-#include "test-common.hpp"
+#include "logger.hpp"
+
+#include "boost-test.hpp"
 
 #include <algorithm>
+#include <boost/filesystem.hpp>
 
 namespace ndn {
 namespace ndns {
@@ -30,7 +33,7 @@
 
 BOOST_AUTO_TEST_SUITE(DbMgr)
 
-static const boost::filesystem::path TEST_DATABASE2 = TEST_CONFIG_PATH "/" "test-ndns.db";
+const auto TEST_DATABASE2 = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "test-ndns.db";
 
 class DbMgrFixture
 {
@@ -43,16 +46,14 @@
   ~DbMgrFixture()
   {
     session.close();
-    boost::filesystem::remove(TEST_DATABASE2);
     NDNS_LOG_INFO("remove database " << TEST_DATABASE2);
+    boost::filesystem::remove(TEST_DATABASE2);
   }
 
 public:
   ndns::DbMgr session;
 };
 
-
-
 BOOST_FIXTURE_TEST_CASE(Zones, DbMgrFixture)
 {
   Zone zone1;
diff --git a/tests/unit/daemon/name-server.cpp b/tests/unit/daemon/name-server.t.cpp
similarity index 98%
rename from tests/unit/daemon/name-server.cpp
rename to tests/unit/daemon/name-server.t.cpp
index cf31a8f..4ad5a11 100644
--- a/tests/unit/daemon/name-server.cpp
+++ b/tests/unit/daemon/name-server.t.cpp
@@ -18,13 +18,16 @@
  */
 
 #include "daemon/name-server.hpp"
-#include "daemon/db-mgr.hpp"
-#include "clients/response.hpp"
-#include "clients/query.hpp"
 
-#include "test-common.hpp"
+#include "clients/query.hpp"
+#include "clients/response.hpp"
+#include "daemon/db-mgr.hpp"
+#include "logger.hpp"
+
+#include "boost-test.hpp"
 #include "unit/database-test-data.hpp"
 
+#include <ndn-cxx/util/dummy-client-face.hpp>
 #include <ndn-cxx/util/regex.hpp>
 
 namespace ndn {
diff --git a/tests/unit/daemon/rrset-factory.cpp b/tests/unit/daemon/rrset-factory.t.cpp
similarity index 89%
rename from tests/unit/daemon/rrset-factory.cpp
rename to tests/unit/daemon/rrset-factory.t.cpp
index 39c9286..6f2eb69 100644
--- a/tests/unit/daemon/rrset-factory.cpp
+++ b/tests/unit/daemon/rrset-factory.t.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 NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -18,11 +18,13 @@
  */
 
 #include "daemon/rrset-factory.hpp"
-
-#include "test-common.hpp"
 #include "mgmt/management-tool.hpp"
 
+#include "boost-test.hpp"
+#include "key-chain-fixture.hpp"
+
 #include <boost/lexical_cast.hpp>
+
 #include <ndn-cxx/security/verification-helpers.hpp>
 
 namespace ndn {
@@ -31,15 +33,16 @@
 
 NDNS_LOG_INIT(RrsetFactoryTest);
 
-class RrsetFactoryFixture : public IdentityManagementFixture
+const auto TEST_DATABASE2 = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "test-ndns.db";
+const auto TEST_CERT = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "anchors" / "root.cert";
+
+class RrsetFactoryFixture : public KeyChainFixture
 {
 public:
   RrsetFactoryFixture()
-    : TEST_DATABASE2(TEST_CONFIG_PATH "/" "test-ndns.db"),
-      TEST_IDENTITY_NAME("/rrest/factory"),
-      TEST_CERT(TEST_CONFIG_PATH "/" "anchors/root.cert"),
-      m_session(TEST_DATABASE2.string()),
-      m_zoneName(TEST_IDENTITY_NAME)
+    : TEST_IDENTITY_NAME("/rrest/factory")
+    , m_session(TEST_DATABASE2.string())
+    , m_zoneName(TEST_IDENTITY_NAME)
   {
     Zone zone1;
     zone1.setName(m_zoneName);
@@ -48,12 +51,12 @@
 
     Name identityName = Name(TEST_IDENTITY_NAME).append("NDNS");
 
-    m_identity = this->addIdentity(identityName);
+    m_identity = m_keyChain.createIdentity(identityName);
     m_cert = m_identity.getDefaultKey().getDefaultCertificate();
     m_certName = m_cert.getName();
-    saveIdentityCertificate(m_identity, TEST_CERT.string());
+    saveIdentityCert(m_identity, TEST_CERT.string());
 
-    NDNS_LOG_INFO("save test root cert " << m_certName << " to: " << TEST_CERT.string());
+    NDNS_LOG_INFO("save test root cert " << m_certName << " to: " << TEST_CERT);
     BOOST_CHECK_GT(m_certName.size(), 0);
     NDNS_LOG_TRACE("test certName: " << m_certName);
   }
@@ -61,15 +64,13 @@
   ~RrsetFactoryFixture()
   {
     m_session.close();
-    boost::filesystem::remove(TEST_DATABASE2);
     NDNS_LOG_INFO("remove database " << TEST_DATABASE2);
+    boost::filesystem::remove(TEST_DATABASE2);
     boost::filesystem::remove(TEST_CERT);
   }
 
 public:
-  const boost::filesystem::path TEST_DATABASE2;
   const Name TEST_IDENTITY_NAME;
-  const boost::filesystem::path TEST_CERT;
   ndns::DbMgr m_session;
   Name m_zoneName;
   Name m_certName;
diff --git a/tests/unit/daemon/rrset.cpp b/tests/unit/daemon/rrset.t.cpp
similarity index 99%
rename from tests/unit/daemon/rrset.cpp
rename to tests/unit/daemon/rrset.t.cpp
index f9e2704..eb9f035 100644
--- a/tests/unit/daemon/rrset.cpp
+++ b/tests/unit/daemon/rrset.t.cpp
@@ -19,7 +19,7 @@
 
 #include "daemon/rrset.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
 
 #if BOOST_VERSION >= 105900
 #include <boost/test/tools/output_test_stream.hpp>
diff --git a/tests/unit/daemon/zone.cpp b/tests/unit/daemon/zone.t.cpp
similarity index 98%
rename from tests/unit/daemon/zone.cpp
rename to tests/unit/daemon/zone.t.cpp
index 09bc781..ed57285 100644
--- a/tests/unit/daemon/zone.cpp
+++ b/tests/unit/daemon/zone.t.cpp
@@ -19,7 +19,7 @@
 
 #include "daemon/zone.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
 
 #if BOOST_VERSION >= 105900
 #include <boost/test/tools/output_test_stream.hpp>
diff --git a/tests/unit/database-test-data.cpp b/tests/unit/database-test-data.cpp
index 2aef965..d4808d6 100644
--- a/tests/unit/database-test-data.cpp
+++ b/tests/unit/database-test-data.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 NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -19,27 +19,28 @@
 
 #include "database-test-data.hpp"
 #include "daemon/rrset-factory.hpp"
-#include "util/cert-helper.hpp"
 #include "mgmt/management-tool.hpp"
+#include "util/cert-helper.hpp"
+
 #include <ndn-cxx/security/verification-helpers.hpp>
 
+namespace fs = boost::filesystem;
+
 namespace ndn {
 namespace ndns {
 namespace tests {
 
 NDNS_LOG_INIT(TestFakeData);
 
-const boost::filesystem::path DbTestData::TEST_DATABASE = TEST_CONFIG_PATH "/" "test-ndns.db";
+const fs::path DbTestData::TEST_DATABASE = fs::path(UNIT_TESTS_TMPDIR) / "test-ndns.db";
 const Name DbTestData::TEST_IDENTITY_NAME("/test19");
-const boost::filesystem::path DbTestData::TEST_CERT =
-  TEST_CONFIG_PATH "/" "anchors/root.cert";
-const boost::filesystem::path DbTestData::TEST_DKEY_CERT =
-  TEST_CONFIG_PATH "/" "dkey.cert";
+const fs::path DbTestData::TEST_CERT = fs::path(UNIT_TESTS_TMPDIR) / "anchors" / "root.cert";
+const fs::path DbTestData::TEST_DKEY_CERT = fs::path(UNIT_TESTS_TMPDIR) / "dkey.cert";
 
 DbTestData::PreviousStateCleaner::PreviousStateCleaner()
 {
-  boost::filesystem::remove(TEST_DATABASE);
-  boost::filesystem::remove(TEST_CERT);
+  fs::remove(TEST_DATABASE);
+  fs::remove(TEST_CERT);
 }
 
 DbTestData::DbTestData()
@@ -50,20 +51,16 @@
 {
   NDNS_LOG_TRACE("start creating test data");
 
-  ndns::NdnsValidatorBuilder::VALIDATOR_CONF_FILE = TEST_CONFIG_PATH "/" "validator.conf";
+  NdnsValidatorBuilder::VALIDATOR_CONF_FILE = (fs::path(UNIT_TESTS_TMPDIR) / "validator.conf").string();
 
   ManagementTool tool(TEST_DATABASE.string(), m_keyChain);
   // this is how DKEY is added to parent zone in real world.
-  auto addDkeyCertToParent = [&tool](Zone& dkeyFrom, Zone& dkeyTo)->void{
+  auto addDkeyCertToParent = [&tool] (Zone& dkeyFrom, Zone& dkeyTo) {
     Certificate dkeyCert;
     dkeyCert = tool.getZoneDkey(dkeyFrom);
-    ndn::io::save(dkeyCert, TEST_DKEY_CERT.string());
-    tool.addRrsetFromFile(dkeyTo.getName(),
-                          TEST_DKEY_CERT.string(),
-                          DEFAULT_RR_TTL,
-                          DEFAULT_CERT,
-                          ndn::io::BASE64,
-                          true);
+    io::save(dkeyCert, TEST_DKEY_CERT.string());
+    tool.addRrsetFromFile(dkeyTo.getName(), TEST_DKEY_CERT.string(),
+                          DEFAULT_RR_TTL, DEFAULT_CERT, io::BASE64, true);
   };
 
   Name testName(m_testName);
@@ -85,16 +82,15 @@
   m_certName = CertHelper::getDefaultCertificateNameOfIdentity(m_keyChain, identityName);
   m_cert = CertHelper::getCertificate(m_keyChain, identityName, m_certName);
 
-  ndn::io::save(m_cert, TEST_CERT.string());
+  io::save(m_cert, TEST_CERT.string());
   NDNS_LOG_INFO("save test root cert " << m_certName << " to: " << TEST_CERT.string());
 
-  BOOST_CHECK_GT(m_certName.size(), 0);
+  BOOST_ASSERT(m_certName.size() > 0);
   NDNS_LOG_TRACE("test certName: " << m_certName);
 
   int certificateIndex = 0;
-  function<void(const Name&,Zone&,const name::Component&)> addQueryRrset =
-    [this, &certificateIndex] (const Name& label, Zone& zone,
-                               const name::Component& type) {
+  auto addQueryRrset = [this, &certificateIndex] (const Name& label, Zone& zone,
+                                                  const name::Component& type) {
     const time::seconds ttl(3000 + 100 * certificateIndex);
     const name::Component version = name::Component::fromVersion(100 + 1000 * certificateIndex);
     name::Component qType(label::NDNS_ITERATIVE_QUERY);
@@ -140,7 +136,7 @@
                   m_keyChain, m_certName);
   rf.onlyCheckZone();
   if (type == label::NS_RR_TYPE) {
-    ndn::DelegationList ds;
+    DelegationList ds;
     ds.insert(1, "xx");
     rrset = rf.generateNsRrset(label, version.toVersion(), ttl, ds);
     if (contentType != NDNS_AUTH) {
@@ -157,8 +153,7 @@
                                  m_cert);
   }
 
-  shared_ptr<Data> data = make_shared<Data>(rrset.getData());
-
+  auto data = make_shared<Data>(rrset.getData());
   security::verifySignature(*data, m_cert);
 
   ManagementTool tool(TEST_DATABASE.string(), m_keyChain);
diff --git a/tests/unit/database-test-data.hpp b/tests/unit/database-test-data.hpp
index f1ff278..a7a9668 100644
--- a/tests/unit/database-test-data.hpp
+++ b/tests/unit/database-test-data.hpp
@@ -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-2020, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -25,13 +25,14 @@
 #include "clients/query.hpp"
 #include "validator/validator.hpp"
 
-#include "test-common.hpp"
+#include "io-fixture.hpp"
+#include "key-chain-fixture.hpp"
 
 namespace ndn {
 namespace ndns {
 namespace tests {
 
-class DbTestData : public IdentityManagementFixture, public UnitTestTimeFixture
+class DbTestData : public IoFixture, public KeyChainFixture
 {
 public:
   static const boost::filesystem::path TEST_DATABASE;
@@ -41,7 +42,7 @@
 
   DbTestData();
 
-  ~DbTestData();
+  ~DbTestData() override;
 
 private:
   void
diff --git a/tests/unit/mgmt/management-tool.cpp b/tests/unit/mgmt/management-tool.t.cpp
similarity index 96%
rename from tests/unit/mgmt/management-tool.cpp
rename to tests/unit/mgmt/management-tool.t.cpp
index a8a47cc..2ac878a 100644
--- a/tests/unit/mgmt/management-tool.cpp
+++ b/tests/unit/mgmt/management-tool.t.cpp
@@ -23,7 +23,9 @@
 #include "ndns-enum.hpp"
 #include "ndns-label.hpp"
 #include "ndns-tlv.hpp"
-#include "test-common.hpp"
+
+#include "boost-test.hpp"
+#include "key-chain-fixture.hpp"
 
 #include <random>
 
@@ -39,22 +41,22 @@
 #include <ndn-cxx/util/io.hpp>
 #include <ndn-cxx/util/regex.hpp>
 
-using boost::test_tools::output_test_stream;
-
 namespace ndn {
 namespace ndns {
 namespace tests {
 
-static const boost::filesystem::path TEST_DATABASE = TEST_CONFIG_PATH "/management_tool.db";
-static const boost::filesystem::path TEST_CERTDIR = TEST_CONFIG_PATH "/management_tool_certs";
-static const Name FAKE_ROOT("/fake-root/123456789");
+using boost::test_tools::output_test_stream;
+
+const auto TEST_DATABASE = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "management_tool.db";
+const auto TEST_CERTDIR = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "management_tool_certs";
+const Name FAKE_ROOT("/fake-root/123456789");
 
 /**
  * @brief Recursive copy a directory using Boost Filesystem
  *
  * Based on from http://stackoverflow.com/q/8593608/2150331
  */
-void
+static void
 copyDir(const boost::filesystem::path& source, const boost::filesystem::path& destination)
 {
   namespace fs = boost::filesystem;
@@ -79,16 +81,17 @@
     if (std::getenv("HOME"))
       m_origHome = std::getenv("HOME");
 
-    setenv("HOME", TEST_CONFIG_PATH "/tests/unit/mgmt/", 1);
-    boost::filesystem::remove_all(TEST_CONFIG_PATH "/tests/unit/mgmt/");
-    boost::filesystem::create_directories(TEST_CONFIG_PATH "/tests/unit/mgmt");
-    copyDir("tests/unit/mgmt/.ndn", TEST_CONFIG_PATH "/tests/unit/mgmt/.ndn");
+    auto p = boost::filesystem::path(UNIT_TESTS_TMPDIR) / "tests" / "unit" / "mgmt";
+    setenv("HOME", p.c_str(), 1);
+    boost::filesystem::remove_all(p);
+    boost::filesystem::create_directories(p);
+    copyDir("tests/unit/mgmt/.ndn", p / ".ndn");
   }
 
   ~TestHome()
   {
     if (!m_origHome.empty())
-      setenv("HOME", m_origHome.c_str(), 1);
+      setenv("HOME", m_origHome.data(), 1);
     else
       unsetenv("HOME");
   }
@@ -97,18 +100,13 @@
   std::string m_origHome;
 };
 
-
-class ManagementToolFixture : public TestHome, public IdentityManagementFixture
+class ManagementToolFixture : public TestHome, public KeyChainFixture
 {
 public:
   class Error : public std::runtime_error
   {
   public:
-    explicit
-    Error(const std::string& what)
-      : std::runtime_error(what)
-    {
-    }
+    using std::runtime_error::runtime_error;
   };
 
   class PreviousStateCleaner
@@ -126,7 +124,7 @@
     , m_dbMgr(TEST_DATABASE.string().c_str())
   {
     boost::filesystem::create_directory(TEST_CERTDIR);
-    Identity root = addIdentity("NDNS");
+    Identity root = m_keyChain.createIdentity("NDNS");
     Key ksk = root.getDefaultKey();
     m_keyChain.deleteCertificate(ksk, ksk.getDefaultCertificate().getName());
     Certificate kskCert = CertHelper::createCertificate(m_keyChain, ksk, ksk, "CERT");
@@ -140,7 +138,7 @@
     m_keyChain.addCertificate(dsk, dskCert);
     rootDsk = dskCert.getName();
 
-    Identity other = addIdentity("/ndns-test/NDNS");
+    Identity other = m_keyChain.createIdentity("/ndns-test/NDNS");
     Key otherKskKey = other.getDefaultKey();
     m_keyChain.deleteCertificate(otherKskKey, otherKskKey.getDefaultCertificate().getName());
     Certificate otherKskCert = CertHelper::createCertificate(m_keyChain, otherKskKey, otherKskKey, "CERT");
@@ -287,7 +285,7 @@
 //   Name rootDsk = generateCerts(ROOT_ZONE);
 //   generateCerts("/ndns-test", rootDsk);
 
-//   copyDir(TEST_CONFIG_PATH "/tests/unit/mgmt/.ndn", "/tmp/.ndn");
+//   copyDir(UNIT_TESTS_TMPDIR "/tests/unit/mgmt/.ndn", "/tmp/.ndn");
 //   std::cout << "Manually copy contents of /tmp/.ndn into tests/unit/mgmt/.ndn" << std::endl;
 // }
 
@@ -503,25 +501,25 @@
                                       time::seconds(1), time::days(1), "/com/ndnsim"),
                                       ndns::ManagementTool::Error);
 
-  Identity id = addIdentity("/net/ndnsim/NDNS");
+  Identity id = m_keyChain.createIdentity("/net/ndnsim/NDNS");
   Certificate cert = id.getDefaultKey().getDefaultCertificate();
   BOOST_CHECK_NO_THROW(m_tool.createZone("/net/ndnsim", "/net",
                                          time::seconds(1), time::days(1), cert.getName()));
 
-  id = addIdentity("/com/ndnsim/NDNS");
+  id = m_keyChain.createIdentity("/com/ndnsim/NDNS");
   cert = id.getDefaultKey().getDefaultCertificate();
 
   BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net",
                                       time::seconds(1), time::days(1), cert.getName()),
                     ndns::ManagementTool::Error);
 
-  id = addIdentity("/net/ndnsim/www/NDNS");
+  id = m_keyChain.createIdentity("/net/ndnsim/www/NDNS");
   cert = id.getDefaultKey().getDefaultCertificate();
   BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net",
                                       time::seconds(1), time::days(1), cert.getName()),
                     ndns::ManagementTool::Error);
 
-  id = addIdentity("/net/ndnsim/NDNS");
+  id = m_keyChain.createIdentity("/net/ndnsim/NDNS");
   cert = id.getDefaultKey().getDefaultCertificate();
   m_keyChain.deleteCertificate(id.getDefaultKey(), cert.getName());
   BOOST_CHECK_THROW(m_tool.createZone("/net/ndnsim", "/net",
diff --git a/tests/unit/ndns-label.cpp b/tests/unit/ndns-label.t.cpp
similarity index 94%
rename from tests/unit/ndns-label.cpp
rename to tests/unit/ndns-label.t.cpp
index cfd650c..90c7ee1 100644
--- a/tests/unit/ndns-label.cpp
+++ b/tests/unit/ndns-label.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California.
+/*
+ * Copyright (c) 2014-2020, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -19,7 +19,9 @@
 
 #include "ndns-label.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
+
+#include <ndn-cxx/data.hpp>
 
 namespace ndn {
 namespace ndns {
diff --git a/tests/unit/validator/certificate-fetcher-ndns-app-cert.cpp b/tests/unit/validator/certificate-fetcher-ndns-app-cert.t.cpp
similarity index 93%
rename from tests/unit/validator/certificate-fetcher-ndns-app-cert.cpp
rename to tests/unit/validator/certificate-fetcher-ndns-app-cert.t.cpp
index d425832..ae41eeb 100644
--- a/tests/unit/validator/certificate-fetcher-ndns-app-cert.cpp
+++ b/tests/unit/validator/certificate-fetcher-ndns-app-cert.t.cpp
@@ -17,18 +17,20 @@
  * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "validator/validator.hpp"
 #include "validator/certificate-fetcher-ndns-appcert.hpp"
+
 #include "ndns-label.hpp"
-#include "util/cert-helper.hpp"
 #include "daemon/name-server.hpp"
 #include "daemon/rrset-factory.hpp"
 #include "mgmt/management-tool.hpp"
+#include "util/cert-helper.hpp"
+#include "validator/validator.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
 #include "unit/database-test-data.hpp"
 
 #include <ndn-cxx/security/validation-policy-simple-hierarchy.hpp>
+#include <ndn-cxx/util/dummy-client-face.hpp>
 
 namespace ndn {
 namespace ndns {
@@ -39,7 +41,7 @@
 static unique_ptr<security::Validator>
 makeValidatorAppCert(Face& face)
 {
-  return make_unique<security::Validator>(make_unique<::ndn::security::ValidationPolicySimpleHierarchy>(),
+  return make_unique<security::Validator>(make_unique<security::ValidationPolicySimpleHierarchy>(),
                                           make_unique<CertificateFetcherAppCert>(face));
 }
 
@@ -54,7 +56,7 @@
     buildAppCertAndData();
 
     auto serverValidator = NdnsValidatorBuilder::create(m_validatorFace, 10, 0,
-                                                        TEST_CONFIG_PATH "/validator.conf");
+                                                        UNIT_TESTS_TMPDIR "/validator.conf");
     // initialize all servers
     auto addServer = [this, &serverValidator] (const Name& zoneName) {
       m_serverFaces.push_back(make_unique<util::DummyClientFace>(m_io, m_keyChain,
@@ -81,7 +83,7 @@
   buildAppCertAndData()
   {
     // create NDNS-stored certificate and the signed data
-    Identity ndnsimIdentity = addIdentity(m_ndnsimName);
+    Identity ndnsimIdentity = m_keyChain.createIdentity(m_ndnsimName);
     Key randomKey = m_keyChain.createKey(ndnsimIdentity);
     Certificate ndnsStoredAppCert = randomKey.getDefaultCertificate();
     RrsetFactory rf(TEST_DATABASE.string(), m_ndnsimName, m_keyChain,
diff --git a/tests/unit/validator/validator.cpp b/tests/unit/validator/validator.t.cpp
similarity index 97%
rename from tests/unit/validator/validator.cpp
rename to tests/unit/validator/validator.t.cpp
index 2948ae3..0161125 100644
--- a/tests/unit/validator/validator.cpp
+++ b/tests/unit/validator/validator.t.cpp
@@ -19,12 +19,14 @@
 
 #include "validator/validator.hpp"
 #include "ndns-label.hpp"
-#include "util/cert-helper.hpp"
 #include "daemon/name-server.hpp"
+#include "util/cert-helper.hpp"
 
-#include "test-common.hpp"
+#include "boost-test.hpp"
 #include "unit/database-test-data.hpp"
 
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
 namespace ndn {
 namespace ndns {
 namespace tests {
@@ -37,7 +39,7 @@
   ValidatorTestFixture()
     : m_validatorFace(m_io, m_keyChain, {true, true})
     , m_validator(NdnsValidatorBuilder::create(m_validatorFace, 500, 0,
-                                               TEST_CONFIG_PATH "/validator.conf"))
+                                               UNIT_TESTS_TMPDIR "/validator.conf"))
   {
     // generate a random cert
     // check how does name-server test do
diff --git a/tests/wscript b/tests/wscript
index 6249874..a0b5c2e 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -1,19 +1,17 @@
 # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-
 top = '..'
 
 def build(bld):
-    if not bld.env['WITH_TESTS']:
+    if not bld.env.WITH_TESTS:
         return
 
-    tmp_folder = bld.bldnode.make_node('tmp-files')
-    config_path = 'TEST_CONFIG_PATH="%s"' % tmp_folder
-    tmp_folder.make_node('anchors').mkdir()
+    tmpdir = bld.bldnode.make_node('tmp-files')
+    tmpdir.make_node('anchors').mkdir()
 
     bld(features='subst',
         name='test-validator-conf',
         source='../validator.conf.sample.in',
-        target=tmp_folder.make_node('validator.conf'),
+        target=tmpdir.make_node('validator.conf'),
         ANCHORPATH='\"anchors/root.cert\"')
 
     bld.objects(
@@ -21,11 +19,12 @@
         source='main.cpp',
         use='ndns-objects')
 
+    tmpdir_define = 'UNIT_TESTS_TMPDIR="%s"' % tmpdir
     bld.program(
         target='../unit-tests',
         name='unit-tests',
         source=bld.path.ant_glob('**/*.cpp', excl=['main.cpp']),
         use='ndns-objects unit-tests-main',
-        includes='../src .',
-        install_path=None,
-        defines=[config_path])
+        includes='.',
+        defines=[tmpdir_define],
+        install_path=None)
