diff --git a/setup.py b/setup.py
index 567962d615368aac963c7c6111ac23a0a6e7a610..180520a3d66ea9308c784dd1f054c6e3ea51b594 100644
--- a/setup.py
+++ b/setup.py
@@ -153,6 +153,7 @@ setup(
         ],
         "test": [
             "coverage",
+            "deepdiff==6.7.1",
             "nbval",
             "pytest-asyncio",
             "pytest-cov",
@@ -163,6 +164,7 @@ setup(
         ],
         "automated_test": [
             "coverage",
+            "deepdiff==6.7.1",
             "nbval",
             "pytest-asyncio",
             "pytest-cov",
diff --git a/tests/test_reference_runs/test_pre_deployment.py b/tests/test_reference_runs/test_pre_deployment.py
index ab830ddf6f0b905d05c2aab9f81d588d9c71b8e4..75bb05ed75de8c1015d78171730a6b39c73c0c32 100644
--- a/tests/test_reference_runs/test_pre_deployment.py
+++ b/tests/test_reference_runs/test_pre_deployment.py
@@ -14,6 +14,7 @@ import h5py
 import numpy as np
 import pytest
 import yaml
+from deepdiff import DeepDiff
 
 import xfel_calibrate.calibrate as calibrate
 
@@ -258,21 +259,10 @@ def slurm_watcher(test_key: str, std_out: str):
     LOGGER.info(f"{test_key}'s jobs were COMPLETED")
 
 
-def compare_metadata_ccvs(test, reference, tested_key):
+def load_yaml(file_path):
+    with open(file_path, 'r') as file:
+        return yaml.safe_load(file)
 
-    def load_yaml(file_path):
-        with open(file_path, 'r') as file:
-            return yaml.safe_load(file)
-
-    # Load the relevant section from both files
-    ccvs_test = load_yaml(test).get(tested_key, {})
-    ccvs_reference = load_yaml(reference).get(tested_key, {})
-
-    # Compare the content directly
-    if ccvs_test == ccvs_reference:
-        return True
-    else:
-        return False
 
 @pytest.mark.manual_run
 @pytest.mark.parametrize(
@@ -379,11 +369,13 @@ def test_xfel_calibrate(
     if cal_type.lower() == "correct":
         # For corrections validate calibration constants
         metadata_file = f"calibration_metadata_{cal_conf['karabo-id']}.yml"
-        assert compare_metadata_ccvs(
-            out_folder / metadata_file,
-            reference_folder / metadata_file,
-            "retrieved-constants",
-        ), "Found difference in the metadata for the retrieved Constants."
+        # Load the relevant section from both files
+        ccvs_test = load_yaml(
+            out_folder / metadata_file)["retrieved-constants"]
+        ccvs_reference = load_yaml(
+            reference_folder / metadata_file)["retrieved-constants"]
+        ccvs_diff = DeepDiff(ccvs_test, ccvs_reference, ignore_order=True)
+        assert ccvs_diff == {}, "Found difference in the metadata for the retrieved Constants."  # noqa
         LOGGER.info("Retrieved CCVs validated.")
 
     # Stop tests at this point, if desired.