diff --git a/test/bej_decoder_test.cpp b/test/bej_decoder_test.cpp
index b390017..16cd19a 100644
--- a/test/bej_decoder_test.cpp
+++ b/test/bej_decoder_test.cpp
@@ -1,11 +1,7 @@
+#include "bej_common_test.hpp"
 #include "bej_decoder_json.hpp"
-#include "nlohmann/json.hpp"
 
-#include <fstream>
-#include <iostream>
 #include <memory>
-#include <optional>
-#include <span>
 #include <string_view>
 
 #include <gmock/gmock-matchers.h>
@@ -15,24 +11,6 @@
 namespace libbej
 {
 
-struct BejTestInputFiles
-{
-    const char* jsonFile;
-    const char* schemaDictionaryFile;
-    const char* annotationDictionaryFile;
-    const char* errorDictionaryFile;
-    const char* encodedStreamFile;
-};
-
-struct BejTestInputs
-{
-    const nlohmann::json expectedJson;
-    const uint8_t* schemaDictionary;
-    const uint8_t* annotationDictionary;
-    const uint8_t* errorDictionary;
-    std::span<const uint8_t> encodedStream;
-};
-
 struct BejDecoderTestParams
 {
     const std::string testName;
@@ -73,82 +51,6 @@
     .encodedStreamFile = "../test/encoded/dummy_simple_enc.bin",
 };
 
-// Buffer size for storing a single binary file data.
-constexpr uint32_t maxBufferSize = 16 * 1024;
-
-std::streamsize readBinaryFile(const char* fileName, std::span<uint8_t> buffer)
-{
-    std::ifstream inputStream(fileName, std::ios::binary);
-    if (!inputStream.is_open())
-    {
-        std::cerr << "Cannot open file: " << fileName << "\n";
-        return 0;
-    }
-    auto readLength = inputStream.readsome(
-        reinterpret_cast<char*>(buffer.data()), buffer.size_bytes());
-    if (inputStream.peek() != EOF)
-    {
-        std::cerr << "Failed to read the complete file: " << fileName
-                  << "  read length: " << readLength << "\n";
-        return 0;
-    }
-    return readLength;
-}
-
-std::optional<BejTestInputs> loadInputs(const BejTestInputFiles& files,
-                                        bool readErrorDictionary = false)
-{
-    std::ifstream jsonInput(files.jsonFile);
-    if (!jsonInput.is_open())
-    {
-        std::cerr << "Cannot open file: " << files.jsonFile << "\n";
-        return std::nullopt;
-    }
-    nlohmann::json expJson;
-    jsonInput >> expJson;
-
-    static uint8_t schemaDictBuffer[maxBufferSize];
-    if (readBinaryFile(files.schemaDictionaryFile,
-                       std::span(schemaDictBuffer, maxBufferSize)) == 0)
-    {
-        return std::nullopt;
-    }
-
-    static uint8_t annoDictBuffer[maxBufferSize];
-    if (readBinaryFile(files.annotationDictionaryFile,
-                       std::span(annoDictBuffer, maxBufferSize)) == 0)
-    {
-        return std::nullopt;
-    }
-
-    static uint8_t encBuffer[maxBufferSize];
-    auto encLen = readBinaryFile(files.encodedStreamFile,
-                                 std::span(encBuffer, maxBufferSize));
-    if (encLen == 0)
-    {
-        return std::nullopt;
-    }
-
-    static uint8_t errorDict[maxBufferSize];
-    if (readErrorDictionary)
-    {
-        if (readBinaryFile(files.errorDictionaryFile,
-                           std::span(errorDict, maxBufferSize)) == 0)
-        {
-            return std::nullopt;
-        }
-    }
-
-    BejTestInputs inputs = {
-        .expectedJson = expJson,
-        .schemaDictionary = schemaDictBuffer,
-        .annotationDictionary = annoDictBuffer,
-        .errorDictionary = errorDict,
-        .encodedStream = std::span(encBuffer, encLen),
-    };
-    return inputs;
-}
-
 TEST_P(BejDecoderTest, Decode)
 {
     const BejDecoderTestParams& test_case = GetParam();
