diff --git a/tests/other/fw/congestion-mark-strategy.cpp b/tests/other/fw/congestion-mark-strategy.cpp
new file mode 100644
index 0000000..ea73d4e
--- /dev/null
+++ b/tests/other/fw/congestion-mark-strategy.cpp
@@ -0,0 +1,93 @@
+/* -*- 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 NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD 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.
+ *
+ * NFD 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
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "congestion-mark-strategy.hpp"
+
+#include <ndn-cxx/lp/tags.hpp>
+
+namespace nfd {
+namespace fw {
+
+NFD_LOG_INIT("CongestionMarkStrategy");
+NFD_REGISTER_STRATEGY(CongestionMarkStrategy);
+
+CongestionMarkStrategy::CongestionMarkStrategy(Forwarder& forwarder, const Name& name)
+  : BestRouteStrategy2(forwarder, name)
+  , m_congestionMark(1)
+  , m_shouldPreserveMark(true)
+{
+  ParsedInstanceName parsed = parseInstanceName(name);
+  switch (parsed.parameters.size()) {
+  case 2:
+    if (!parsed.parameters.at(1).isNumber()) {
+      BOOST_THROW_EXCEPTION(
+        std::invalid_argument("Second parameter to CongestionMarkStrategy must be a non-negative integer"));
+    }
+    m_shouldPreserveMark = parsed.parameters.at(1).toNumber() != 0;
+    NDN_CXX_FALLTHROUGH;
+  case 1:
+    if (!parsed.parameters.at(0).isNumber()) {
+      BOOST_THROW_EXCEPTION(
+        std::invalid_argument("First parameter to CongestionMarkStrategy must be a non-negative integer"));
+    }
+    m_congestionMark = parsed.parameters.at(0).toNumber();
+    NDN_CXX_FALLTHROUGH;
+  case 0:
+    break;
+  default:
+    BOOST_THROW_EXCEPTION(std::invalid_argument("CongestionMarkStrategy does not accept more than 2 parameters"));
+  }
+
+  if (parsed.version && *parsed.version != getStrategyName()[-1].toVersion()) {
+    BOOST_THROW_EXCEPTION(std::invalid_argument(
+      "CongestionMarkStrategy does not support version " + std::to_string(*parsed.version)));
+  }
+  this->setInstanceName(makeInstanceName(name, getStrategyName()));
+}
+
+const Name&
+CongestionMarkStrategy::getStrategyName()
+{
+  static Name strategyName("/localhost/nfd/strategy/congestion-mark/%FD%01");
+  return strategyName;
+}
+
+void
+CongestionMarkStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
+                                             const shared_ptr<pit::Entry>& pitEntry)
+{
+  auto mark = interest.getCongestionMark();
+  if (mark != m_congestionMark && (!m_shouldPreserveMark || mark == 0)) {
+    Interest markedInterest(interest);
+    markedInterest.setCongestionMark(m_congestionMark);
+    BestRouteStrategy2::afterReceiveInterest(inFace, markedInterest, pitEntry);
+  }
+  else {
+    BestRouteStrategy2::afterReceiveInterest(inFace, interest, pitEntry);
+  }
+}
+
+} // namespace fw
+} // namespace nfd
diff --git a/tests/other/fw/congestion-mark-strategy.hpp b/tests/other/fw/congestion-mark-strategy.hpp
new file mode 100644
index 0000000..e8c7326
--- /dev/null
+++ b/tests/other/fw/congestion-mark-strategy.hpp
@@ -0,0 +1,64 @@
+/* -*- 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 NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD 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.
+ *
+ * NFD 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
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_TESTS_OTHER_FW_CONGESTION_MARK_STRATEGY_HPP
+#define NFD_TESTS_OTHER_FW_CONGESTION_MARK_STRATEGY_HPP
+
+#include "daemon/fw/best-route-strategy2.hpp"
+
+namespace nfd {
+namespace fw {
+
+/** \brief Congestion Mark integration testing strategy version 1
+ *
+ *  This strategy adds a CongestionMark to each Interest it forwards. Otherwise, behaves like
+ *  BestRouteStrategy2.
+ *
+ *  The value of the added CongestionMark can be specified through a strategy parameter (defaults
+ *  to 1). In addition, an optional boolean parameter specifies whether the strategy will preserve
+ *  existing CongestionMarks (default) or replace them.
+ */
+class CongestionMarkStrategy : public BestRouteStrategy2
+{
+public:
+  explicit
+  CongestionMarkStrategy(Forwarder& forwarder, const Name& name = getStrategyName());
+
+  static const Name&
+  getStrategyName();
+
+  void
+  afterReceiveInterest(const Face& inFace, const Interest& interest,
+                       const shared_ptr<pit::Entry>& pitEntry) override;
+
+private:
+  uint64_t m_congestionMark;
+  bool m_shouldPreserveMark;
+};
+
+} // namespace fw
+} // namespace nfd
+
+#endif // NFD_TESTS_OTHER_FW_CONGESTION_MARK_STRATEGY_HPP
