diff --git a/src/lib/format/tests/BUILD.gn b/src/lib/format/tests/BUILD.gn
index 64be2e3..1001a3b 100644
--- a/src/lib/format/tests/BUILD.gn
+++ b/src/lib/format/tests/BUILD.gn
@@ -14,12 +14,11 @@
 
 import("//build_overrides/build.gni")
 import("//build_overrides/chip.gni")
-import("//build_overrides/nlunit_test.gni")
 
 import("${chip_root}/build/chip/chip_test_suite.gni")
 import("${chip_root}/build/chip/fuzz_test.gni")
 
-chip_test_suite_using_nltest("tests") {
+chip_test_suite("tests") {
   output_name = "libFormatTests"
 
   test_sources = [
@@ -40,8 +39,6 @@
     "${chip_root}/src/lib/format:flat-tree",
     "${chip_root}/src/lib/format:protocol-decoder",
     "${chip_root}/src/lib/format:protocol-tlv-metadata",
-    "${chip_root}/src/lib/support:testing_nlunit",
-    "${nlunit_test_root}:nlunit-test",
   ]
 }
 
diff --git a/src/lib/format/tests/TestDecoding.cpp b/src/lib/format/tests/TestDecoding.cpp
index 0a848e5..ae5c2ef 100644
--- a/src/lib/format/tests/TestDecoding.cpp
+++ b/src/lib/format/tests/TestDecoding.cpp
@@ -17,12 +17,11 @@
 #include <lib/core/TLVWriter.h>
 #include <lib/format/protocol_decoder.h>
 #include <lib/support/StringBuilder.h>
-#include <lib/support/UnitTestRegistration.h>
 
 #include <tlv/meta/clusters_meta.h>
 #include <tlv/meta/protocols_meta.h>
 
-#include <nlunit-test.h>
+#include <gtest/gtest.h>
 
 #include "sample_data.h"
 
@@ -57,8 +56,7 @@
     { 2, _FakeProtocolData },
 } };
 
-void TestSampleData(nlTestSuite * inSuite, const PayloadDecoderInitParams & params, const SamplePayload & data,
-                    const char * expectation)
+void TestSampleData(const PayloadDecoderInitParams & params, const SamplePayload & data, const char * expectation)
 {
     chip::Decoders::PayloadDecoder<64, 128> decoder(
         PayloadDecoderInitParams(params).SetProtocol(data.protocolId).SetMessageType(data.messageType));
@@ -130,23 +128,23 @@
         printf("ACTUAL: '%s'\n", partial.Reset().Add(output_builder.c_str() + idx).AddMarkerIfOverflow().c_str());
     }
 
-    NL_TEST_ASSERT(inSuite, strcmp(output_builder.c_str(), expectation) == 0);
+    EXPECT_STREQ(output_builder.c_str(), expectation);
 }
 
-void TestFullDataDecoding(nlTestSuite * inSuite, void * inContext)
+TEST(TestDecoding, TestFullDataDecoding)
 {
     PayloadDecoderInitParams params;
 
     params.SetProtocolDecodeTree(chip::TLVMeta::protocols_meta).SetClusterDecodeTree(chip::TLVMeta::clusters_meta);
 
-    TestSampleData(inSuite, params, secure_channel_mrp_ack, "mrp_ack: EMPTY\n");
-    TestSampleData(inSuite, params, secure_channel_pkbdf_param_request,
+    TestSampleData(params, secure_channel_mrp_ack, "mrp_ack: EMPTY\n");
+    TestSampleData(params, secure_channel_pkbdf_param_request,
                    "pbkdf_param_request\n"
                    "  initiator_random: hex:7C8698755B8E9866BB4FFDC27B733F3B6EF7F83D43FBE0CA6AD2B8C52C8F4236\n"
                    "  initiator_session_id: 37677\n"
                    "  passcode_id: 0\n"
                    "  has_pbkdf_parameters: false\n");
-    TestSampleData(inSuite, params, secure_channel_pkbdf_param_response,
+    TestSampleData(params, secure_channel_pkbdf_param_response,
                    "pbkdf_param_response\n"
                    "  initiator_random: hex:7C8698755B8E9866BB4FFDC27B733F3B6EF7F83D43FBE0CA6AD2B8C52C8F4236\n"
                    "  responder_random: hex:A44EB3E1A751A88A32BAB59EF16EB9764C20E1A9DDBEF6EFE3F588C943C58424\n"
@@ -154,24 +152,24 @@
                    "  pbkdf_parameters\n"
                    "    iterations: 1000\n"
                    "    salt: hex:E8FC1E6FD0023422B3CA7ECEDD344444551C814D3D0B0EB9C096F00E8A8051B2\n");
-    TestSampleData(inSuite, params, secure_channel_pase_pake1,
+    TestSampleData(params, secure_channel_pase_pake1,
                    // clang-format off
                    "pase_pake1\n"
                    "  pA: hex:0422ABC7A84352850456BD4A510905FE6BB782A0863A9382550E1228020801B22EEC4102C60F80082842B9739705FCD37F134651442A41E3723DFFE0...\n"
                    // clang-format on
     );
-    TestSampleData(inSuite, params, secure_channel_pase_pake2,
+    TestSampleData(params, secure_channel_pase_pake2,
                    // clang-format off
                    "pase_pake2\n"
                    "  pB: hex:04B6A44A3347C6B77900A3674CA19F40F25F056F8CB344EC1B4FA7888B9E6B570B7010431C5D0BE4021FE74A96C40721765FDA6802BE8DFDF5624332...\n"
                    "  cB: hex:40E7452275E38AEBAF0E0F6FAB33A1B0CB5AEB5E824230DD40D0071DC7E55C87\n"
                    // clang-format on
     );
-    TestSampleData(inSuite, params, secure_channel_pase_pake3,
+    TestSampleData(params, secure_channel_pase_pake3,
                    "pase_pake3\n"
                    "  cA: hex:6008C72EDEC9D25D4A36522F0BF23058F9378EFE38CBBCCE8C6853900169BC38\n");
-    TestSampleData(inSuite, params, secure_channel_status_report, "status_report: BINARY DATA\n");
-    TestSampleData(inSuite, params, im_protocol_read_request,
+    TestSampleData(params, secure_channel_status_report, "status_report: BINARY DATA\n");
+    TestSampleData(params, im_protocol_read_request,
                    "read_request\n"
                    "  attribute_requests\n"
                    "    Anonymous<>\n"
@@ -206,7 +204,7 @@
                    "      attribute_id: 3 == 'connectMaxTimeSeconds'\n"
                    "  fabric_filtered: false\n"
                    "  interaction_model_revison: 1\n");
-    TestSampleData(inSuite, params, im_protocol_report_data,
+    TestSampleData(params, im_protocol_report_data,
                    "report_data\n"
                    "  attribute_reports\n"
                    "    Anonymous<>\n"
@@ -279,7 +277,7 @@
                    "  interaction_model_revison: 1\n");
 
     // Different content
-    TestSampleData(inSuite, params, im_protocol_report_data_acl,
+    TestSampleData(params, im_protocol_report_data_acl,
                    "report_data\n"
                    "  attribute_reports\n"
                    "    Anonymous<>\n"
@@ -301,7 +299,7 @@
                    "  interaction_model_revison: 1\n");
 
     TestSampleData(
-        inSuite, params, im_protocol_report_data_window_covering,
+        params, im_protocol_report_data_window_covering,
         "report_data\n"
         "  attribute_reports\n"
         "    Anonymous<>\n"
@@ -315,7 +313,7 @@
         "  suppress_response: true\n"
         "  interaction_model_revison: 1\n");
 
-    TestSampleData(inSuite, params, im_protocol_invoke_request,
+    TestSampleData(params, im_protocol_invoke_request,
                    "invoke_request\n"
                    "  suppress_response: false\n"
                    "  timed_request: false\n"
@@ -328,7 +326,7 @@
                    "      OnOff::Toggle\n"
                    "  interaction_model_revison: 1\n");
 
-    TestSampleData(inSuite, params, im_protocol_invoke_response,
+    TestSampleData(params, im_protocol_invoke_response,
                    "invoke_response\n"
                    "  suppress_response: false\n"
                    "  invoke_responses\n"
@@ -342,7 +340,7 @@
                    "          status: 0 == kSuccess\n"
                    "  interaction_model_revison: 1\n");
 
-    TestSampleData(inSuite, params, im_protocol_invoke_request_change_channel,
+    TestSampleData(params, im_protocol_invoke_request_change_channel,
                    "invoke_request\n"
                    "  suppress_response: false\n"
                    "  timed_request: false\n"
@@ -356,7 +354,7 @@
                    "        match: \"channel name\"\n"
                    "  interaction_model_revison: 1\n");
 
-    TestSampleData(inSuite, params, im_protocol_event_software_fault,
+    TestSampleData(params, im_protocol_event_software_fault,
                    "report_data\n"
                    "  event_reports\n"
                    "    Anonymous<>\n"
@@ -375,7 +373,7 @@
                    "  suppress_response: true\n"
                    "  interaction_model_revison: 1\n");
 
-    TestSampleData(inSuite, params, im_protocol_event_multipress,
+    TestSampleData(params, im_protocol_event_multipress,
                    "report_data\n"
                    "  event_reports\n"
                    "    Anonymous<>\n"
@@ -394,22 +392,22 @@
                    "  interaction_model_revison: 1\n");
 }
 
-void TestMetaDataOnlyDecoding(nlTestSuite * inSuite, void * inContext)
+TEST(TestDecoding, TestMetaDataOnlyDecoding)
 {
     PayloadDecoderInitParams params;
 
     // NO CLUSTER DECODE TREE
     params.SetProtocolDecodeTree(chip::TLVMeta::protocols_meta);
 
-    TestSampleData(inSuite, params, secure_channel_mrp_ack, "mrp_ack: EMPTY\n");
-    TestSampleData(inSuite, params, secure_channel_pkbdf_param_request,
+    TestSampleData(params, secure_channel_mrp_ack, "mrp_ack: EMPTY\n");
+    TestSampleData(params, secure_channel_pkbdf_param_request,
                    "pbkdf_param_request\n"
                    "  initiator_random: hex:7C8698755B8E9866BB4FFDC27B733F3B6EF7F83D43FBE0CA6AD2B8C52C8F4236\n"
                    "  initiator_session_id: 37677\n"
                    "  passcode_id: 0\n"
                    "  has_pbkdf_parameters: false\n");
 
-    TestSampleData(inSuite, params, im_protocol_read_request,
+    TestSampleData(params, im_protocol_read_request,
                    "read_request\n"
                    "  attribute_requests\n"
                    "    Anonymous<>\n"
@@ -444,7 +442,7 @@
                    "      attribute_id: 3\n"
                    "  fabric_filtered: false\n"
                    "  interaction_model_revison: 1\n");
-    TestSampleData(inSuite, params, im_protocol_report_data,
+    TestSampleData(params, im_protocol_report_data,
                    "report_data\n"
                    "  attribute_reports\n"
                    "    Anonymous<>\n"
@@ -515,7 +513,7 @@
                    "  interaction_model_revison: 1\n");
 
     // Different content
-    TestSampleData(inSuite, params, im_protocol_report_data_acl,
+    TestSampleData(params, im_protocol_report_data_acl,
                    "report_data\n"
                    "  attribute_reports\n"
                    "    Anonymous<>\n"
@@ -530,14 +528,14 @@
                    "  interaction_model_revison: 1\n");
 }
 
-void TestEmptyClusterMetaDataDecode(nlTestSuite * inSuite, void * inContext)
+TEST(TestDecoding, TestEmptyClusterMetaDataDecode)
 {
     PayloadDecoderInitParams params;
 
     params.SetProtocolDecodeTree(chip::TLVMeta::protocols_meta).SetClusterDecodeTree(empty_meta);
 
-    TestSampleData(inSuite, params, secure_channel_mrp_ack, "mrp_ack: EMPTY\n");
-    TestSampleData(inSuite, params, im_protocol_report_data_acl,
+    TestSampleData(params, secure_channel_mrp_ack, "mrp_ack: EMPTY\n");
+    TestSampleData(params, im_protocol_report_data_acl,
                    "report_data\n"
                    "  attribute_reports\n"
                    "    Anonymous<>\n"
@@ -559,24 +557,24 @@
                    "  interaction_model_revison: 1\n");
 }
 
-void TestMissingDecodeData(nlTestSuite * inSuite, void * inContext)
+TEST(TestDecoding, TestMissingDecodeData)
 {
     PayloadDecoderInitParams params;
 
     params.SetProtocolDecodeTree(empty_meta).SetClusterDecodeTree(empty_meta);
 
-    TestSampleData(inSuite, params, secure_channel_mrp_ack, "PROTO(0x0, 0x10): UNKNOWN\n");
-    TestSampleData(inSuite, params, im_protocol_report_data_acl, "PROTO(0x1, 0x5): UNKNOWN\n");
+    TestSampleData(params, secure_channel_mrp_ack, "PROTO(0x0, 0x10): UNKNOWN\n");
+    TestSampleData(params, im_protocol_report_data_acl, "PROTO(0x1, 0x5): UNKNOWN\n");
 }
 
-void TestWrongDecodeData(nlTestSuite * inSuite, void * inContext)
+TEST(TestDecoding, TestWrongDecodeData)
 {
     PayloadDecoderInitParams params;
 
     params.SetProtocolDecodeTree(fake_protocols_meta).SetClusterDecodeTree(empty_meta);
 
-    TestSampleData(inSuite, params, secure_channel_mrp_ack, "proto16: EMPTY\n");
-    TestSampleData(inSuite, params, im_protocol_report_data_acl,
+    TestSampleData(params, secure_channel_mrp_ack, "proto16: EMPTY\n");
+    TestSampleData(params, im_protocol_report_data_acl,
                    "proto5\n"
                    "  ContextTag(0x1)\n"
                    "    AnonymousTag()\n"
@@ -598,7 +596,7 @@
                    "  ContextTag(0xFF): 1\n");
 }
 
-void TestNestingOverflow(nlTestSuite * inSuite, void * inContext)
+TEST(TestDecoding, TestNestingOverflow)
 {
     PayloadDecoderInitParams params;
     params.SetProtocolDecodeTree(fake_protocols_meta).SetClusterDecodeTree(empty_meta);
@@ -611,65 +609,62 @@
     chip::TLV::TLVType unusedType;
 
     // Protocols start with an anonymous tagged structure, after which lists can be of any tags
-    NL_TEST_ASSERT(inSuite, writer.StartContainer(AnonymousTag(), kTLVType_Structure, unusedType) == CHIP_NO_ERROR);
+    EXPECT_EQ(writer.StartContainer(AnonymousTag(), kTLVType_Structure, unusedType), CHIP_NO_ERROR);
 
     // nesting overflow here
     for (uint8_t i = 0; i < 32; i++)
     {
-        NL_TEST_ASSERT(inSuite, writer.StartContainer(ContextTag(i), kTLVType_List, unusedType) == CHIP_NO_ERROR);
+        EXPECT_EQ(writer.StartContainer(ContextTag(i), kTLVType_List, unusedType), CHIP_NO_ERROR);
     }
     // Go back to 24 (still too much nesting)
     for (uint8_t i = 0; i < 8; i++)
     {
-        NL_TEST_ASSERT(inSuite, writer.EndContainer(kTLVType_List) == CHIP_NO_ERROR);
+        EXPECT_EQ(writer.EndContainer(kTLVType_List), CHIP_NO_ERROR);
     }
     for (uint8_t i = 0; i < 4; i++)
     {
-        NL_TEST_ASSERT(
-            inSuite, writer.StartContainer(ContextTag(static_cast<uint8_t>(i + 0x10)), kTLVType_List, unusedType) == CHIP_NO_ERROR);
+        EXPECT_EQ(writer.StartContainer(ContextTag(static_cast<uint8_t>(i + 0x10)), kTLVType_List, unusedType), CHIP_NO_ERROR);
     }
     for (uint8_t i = 0; i < 4; i++)
     {
-        NL_TEST_ASSERT(inSuite, writer.EndContainer(kTLVType_List) == CHIP_NO_ERROR);
+        EXPECT_EQ(writer.EndContainer(kTLVType_List), CHIP_NO_ERROR);
     }
     // Go back to 8
     for (uint8_t i = 0; i < 16; i++)
     {
-        NL_TEST_ASSERT(inSuite, writer.EndContainer(kTLVType_List) == CHIP_NO_ERROR);
+        EXPECT_EQ(writer.EndContainer(kTLVType_List), CHIP_NO_ERROR);
     }
     for (uint8_t i = 0; i < 4; i++)
     {
-        NL_TEST_ASSERT(
-            inSuite, writer.StartContainer(ContextTag(static_cast<uint8_t>(i + 0x20)), kTLVType_List, unusedType) == CHIP_NO_ERROR);
+        EXPECT_EQ(writer.StartContainer(ContextTag(static_cast<uint8_t>(i + 0x20)), kTLVType_List, unusedType), CHIP_NO_ERROR);
     }
     for (uint8_t i = 0; i < 4; i++)
     {
-        NL_TEST_ASSERT(inSuite, writer.EndContainer(kTLVType_List) == CHIP_NO_ERROR);
+        EXPECT_EQ(writer.EndContainer(kTLVType_List), CHIP_NO_ERROR);
     }
     // Go back to 4
     for (uint8_t i = 0; i < 4; i++)
     {
-        NL_TEST_ASSERT(inSuite, writer.EndContainer(kTLVType_List) == CHIP_NO_ERROR);
+        EXPECT_EQ(writer.EndContainer(kTLVType_List), CHIP_NO_ERROR);
     }
     for (uint8_t i = 0; i < 4; i++)
     {
-        NL_TEST_ASSERT(
-            inSuite, writer.StartContainer(ContextTag(static_cast<uint8_t>(i + 0x30)), kTLVType_List, unusedType) == CHIP_NO_ERROR);
+        EXPECT_EQ(writer.StartContainer(ContextTag(static_cast<uint8_t>(i + 0x30)), kTLVType_List, unusedType), CHIP_NO_ERROR);
     }
     for (uint8_t i = 0; i < 4; i++)
     {
-        NL_TEST_ASSERT(inSuite, writer.EndContainer(kTLVType_List) == CHIP_NO_ERROR);
+        EXPECT_EQ(writer.EndContainer(kTLVType_List), CHIP_NO_ERROR);
     }
     // close everything
     for (uint8_t i = 0; i < 4; i++)
     {
-        NL_TEST_ASSERT(inSuite, writer.EndContainer(kTLVType_List) == CHIP_NO_ERROR);
+        EXPECT_EQ(writer.EndContainer(kTLVType_List), CHIP_NO_ERROR);
     }
-    NL_TEST_ASSERT(inSuite, writer.EndContainer(kTLVType_Structure) == CHIP_NO_ERROR);
+    EXPECT_EQ(writer.EndContainer(kTLVType_Structure), CHIP_NO_ERROR);
 
     SamplePayload fake_payload{ chip::Protocols::InteractionModel::Id, 5, chip::ByteSpan(data_buffer, writer.GetLengthWritten()) };
 
-    TestSampleData(inSuite, params, fake_payload,
+    TestSampleData(params, fake_payload,
                    "proto5\n"
                    "  ContextTag(0x0)\n"
                    "    ContextTag(0x1)\n"
@@ -696,24 +691,4 @@
                    "              ContextTag(0x32)\n"
                    "                ContextTag(0x33)\n");
 }
-
-const nlTest sTests[] = {
-    NL_TEST_DEF("TestFullDataDecoding", TestFullDataDecoding),                     //
-    NL_TEST_DEF("TestMetaDataOnlyDecoding", TestMetaDataOnlyDecoding),             //
-    NL_TEST_DEF("TestEmptyClusterMetaDataDecode", TestEmptyClusterMetaDataDecode), //
-    NL_TEST_DEF("TestMissingDecodeData", TestMissingDecodeData),                   //
-    NL_TEST_DEF("TestWrongDecodeData", TestWrongDecodeData),                       //
-    NL_TEST_DEF("TestNestingOverflow", TestNestingOverflow),                       //
-    NL_TEST_SENTINEL()                                                             //
-};
-
 } // namespace
-
-int TestDecode()
-{
-    nlTestSuite theSuite = { "TestDecode", sTests, nullptr, nullptr };
-    nlTestRunner(&theSuite, nullptr);
-    return nlTestRunnerStats(&theSuite);
-}
-
-CHIP_REGISTER_TEST_SUITE(TestDecode)
diff --git a/src/lib/format/tests/TestFlatTree.cpp b/src/lib/format/tests/TestFlatTree.cpp
index 8eebb98..fcf8e27 100644
--- a/src/lib/format/tests/TestFlatTree.cpp
+++ b/src/lib/format/tests/TestFlatTree.cpp
@@ -17,13 +17,12 @@
 #include <lib/format/FlatTree.h>
 
 #include <lib/core/TLVTags.h>
-#include <lib/support/UnitTestRegistration.h>
 
 #include <array>
 
 #include <string.h>
 
-#include <nlunit-test.h>
+#include <gtest/gtest.h>
 
 namespace {
 
@@ -82,43 +81,28 @@
     const char * mName;
 };
 
-void TestFlatTreeFind(nlTestSuite * inSuite, void * inContext)
+TEST(TestFlatTree, TestFlatTreeFind)
 {
-    NL_TEST_ASSERT(inSuite, strcmp(FindEntry(tree, 0, ByTag(ContextTag(1)))->data.name, "hello") == 0);
-    NL_TEST_ASSERT(inSuite, strcmp(FindEntry(tree, 0, ByTag(ContextTag(2)))->data.name, "world") == 0);
-    NL_TEST_ASSERT(inSuite, FindEntry(tree, 0, ByTag(ContextTag(3))) == nullptr);
+    EXPECT_STREQ(FindEntry(tree, 0, ByTag(ContextTag(1)))->data.name, "hello");
+    EXPECT_STREQ(FindEntry(tree, 0, ByTag(ContextTag(2)))->data.name, "world");
+    EXPECT_EQ(FindEntry(tree, 0, ByTag(ContextTag(3))), nullptr);
 
-    NL_TEST_ASSERT(inSuite, FindEntry(tree, 0, ByName("hello"))->data.tag == ContextTag(1));
-    NL_TEST_ASSERT(inSuite, FindEntry(tree, 0, ByName("world"))->data.tag == ContextTag(2));
-    NL_TEST_ASSERT(inSuite, FindEntry(tree, 0, ByName("foo")) == nullptr);
+    EXPECT_EQ(FindEntry(tree, 0, ByName("hello"))->data.tag, ContextTag(1));
+    EXPECT_EQ(FindEntry(tree, 0, ByName("world"))->data.tag, ContextTag(2));
+    EXPECT_EQ(FindEntry(tree, 0, ByName("foo")), nullptr);
 
-    NL_TEST_ASSERT(inSuite, FindEntry(tree, 1, ByTag(ContextTag(1))) == nullptr);
-    NL_TEST_ASSERT(inSuite, strcmp(FindEntry(tree, 1, ByTag(ProfileTag(234, 2)))->data.name, "b") == 0);
-    NL_TEST_ASSERT(inSuite, strcmp(FindEntry(tree, 1, ByTag(ProfileTag(345, 3)))->data.name, "c") == 0);
-    NL_TEST_ASSERT(inSuite, FindEntry(tree, 1, ByTag(AnonymousTag())) == nullptr);
+    EXPECT_EQ(FindEntry(tree, 1, ByTag(ContextTag(1))), nullptr);
+    EXPECT_STREQ(FindEntry(tree, 1, ByTag(ProfileTag(234, 2)))->data.name, "b");
+    EXPECT_STREQ(FindEntry(tree, 1, ByTag(ProfileTag(345, 3)))->data.name, "c");
+    EXPECT_EQ(FindEntry(tree, 1, ByTag(AnonymousTag())), nullptr);
 
-    NL_TEST_ASSERT(inSuite, FindEntry(tree, 2, ByTag(ContextTag(1))) == nullptr);
-    NL_TEST_ASSERT(inSuite, strcmp(FindEntry(tree, 2, ByTag(AnonymousTag()))->data.name, "foo") == 0);
+    EXPECT_EQ(FindEntry(tree, 2, ByTag(ContextTag(1))), nullptr);
+    EXPECT_STREQ(FindEntry(tree, 2, ByTag(AnonymousTag()))->data.name, "foo");
 
     // out of array
-    NL_TEST_ASSERT(inSuite, FindEntry(tree, 3, ByTag(AnonymousTag())) == nullptr);
-    NL_TEST_ASSERT(inSuite, FindEntry(tree, 100, ByTag(AnonymousTag())) == nullptr);
-    NL_TEST_ASSERT(inSuite, FindEntry(tree, 1000, ByTag(AnonymousTag())) == nullptr);
-    NL_TEST_ASSERT(inSuite, FindEntry(tree, 9999999, ByTag(AnonymousTag())) == nullptr);
+    EXPECT_EQ(FindEntry(tree, 3, ByTag(AnonymousTag())), nullptr);
+    EXPECT_EQ(FindEntry(tree, 100, ByTag(AnonymousTag())), nullptr);
+    EXPECT_EQ(FindEntry(tree, 1000, ByTag(AnonymousTag())), nullptr);
+    EXPECT_EQ(FindEntry(tree, 9999999, ByTag(AnonymousTag())), nullptr);
 }
-
-const nlTest sTests[] = {
-    NL_TEST_DEF("TestFlatTreeFind", TestFlatTreeFind), //
-    NL_TEST_SENTINEL()                                 //
-};
-
 } // namespace
-
-int TestFlatTree()
-{
-    nlTestSuite theSuite = { "FlatTree", sTests, nullptr, nullptr };
-    nlTestRunner(&theSuite, nullptr);
-    return nlTestRunnerStats(&theSuite);
-}
-
-CHIP_REGISTER_TEST_SUITE(TestFlatTree)
diff --git a/src/lib/format/tests/TestFlatTreePosition.cpp b/src/lib/format/tests/TestFlatTreePosition.cpp
index ee5f6b3..cf5a26e 100644
--- a/src/lib/format/tests/TestFlatTreePosition.cpp
+++ b/src/lib/format/tests/TestFlatTreePosition.cpp
@@ -18,14 +18,13 @@
 #include <lib/format/FlatTreePosition.h>
 
 #include <lib/core/TLVTags.h>
-#include <lib/support/UnitTestRegistration.h>
 
 #include <array>
 #include <vector>
 
 #include <string.h>
 
-#include <nlunit-test.h>
+#include <gtest/gtest.h>
 
 namespace {
 
@@ -94,16 +93,16 @@
 };
 
 #define ASSERT_HAS_NAME(p, n)                                                                                                      \
-    NL_TEST_ASSERT(inSuite, p.Get() != nullptr);                                                                                   \
-    NL_TEST_ASSERT(inSuite, strcmp(p.Get()->name, n) == 0)
+    EXPECT_NE(p.Get(), nullptr);                                                                                                   \
+    EXPECT_STREQ(p.Get()->name, n);
 
 #define ASSERT_HAS_CONTEXT_TAG(p, t)                                                                                               \
-    NL_TEST_ASSERT(inSuite, p.Get() != nullptr);                                                                                   \
-    NL_TEST_ASSERT(inSuite, p.Get()->tag == ContextTag(t))
+    EXPECT_NE(p.Get(), nullptr);                                                                                                   \
+    EXPECT_EQ(p.Get()->tag, ContextTag(t))
 
 #define ASSERT_HAS_PROFILE_TAG(p, a, b)                                                                                            \
-    NL_TEST_ASSERT(inSuite, p.Get() != nullptr);                                                                                   \
-    NL_TEST_ASSERT(inSuite, p.Get()->tag == ProfileTag(a, b))
+    EXPECT_NE(p.Get(), nullptr);                                                                                                   \
+    EXPECT_EQ(p.Get()->tag, ProfileTag(a, b))
 
 template <size_t N>
 std::vector<Tag> GetPath(Position<NamedTag, N> & position)
@@ -133,54 +132,54 @@
     return (v.size() == 3) && (v[0] == a) && (v[1] == b) && (v[2] == c);
 }
 
-void TestSimpleEnterExit(nlTestSuite * inSuite, void * inContext)
+TEST(TestFlatTreePosition, TestSimpleEnterExit)
 {
     Position<NamedTag, 10> position(tree.data(), tree.size());
 
     // at start, top of tree has no value
-    NL_TEST_ASSERT(inSuite, position.Get() == nullptr);
-    NL_TEST_ASSERT(inSuite, GetPath(position).empty());
+    EXPECT_EQ(position.Get(), nullptr);
+    EXPECT_TRUE(GetPath(position).empty());
 
     // Go to hello, try going to invalid 2x, then go back
     position.Enter(ByTag(ContextTag(1)));
     ASSERT_HAS_NAME(position, "hello");
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(1)));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(1)));
 
     position.Enter(ByTag(ContextTag(1)));
-    NL_TEST_ASSERT(inSuite, position.Get() == nullptr);
-    NL_TEST_ASSERT(inSuite, GetPath(position).empty());
+    EXPECT_EQ(position.Get(), nullptr);
+    EXPECT_TRUE(GetPath(position).empty());
     position.Enter(ByTag(ContextTag(1)));
-    NL_TEST_ASSERT(inSuite, position.Get() == nullptr);
+    EXPECT_EQ(position.Get(), nullptr);
     position.Exit();
-    NL_TEST_ASSERT(inSuite, position.Get() == nullptr);
+    EXPECT_EQ(position.Get(), nullptr);
     position.Exit();
-    NL_TEST_ASSERT(inSuite, position.Get() != nullptr);
+    ASSERT_NE(position.Get(), nullptr);
     ASSERT_HAS_NAME(position, "hello");
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(1)));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(1)));
     position.Exit();
-    NL_TEST_ASSERT(inSuite, position.Get() == nullptr);
+    EXPECT_EQ(position.Get(), nullptr);
 }
 
-void TestDeeperEnter(nlTestSuite * inSuite, void * inContext)
+TEST(TestFlatTreePosition, TestDeeperEnter)
 {
     Position<NamedTag, 10> position(tree.data(), tree.size());
 
-    NL_TEST_ASSERT(inSuite, position.Get() == nullptr);
+    EXPECT_EQ(position.Get(), nullptr);
 
     position.Enter(ByName("world"));
     ASSERT_HAS_CONTEXT_TAG(position, 2);
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(2)));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(2)));
 
     position.Enter(ByTag(ProfileTag(123, 1)));
     ASSERT_HAS_NAME(position, "a");
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(2), ProfileTag(123, 1)));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(2), ProfileTag(123, 1)));
 
     position.Enter(ByTag(AnonymousTag()));
-    NL_TEST_ASSERT(inSuite, position.Get() == nullptr);
-    NL_TEST_ASSERT(inSuite, GetPath(position).empty());
+    EXPECT_EQ(position.Get(), nullptr);
+    EXPECT_TRUE(GetPath(position).empty());
     position.Exit();
     ASSERT_HAS_NAME(position, "a");
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(2), ProfileTag(123, 1)));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(2), ProfileTag(123, 1)));
 
     position.Exit();
     ASSERT_HAS_NAME(position, "world");
@@ -190,30 +189,30 @@
 
     position.Enter(ByTag(AnonymousTag()));
     ASSERT_HAS_NAME(position, "foo");
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(2), ProfileTag(234, 2), AnonymousTag()));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(2), ProfileTag(234, 2), AnonymousTag()));
 
     // test some unknown
     for (int i = 0; i < 100; i++)
     {
         position.Enter(ByTag(AnonymousTag()));
-        NL_TEST_ASSERT(inSuite, position.Get() == nullptr);
-        NL_TEST_ASSERT(inSuite, GetPath(position).empty());
+        EXPECT_EQ(position.Get(), nullptr);
+        EXPECT_TRUE(GetPath(position).empty());
     }
     for (int i = 0; i < 100; i++)
     {
-        NL_TEST_ASSERT(inSuite, position.Get() == nullptr);
-        NL_TEST_ASSERT(inSuite, GetPath(position).empty());
+        EXPECT_EQ(position.Get(), nullptr);
+        EXPECT_TRUE(GetPath(position).empty());
         position.Exit();
     }
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(2), ProfileTag(234, 2), AnonymousTag()));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(2), ProfileTag(234, 2), AnonymousTag()));
     ASSERT_HAS_NAME(position, "foo");
     position.Exit();
 
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(2), ProfileTag(234, 2)));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(2), ProfileTag(234, 2)));
     ASSERT_HAS_NAME(position, "b");
     position.Exit();
 
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(2)));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(2)));
     ASSERT_HAS_NAME(position, "world");
 
     // root and stay there
@@ -221,15 +220,15 @@
     position.Exit();
     position.Exit();
     position.Exit();
-    NL_TEST_ASSERT(inSuite, GetPath(position).empty());
+    EXPECT_TRUE(GetPath(position).empty());
 
     // can still navigate from the root
     position.Enter(ByName("world"));
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(2)));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(2)));
     ASSERT_HAS_CONTEXT_TAG(position, 2);
 }
 
-void TestDescendLimit(nlTestSuite * inSuite, void * inContext)
+TEST(TestFlatTreePosition, TestDescendLimit)
 {
     Position<NamedTag, 2> position(tree.data(), tree.size());
 
@@ -241,34 +240,17 @@
 
     // only 2 positions can be remembered. Running out of space
     position.Enter(ByName("foo"));
-    NL_TEST_ASSERT(inSuite, position.Get() == nullptr);
-    NL_TEST_ASSERT(inSuite, GetPath(position).empty());
+    EXPECT_EQ(position.Get(), nullptr);
+    EXPECT_TRUE(GetPath(position).empty());
 
     position.Exit();
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(2), ProfileTag(234, 2)));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(2), ProfileTag(234, 2)));
     ASSERT_HAS_NAME(position, "b");
     ASSERT_HAS_PROFILE_TAG(position, 234, 2);
 
     position.Exit();
-    NL_TEST_ASSERT(inSuite, HasPath(GetPath(position), ContextTag(2)));
+    EXPECT_TRUE(HasPath(GetPath(position), ContextTag(2)));
     ASSERT_HAS_NAME(position, "world");
     ASSERT_HAS_CONTEXT_TAG(position, 2);
 }
-
-const nlTest sTests[] = {
-    NL_TEST_DEF("TestSimpleEnterExit", TestSimpleEnterExit), //
-    NL_TEST_DEF("TestDeeperEnter", TestDeeperEnter),         //
-    NL_TEST_DEF("TestDescendLimit", TestDescendLimit),       //
-    NL_TEST_SENTINEL()                                       //
-};
-
 } // namespace
-
-int TestFlatTreePosition()
-{
-    nlTestSuite theSuite = { "FlatTree", sTests, nullptr, nullptr };
-    nlTestRunner(&theSuite, nullptr);
-    return nlTestRunnerStats(&theSuite);
-}
-
-CHIP_REGISTER_TEST_SUITE(TestFlatTreePosition)
