diff --git a/src/BUILD.gn b/src/BUILD.gn
index d1dfcc7..01aae8a 100644
--- a/src/BUILD.gn
+++ b/src/BUILD.gn
@@ -106,7 +106,7 @@
       ]
 
       if (matter_enable_tracing_support &&
-          matter_trace_config == "multiplexed") {
+          matter_trace_config == "${chip_root}/src/tracing/multiplexed") {
         tests += [ "${chip_root}/src/tracing/tests" ]
       }
     }
diff --git a/src/tracing/tests/BUILD.gn b/src/tracing/tests/BUILD.gn
index 8f28b56..f6b4f13 100644
--- a/src/tracing/tests/BUILD.gn
+++ b/src/tracing/tests/BUILD.gn
@@ -19,8 +19,9 @@
 import("${chip_root}/build/chip/chip_test_suite.gni")
 import("${chip_root}/src/tracing/tracing_args.gni")
 
-if (matter_enable_tracing_support && matter_trace_config == "multiplexed") {
-  chip_test_suite_using_nltest("tests") {
+if (matter_enable_tracing_support &&
+    matter_trace_config == "${chip_root}/src/tracing/multiplexed") {
+  chip_test_suite("tests") {
     output_name = "libTracingTests"
 
     test_sources = [
diff --git a/src/tracing/tests/TestMetricEvents.cpp b/src/tracing/tests/TestMetricEvents.cpp
index 72e159d..916a002 100644
--- a/src/tracing/tests/TestMetricEvents.cpp
+++ b/src/tracing/tests/TestMetricEvents.cpp
@@ -13,12 +13,11 @@
  *    See the License for the specific language governing permissions and
  *    limitations under the License.
  */
+#include <gtest/gtest.h>
 #include <lib/support/UnitTestRegistration.h>
 #include <tracing/backend.h>
 #include <tracing/metric_event.h>
 
-#include <nlunit-test.h>
-
 #include <algorithm>
 #include <string>
 #include <vector>
@@ -74,56 +73,56 @@
     std::vector<MetricEvent> mMetricEvents;
 };
 
-void TestBasicMetricEvent(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestBasicMetricEvent)
 {
 
     {
         MetricEvent event(MetricEvent::Type::kInstantEvent, "instant_event");
-        NL_TEST_ASSERT(inSuite, event.type() == MetricEvent::Type::kInstantEvent);
-        NL_TEST_ASSERT(inSuite, std::string(event.key()) == std::string("instant_event"));
-        NL_TEST_ASSERT(inSuite, event.ValueType() == MetricEvent::Value::Type::kUndefined);
+        EXPECT_EQ(event.type(), MetricEvent::Type::kInstantEvent);
+        EXPECT_EQ(std::string(event.key()), std::string("instant_event"));
+        EXPECT_EQ(event.ValueType(), MetricEvent::Value::Type::kUndefined);
     }
 
     {
         MetricEvent event(MetricEvent::Type::kBeginEvent, "begin_event");
-        NL_TEST_ASSERT(inSuite, event.type() == MetricEvent::Type::kBeginEvent);
-        NL_TEST_ASSERT(inSuite, std::string(event.key()) == std::string("begin_event"));
-        NL_TEST_ASSERT(inSuite, event.ValueType() == MetricEvent::Value::Type::kUndefined);
+        EXPECT_EQ(event.type(), MetricEvent::Type::kBeginEvent);
+        EXPECT_EQ(std::string(event.key()), std::string("begin_event"));
+        EXPECT_EQ(event.ValueType(), MetricEvent::Value::Type::kUndefined);
     }
 
     {
         MetricEvent event(MetricEvent::Type::kEndEvent, "end_event");
-        NL_TEST_ASSERT(inSuite, event.type() == MetricEvent::Type::kEndEvent);
-        NL_TEST_ASSERT(inSuite, std::string(event.key()) == std::string("end_event"));
-        NL_TEST_ASSERT(inSuite, event.ValueType() == MetricEvent::Value::Type::kUndefined);
+        EXPECT_EQ(event.type(), MetricEvent::Type::kEndEvent);
+        EXPECT_EQ(std::string(event.key()), std::string("end_event"));
+        EXPECT_EQ(event.ValueType(), MetricEvent::Value::Type::kUndefined);
     }
 
     {
         MetricEvent event(MetricEvent::Type::kEndEvent, "end_event_with_int32_value", int32_t(42));
-        NL_TEST_ASSERT(inSuite, event.type() == MetricEvent::Type::kEndEvent);
-        NL_TEST_ASSERT(inSuite, std::string(event.key()) == std::string("end_event_with_int32_value"));
-        NL_TEST_ASSERT(inSuite, event.ValueType() == MetricEvent::Value::Type::kInt32);
-        NL_TEST_ASSERT(inSuite, event.ValueInt32() == 42);
+        EXPECT_EQ(event.type(), MetricEvent::Type::kEndEvent);
+        EXPECT_EQ(std::string(event.key()), std::string("end_event_with_int32_value"));
+        EXPECT_EQ(event.ValueType(), MetricEvent::Value::Type::kInt32);
+        EXPECT_EQ(event.ValueInt32(), 42);
     }
 
     {
         MetricEvent event(MetricEvent::Type::kEndEvent, "end_event_with_uint32_value", uint32_t(42));
-        NL_TEST_ASSERT(inSuite, event.type() == MetricEvent::Type::kEndEvent);
-        NL_TEST_ASSERT(inSuite, std::string(event.key()) == std::string("end_event_with_uint32_value"));
-        NL_TEST_ASSERT(inSuite, event.ValueType() == MetricEvent::Value::Type::kUInt32);
-        NL_TEST_ASSERT(inSuite, event.ValueUInt32() == 42u);
+        EXPECT_EQ(event.type(), MetricEvent::Type::kEndEvent);
+        EXPECT_EQ(std::string(event.key()), std::string("end_event_with_uint32_value"));
+        EXPECT_EQ(event.ValueType(), MetricEvent::Value::Type::kUInt32);
+        EXPECT_EQ(event.ValueUInt32(), 42u);
     }
 
     {
         MetricEvent event(MetricEvent::Type::kEndEvent, "end_event_with_error_value", CHIP_ERROR_BUSY);
-        NL_TEST_ASSERT(inSuite, event.type() == MetricEvent::Type::kEndEvent);
-        NL_TEST_ASSERT(inSuite, std::string(event.key()) == std::string("end_event_with_error_value"));
-        NL_TEST_ASSERT(inSuite, event.ValueType() == MetricEvent::Value::Type::kChipErrorCode);
-        NL_TEST_ASSERT(inSuite, chip::ChipError(event.ValueErrorCode()) == CHIP_ERROR_BUSY);
+        EXPECT_EQ(event.type(), MetricEvent::Type::kEndEvent);
+        EXPECT_EQ(std::string(event.key()), std::string("end_event_with_error_value"));
+        EXPECT_EQ(event.ValueType(), MetricEvent::Value::Type::kChipErrorCode);
+        EXPECT_EQ(chip::ChipError(event.ValueErrorCode()), CHIP_ERROR_BUSY);
     }
 }
 
-void TestInstantMetricEvent(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestInstantMetricEvent)
 {
     MetricEventBackend backend;
 
@@ -141,12 +140,11 @@
         MetricEvent(MetricEvent::Type::kInstantEvent, "event3"),
     };
 
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
-void TestBeginEndMetricEvent(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestBeginEndMetricEvent)
 {
     MetricEventBackend backend1;
     MetricEventBackend backend2;
@@ -168,9 +166,8 @@
             MetricEvent(MetricEvent::Type::kEndEvent, "event1"),
         };
 
-        NL_TEST_ASSERT(inSuite, backend1.GetMetricEvents().size() == expected1.size());
-        NL_TEST_ASSERT(
-            inSuite,
+        EXPECT_EQ(backend1.GetMetricEvents().size(), expected1.size());
+        EXPECT_TRUE(
             std::equal(backend1.GetMetricEvents().begin(), backend1.GetMetricEvents().end(), expected1.begin(), expected1.end()));
 
         {
@@ -197,14 +194,13 @@
             MetricEvent(MetricEvent::Type::kEndEvent, "event4"),
         };
 
-        NL_TEST_ASSERT(inSuite, backend2.GetMetricEvents().size() == expected2.size());
-        NL_TEST_ASSERT(
-            inSuite,
+        EXPECT_EQ(backend2.GetMetricEvents().size(), expected2.size());
+        EXPECT_TRUE(
             std::equal(backend2.GetMetricEvents().begin(), backend2.GetMetricEvents().end(), expected2.begin(), expected2.end()));
     }
 }
 
-void TestScopedMetricEvent(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestScopedMetricEvent)
 {
     MetricEventBackend backend1;
     MetricEventBackend backend2;
@@ -247,9 +243,8 @@
             MetricEvent(MetricEvent::Type::kEndEvent, "event1", CHIP_ERROR_BUSY),
         };
 
-        NL_TEST_ASSERT(inSuite, backend1.GetMetricEvents().size() == expected1.size());
-        NL_TEST_ASSERT(
-            inSuite,
+        EXPECT_EQ(backend1.GetMetricEvents().size(), expected1.size());
+        EXPECT_TRUE(
             std::equal(backend1.GetMetricEvents().begin(), backend1.GetMetricEvents().end(), expected1.begin(), expected1.end()));
 
         std::vector<MetricEvent> expected2 = {
@@ -261,9 +256,8 @@
             MetricEvent(MetricEvent::Type::kEndEvent, "event2", CHIP_ERROR_BAD_REQUEST),
         };
 
-        NL_TEST_ASSERT(inSuite, backend2.GetMetricEvents().size() == expected2.size());
-        NL_TEST_ASSERT(
-            inSuite,
+        EXPECT_EQ(backend2.GetMetricEvents().size(), expected2.size());
+        EXPECT_TRUE(
             std::equal(backend2.GetMetricEvents().begin(), backend2.GetMetricEvents().end(), expected2.begin(), expected2.end()));
 
         std::vector<MetricEvent> expected3 = {
@@ -271,9 +265,8 @@
             MetricEvent(MetricEvent::Type::kEndEvent, "event3", CHIP_ERROR_EVENT_ID_FOUND),
         };
 
-        NL_TEST_ASSERT(inSuite, backend3.GetMetricEvents().size() == expected3.size());
-        NL_TEST_ASSERT(
-            inSuite,
+        EXPECT_EQ(backend3.GetMetricEvents().size(), expected3.size());
+        EXPECT_TRUE(
             std::equal(backend3.GetMetricEvents().begin(), backend3.GetMetricEvents().end(), expected3.begin(), expected3.end()));
     }
 }
@@ -283,7 +276,7 @@
     return input * 2;
 }
 
-void TestVerifyOrExitWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestVerifyOrExitWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
@@ -297,13 +290,12 @@
         MetricEvent(MetricEvent::Type::kInstantEvent, "event1", CHIP_ERROR_INCORRECT_STATE),
     };
 
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INCORRECT_STATE);
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(err, CHIP_ERROR_INCORRECT_STATE);
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
-void TestSuccessOrExitWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestSuccessOrExitWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
@@ -318,10 +310,9 @@
         MetricEvent(MetricEvent::Type::kInstantEvent, "event2", CHIP_ERROR_BUSY),
     };
 
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BUSY);
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(err, CHIP_ERROR_BUSY);
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
 static CHIP_ERROR InvokeReturnErrorOnFailureWithMetric(MetricKey key, const CHIP_ERROR & error)
@@ -330,28 +321,27 @@
     return CHIP_NO_ERROR;
 }
 
-void TestReturnErrorOnFailureWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestReturnErrorOnFailureWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
 
     CHIP_ERROR err = InvokeReturnErrorOnFailureWithMetric("event0", CHIP_NO_ERROR);
-    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+    EXPECT_EQ(err, CHIP_NO_ERROR);
 
     err = InvokeReturnErrorOnFailureWithMetric("event1", CHIP_ERROR_INCORRECT_STATE);
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INCORRECT_STATE);
+    EXPECT_EQ(err, CHIP_ERROR_INCORRECT_STATE);
 
     err = InvokeReturnErrorOnFailureWithMetric("event2", CHIP_ERROR_BAD_REQUEST);
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BAD_REQUEST);
+    EXPECT_EQ(err, CHIP_ERROR_BAD_REQUEST);
 
     std::vector<MetricEvent> expected = {
         MetricEvent(MetricEvent::Type::kInstantEvent, "event1", CHIP_ERROR_INCORRECT_STATE),
         MetricEvent(MetricEvent::Type::kInstantEvent, "event2", CHIP_ERROR_BAD_REQUEST),
     };
 
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
 static CHIP_ERROR InvokeReturnLogErrorOnFailureWithMetric(MetricKey key, const CHIP_ERROR & error)
@@ -360,28 +350,27 @@
     return CHIP_NO_ERROR;
 }
 
-void TestReturnLogErrorOnFailureWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestReturnLogErrorOnFailureWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
 
     CHIP_ERROR err = InvokeReturnLogErrorOnFailureWithMetric("event0", CHIP_NO_ERROR);
-    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+    EXPECT_EQ(err, CHIP_NO_ERROR);
 
     err = InvokeReturnLogErrorOnFailureWithMetric("event1", CHIP_ERROR_INCORRECT_STATE);
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INCORRECT_STATE);
+    EXPECT_EQ(err, CHIP_ERROR_INCORRECT_STATE);
 
     err = InvokeReturnLogErrorOnFailureWithMetric("event2", CHIP_ERROR_BAD_REQUEST);
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BAD_REQUEST);
+    EXPECT_EQ(err, CHIP_ERROR_BAD_REQUEST);
 
     std::vector<MetricEvent> expected = {
         MetricEvent(MetricEvent::Type::kInstantEvent, "event1", CHIP_ERROR_INCORRECT_STATE),
         MetricEvent(MetricEvent::Type::kInstantEvent, "event2", CHIP_ERROR_BAD_REQUEST),
     };
 
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
 static void InvokeReturnOnFailureWithMetric(MetricKey key, const CHIP_ERROR & error)
@@ -390,7 +379,7 @@
     return;
 }
 
-void TestReturnOnFailureWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestReturnOnFailureWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
@@ -406,9 +395,8 @@
         MetricEvent(MetricEvent::Type::kInstantEvent, "event2", CHIP_ERROR_BAD_REQUEST),
     };
 
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
 static void InvokeVerifyOrReturnWithMetric(MetricKey key, bool result)
@@ -417,7 +405,7 @@
     return;
 }
 
-void TestInvokeVerifyOrReturnWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestInvokeVerifyOrReturnWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
@@ -432,9 +420,8 @@
         MetricEvent(MetricEvent::Type::kInstantEvent, "event3", false),
     };
 
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
 static CHIP_ERROR InvokeVerifyOrReturnErrorWithMetric(MetricKey key, bool expr, const CHIP_ERROR & error)
@@ -443,31 +430,30 @@
     return CHIP_NO_ERROR;
 }
 
-void TestVerifyOrReturnErrorWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestVerifyOrReturnErrorWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
 
     CHIP_ERROR err = InvokeVerifyOrReturnErrorWithMetric("event0", DoubleOf(2) == 4, CHIP_ERROR_BAD_REQUEST);
-    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+    EXPECT_EQ(err, CHIP_NO_ERROR);
 
     err = InvokeVerifyOrReturnErrorWithMetric("event1", DoubleOf(3) == 9, CHIP_ERROR_ACCESS_DENIED);
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_ACCESS_DENIED);
+    EXPECT_EQ(err, CHIP_ERROR_ACCESS_DENIED);
 
     err = InvokeVerifyOrReturnErrorWithMetric("event2", DoubleOf(4) == 8, CHIP_ERROR_BUSY);
-    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+    EXPECT_EQ(err, CHIP_NO_ERROR);
 
     err = InvokeVerifyOrReturnErrorWithMetric("event3", DoubleOf(5) == 11, CHIP_ERROR_CANCELLED);
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_CANCELLED);
+    EXPECT_EQ(err, CHIP_ERROR_CANCELLED);
 
     std::vector<MetricEvent> expected = {
         MetricEvent(MetricEvent::Type::kInstantEvent, "event1", CHIP_ERROR_ACCESS_DENIED),
         MetricEvent(MetricEvent::Type::kInstantEvent, "event3", CHIP_ERROR_CANCELLED),
     };
 
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
 template <typename return_code_type>
@@ -477,31 +463,30 @@
     return return_code_type();
 }
 
-void TestVerifyOrReturnValueWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestVerifyOrReturnValueWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
 
     auto retval = InvokeVerifyOrReturnValueWithMetric("event0", DoubleOf(2) == 4, 0);
-    NL_TEST_ASSERT(inSuite, retval == 0);
+    EXPECT_EQ(retval, 0);
 
     auto err = InvokeVerifyOrReturnValueWithMetric("event1", DoubleOf(3) == 9, CHIP_ERROR_ACCESS_DENIED);
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_ACCESS_DENIED);
+    EXPECT_EQ(err, CHIP_ERROR_ACCESS_DENIED);
 
     err = InvokeVerifyOrReturnValueWithMetric("event2", DoubleOf(4) == 8, CHIP_ERROR_BAD_REQUEST);
-    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+    EXPECT_EQ(err, CHIP_NO_ERROR);
 
     retval = InvokeVerifyOrReturnValueWithMetric("event3", DoubleOf(5) == 11, 16);
-    NL_TEST_ASSERT(inSuite, retval == 16);
+    EXPECT_EQ(retval, 16);
 
     std::vector<MetricEvent> expected = {
         MetricEvent(MetricEvent::Type::kInstantEvent, "event1", CHIP_ERROR_ACCESS_DENIED),
         MetricEvent(MetricEvent::Type::kInstantEvent, "event3", 16),
     };
 
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
 static CHIP_ERROR InvokeVerifyOrReturnLogErrorWithMetric(MetricKey key, bool expr, const CHIP_ERROR & error)
@@ -510,31 +495,30 @@
     return CHIP_NO_ERROR;
 }
 
-void TestVerifyOrReturnLogErrorWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestVerifyOrReturnLogErrorWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
 
     auto err = InvokeVerifyOrReturnLogErrorWithMetric("event0", DoubleOf(2) == 4, CHIP_NO_ERROR);
-    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+    EXPECT_EQ(err, CHIP_NO_ERROR);
 
     err = InvokeVerifyOrReturnLogErrorWithMetric("event1", DoubleOf(3) == 9, CHIP_ERROR_CANCELLED);
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_CANCELLED);
+    EXPECT_EQ(err, CHIP_ERROR_CANCELLED);
 
     err = InvokeVerifyOrReturnLogErrorWithMetric("event2", DoubleOf(4) == 8, CHIP_NO_ERROR);
-    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+    EXPECT_EQ(err, CHIP_NO_ERROR);
 
     err = InvokeVerifyOrReturnLogErrorWithMetric("event3", DoubleOf(5) == 11, CHIP_ERROR_BAD_REQUEST);
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BAD_REQUEST);
+    EXPECT_EQ(err, CHIP_ERROR_BAD_REQUEST);
 
     std::vector<MetricEvent> expected = {
         MetricEvent(MetricEvent::Type::kInstantEvent, "event1", CHIP_ERROR_CANCELLED),
         MetricEvent(MetricEvent::Type::kInstantEvent, "event3", CHIP_ERROR_BAD_REQUEST),
     };
 
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
 template <typename return_code_type>
@@ -544,34 +528,33 @@
     return return_code_type();
 }
 
-void TestReturnErrorCodeWithMetricIf(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestReturnErrorCodeWithMetricIf)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
 
     auto err = InvokeReturnErrorCodeWithMetricIf("event0", DoubleOf(2) == 4, CHIP_ERROR_DUPLICATE_KEY_ID);
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_DUPLICATE_KEY_ID);
+    EXPECT_EQ(err, CHIP_ERROR_DUPLICATE_KEY_ID);
 
     auto retval = InvokeReturnErrorCodeWithMetricIf("event1", DoubleOf(3) == 9, 11);
-    NL_TEST_ASSERT(inSuite, retval == 0);
+    EXPECT_EQ(retval, 0);
 
     retval = InvokeReturnErrorCodeWithMetricIf("event2", DoubleOf(4) == 8, 22);
-    NL_TEST_ASSERT(inSuite, retval == 22);
+    EXPECT_EQ(retval, 22);
 
     err = InvokeReturnErrorCodeWithMetricIf("event3", DoubleOf(5) == 11, CHIP_ERROR_ACCESS_DENIED);
-    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+    EXPECT_EQ(err, CHIP_NO_ERROR);
 
     std::vector<MetricEvent> expected = {
         MetricEvent(MetricEvent::Type::kInstantEvent, "event0", CHIP_ERROR_DUPLICATE_KEY_ID),
         MetricEvent(MetricEvent::Type::kInstantEvent, "event2", 22),
     };
 
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
-void TestExitNowWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestExitNowWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
@@ -584,13 +567,12 @@
         MetricEvent(MetricEvent::Type::kInstantEvent, "event0"),
     };
 
-    NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BUSY);
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(err, CHIP_ERROR_BUSY);
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
-void TestLogErrorOnFailureWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestLogErrorOnFailureWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
@@ -606,12 +588,11 @@
         MetricEvent(MetricEvent::Type::kInstantEvent, "event3", CHIP_ERROR_BUSY),
     };
 
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
-void TestVerifyOrDoWithMetric(nlTestSuite * inSuite, void * inContext)
+TEST(TestMetricEvents, TestVerifyOrDoWithMetric)
 {
     MetricEventBackend backend;
     ScopedRegistration scope(backend);
@@ -629,41 +610,8 @@
         MetricEvent(MetricEvent::Type::kInstantEvent, "event3", false),
     };
 
-    NL_TEST_ASSERT(inSuite, backend.GetMetricEvents().size() == expected.size());
-    NL_TEST_ASSERT(
-        inSuite, std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.GetMetricEvents().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.GetMetricEvents().begin(), backend.GetMetricEvents().end(), expected.begin(), expected.end()));
 }
 
-static const nlTest sMetricTests[] = {
-    NL_TEST_DEF("BasicMetricEvent", TestBasicMetricEvent),                                   //
-    NL_TEST_DEF("InstantMetricEvent", TestInstantMetricEvent),                               //
-    NL_TEST_DEF("BeginEndMetricEvent", TestBeginEndMetricEvent),                             //
-    NL_TEST_DEF("ScopedMetricEvent", TestScopedMetricEvent),                                 //
-    NL_TEST_DEF("VerifyOrExitWithMetric", TestVerifyOrExitWithMetric),                       //
-    NL_TEST_DEF("SuccessOrExitWithMetric", TestSuccessOrExitWithMetric),                     //
-    NL_TEST_DEF("ReturnErrorOnFailureWithMetric", TestReturnErrorOnFailureWithMetric),       //
-    NL_TEST_DEF("ReturnLogErrorOnFailureWithMetric", TestReturnLogErrorOnFailureWithMetric), //
-    NL_TEST_DEF("ReturnOnFailureWithMetric", TestReturnOnFailureWithMetric),                 //
-    NL_TEST_DEF("VerifyOrReturnWithMetric", TestInvokeVerifyOrReturnWithMetric),             //
-    NL_TEST_DEF("VerifyOrReturnErrorWithMetric", TestVerifyOrReturnErrorWithMetric),         //
-    NL_TEST_DEF("VerifyOrReturnValueWithMetric", TestVerifyOrReturnValueWithMetric),         //
-    NL_TEST_DEF("VerifyOrReturnLogErrorWithMetric", TestVerifyOrReturnLogErrorWithMetric),   //
-    NL_TEST_DEF("ReturnErrorCodeWithMetricIf", TestReturnErrorCodeWithMetricIf),             //
-    NL_TEST_DEF("ExitNowWithMetric", TestExitNowWithMetric),                                 //
-    NL_TEST_DEF("LogErrorOnFailureWithMetric", TestLogErrorOnFailureWithMetric),             //
-    NL_TEST_DEF("VerifyOrDoWithMetric", TestVerifyOrDoWithMetric),                           //
-    NL_TEST_SENTINEL()                                                                       //
-};
-
 } // namespace
-
-int TestMetricEvents()
-{
-    nlTestSuite theSuite = { "Metric event tests", &sMetricTests[0], nullptr, nullptr };
-
-    // Run test suite against one context.
-    nlTestRunner(&theSuite, nullptr);
-    return nlTestRunnerStats(&theSuite);
-}
-
-CHIP_REGISTER_TEST_SUITE(TestMetricEvents)
diff --git a/src/tracing/tests/TestTracing.cpp b/src/tracing/tests/TestTracing.cpp
index 61cf07d..88d2a10 100644
--- a/src/tracing/tests/TestTracing.cpp
+++ b/src/tracing/tests/TestTracing.cpp
@@ -13,11 +13,11 @@
  *    See the License for the specific language governing permissions and
  *    limitations under the License.
  */
+#include <gtest/gtest.h>
 #include <lib/support/UnitTestRegistration.h>
 #include <tracing/backend.h>
 #include <tracing/macros.h>
-
-#include <nlunit-test.h>
+#include <tracing/registry.h>
 
 #include <algorithm>
 #include <string>
@@ -52,7 +52,7 @@
     std::vector<std::string> mTraces;
 };
 
-void TestBasicTracing(nlTestSuite * inSuite, void * inContext)
+TEST(TestTracing, TestBasicTracing)
 {
     LoggingTraceBackend backend;
 
@@ -80,11 +80,11 @@
         "END:Group:C",   "END:Group:B",   "BEGIN:Group:E", "END:Group:E",   "END:Group:A",
     };
 
-    NL_TEST_ASSERT(inSuite, backend.traces().size() == expected.size());
-    NL_TEST_ASSERT(inSuite, std::equal(backend.traces().begin(), backend.traces().end(), expected.begin(), expected.end()));
+    EXPECT_EQ(backend.traces().size(), expected.size());
+    EXPECT_TRUE(std::equal(backend.traces().begin(), backend.traces().end(), expected.begin(), expected.end()));
 }
 
-void TestMultipleBackends(nlTestSuite * inSuite, void * inContext)
+TEST(TestTracing, TestMultipleBackends)
 {
     LoggingTraceBackend b1;
     LoggingTraceBackend b2;
@@ -112,40 +112,23 @@
         "BEGIN:G:1", "BEGIN:G:2", "BEGIN:G:3", "END:G:3", "BEGIN:G:4", "END:G:4", "END:G:2", "END:G:1",
     };
 
-    NL_TEST_ASSERT(inSuite, b1.traces().size() == expected1.size());
-    NL_TEST_ASSERT(inSuite, std::equal(b1.traces().begin(), b1.traces().end(), expected1.begin(), expected1.end()));
+    EXPECT_EQ(b1.traces().size(), expected1.size());
+    EXPECT_TRUE(std::equal(b1.traces().begin(), b1.traces().end(), expected1.begin(), expected1.end()));
 
     std::vector<std::string> expected2 = {
         "BEGIN:G:2", "BEGIN:G:3", "END:G:3", "BEGIN:G:4", "END:G:4", "END:G:2",
     };
 
-    NL_TEST_ASSERT(inSuite, b2.traces().size() == expected2.size());
-    NL_TEST_ASSERT(inSuite, std::equal(b2.traces().begin(), b2.traces().end(), expected2.begin(), expected2.end()));
+    EXPECT_EQ(b2.traces().size(), expected2.size());
+    EXPECT_TRUE(std::equal(b2.traces().begin(), b2.traces().end(), expected2.begin(), expected2.end()));
 
     std::vector<std::string> expected3 = {
         "BEGIN:G:3",
         "END:G:3",
     };
 
-    NL_TEST_ASSERT(inSuite, b3.traces().size() == expected3.size());
-    NL_TEST_ASSERT(inSuite, std::equal(b3.traces().begin(), b3.traces().end(), expected3.begin(), expected3.end()));
+    EXPECT_EQ(b3.traces().size(), expected3.size());
+    EXPECT_TRUE(std::equal(b3.traces().begin(), b3.traces().end(), expected3.begin(), expected3.end()));
 }
 
-const nlTest sTests[] = {
-    NL_TEST_DEF("BasicTracing", TestBasicTracing),              //
-    NL_TEST_DEF("BasicMultipleBackends", TestMultipleBackends), //
-    NL_TEST_SENTINEL()                                          //
-};
-
 } // namespace
-
-int TestTracing()
-{
-    nlTestSuite theSuite = { "Tracing tests", &sTests[0], nullptr, nullptr };
-
-    // Run test suite against one context.
-    nlTestRunner(&theSuite, nullptr);
-    return nlTestRunnerStats(&theSuite);
-}
-
-CHIP_REGISTER_TEST_SUITE(TestTracing)
