diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index c85bcbfc3b..9039cef423 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2860,7 +2860,8 @@ mymain(void)
     virQEMUDriver driver;
     testQemuMonitorJSONSimpleFuncData simpleFunc;
     struct testQAPISchemaData qapiData;
-    char *metaschema = NULL;
+    virJSONValuePtr metaschema = NULL;
+    char *metaschemastr = NULL;
 
 #if !WITH_YAJL
     fputs("libvirt not compiled with JSON support, skipping this test\n", stderr);
@@ -3062,20 +3063,22 @@ mymain(void)
     DO_TEST_QAPI_SCHEMA("alternate 2", "blockdev-add/arg-type", false,
                         "{\"driver\":\"qcow2\",\"file\": 1234}");
 
-    if (!(metaschema = virTestLoadFilePath("qemuqapischema.json", NULL))) {
-        VIR_TEST_VERBOSE("failed to load qapi schema\n");
+    if (!(metaschema = testQEMUSchemaGetLatest()) ||
+        !(metaschemastr = virJSONValueToString(metaschema, false))) {
+        VIR_TEST_VERBOSE("failed to load latest qapi schema\n");
         ret = -1;
         goto cleanup;
     }
 
     DO_TEST_QAPI_SCHEMA("schema-meta", "query-qmp-schema/ret-type", true,
-                        metaschema);
+                        metaschemastr);
 
 
 #undef DO_TEST_QAPI_SCHEMA
 
  cleanup:
-    VIR_FREE(metaschema);
+    VIR_FREE(metaschemastr);
+    virJSONValueFree(metaschema);
     virHashFree(qapiData.schema);
     qemuTestDriverFree(&driver);
     return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/testutilsqemuschema.c b/tests/testutilsqemuschema.c
index 46bbc4f1e5..1cec5265e1 100644
--- a/tests/testutilsqemuschema.c
+++ b/tests/testutilsqemuschema.c
@@ -17,6 +17,7 @@
  */
 #include <config.h>
 #include "testutils.h"
+#include "testutilsqemu.h"
 #include "testutilsqemuschema.h"
 #include "qemu/qemu_qapi.h"
 
@@ -516,13 +517,71 @@ testQEMUSchemaValidate(virJSONValuePtr obj,
 }
 
 
+/**
+ * testQEMUSchemaGetLatest:
+ *
+ * Returns the schema data as the qemu monitor would reply from the latest
+ * replies file used for qemucapabilitiestest for the x86_64 architecture.
+ */
+virJSONValuePtr
+testQEMUSchemaGetLatest(void)
+{
+    char *capsLatestFile = NULL;
+    char *capsLatest = NULL;
+    char *schemaReply;
+    char *end;
+    virJSONValuePtr reply = NULL;
+    virJSONValuePtr schema = NULL;
+
+    if (!(capsLatestFile = testQemuGetLatestCapsForArch(abs_srcdir "/qemucapabilitiesdata",
+                                                        "x86_64", "replies"))) {
+        VIR_TEST_VERBOSE("failed to find latest caps replies\n");
+        return NULL;
+    }
+
+    VIR_TEST_DEBUG("replies file: '%s'", capsLatestFile);
+
+    if (virTestLoadFile(capsLatestFile, &capsLatest) < 0)
+        goto cleanup;
+
+    if (!(schemaReply = strstr(capsLatest, "\"execute\": \"query-qmp-schema\"")) ||
+        !(schemaReply = strstr(schemaReply, "\n\n")) ||
+        !(end = strstr(schemaReply + 2, "\n\n"))) {
+        VIR_TEST_VERBOSE("failed to find reply to 'query-qmp-schema' in '%s'\n",
+                         capsLatestFile);
+        goto cleanup;
+    }
+
+    schemaReply += 2;
+    *end = '\0';
+
+    if (!(reply = virJSONValueFromString(schemaReply))) {
+        VIR_TEST_VERBOSE("failed to parse 'query-qmp-schema' reply from '%s'\n",
+                         capsLatestFile);
+        goto cleanup;
+    }
+
+    if (!(schema = virJSONValueObjectStealArray(reply, "return"))) {
+        VIR_TEST_VERBOSE("missing qapi schema data in reply in '%s'\n",
+                         capsLatestFile);
+        goto cleanup;
+    }
+
+ cleanup:
+    VIR_FREE(capsLatestFile);
+    VIR_FREE(capsLatest);
+    virJSONValueFree(reply);
+    return schema;
+}
+
+
 virHashTablePtr
 testQEMUSchemaLoad(void)
 {
-    virJSONValuePtr schemajson;
+    virJSONValuePtr schema;
 
-    if (!(schemajson = virTestLoadFileJSON("qemuqapischema.json", NULL)))
+    if (!(schema = testQEMUSchemaGetLatest()))
         return NULL;
 
-    return virQEMUQAPISchemaConvert(schemajson);
+    return virQEMUQAPISchemaConvert(schema);
 }
diff --git a/tests/testutilsqemuschema.h b/tests/testutilsqemuschema.h
index cb383db174..c69435f420 100644
--- a/tests/testutilsqemuschema.h
+++ b/tests/testutilsqemuschema.h
@@ -26,5 +26,8 @@ testQEMUSchemaValidate(virJSONValuePtr obj,
                        virHashTablePtr schema,
                        virBufferPtr debug);
 
+virJSONValuePtr
+testQEMUSchemaGetLatest(void);
+
 virHashTablePtr
 testQEMUSchemaLoad(void);