diff --git a/python/plugins/processing/tests/testdata/custom/overlay0.geojson b/python/plugins/processing/tests/testdata/custom/overlay0.geojson
new file mode 100644
index 000000000000..e312bdabb3a6
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/custom/overlay0.geojson
@@ -0,0 +1,19 @@
+{
+"type": "FeatureCollection",
+"name": "overlay0",
+"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::3857" } },
+"features": [
+{ "type": "Feature", "properties": { "id_a": "A1" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 1.0, 1.0 ], [ 5.0, 1.0 ], [ 5.0, 5.0 ], [ 1.0, 5.0 ], [ 1.0, 1.0 ] ] ] } },
+{ "type": "Feature", "properties": { "id_a": "A2" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 2.0, 2.0 ], [ 4.0, 2.0 ], [ 4.0, 4.0 ], [ 2.0, 4.0 ], [ 2.0, 2.0 ] ] ] } },
+{ "type": "Feature", "properties": { "id_a": "A3" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 7.0, 2.0 ], [ 9.0, 2.0 ], [ 9.0, 4.0 ], [ 7.0, 4.0 ], [ 7.0, 2.0 ] ] ] } },
+{ "type": "Feature", "properties": { "id_a": "A4" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 6.0, 1.0 ], [ 10.0, 1.0 ], [ 10.0, 5.0 ], [ 6.0, 5.0 ], [ 6.0, 1.0 ] ] ] } },
+{ "type": "Feature", "properties": { "id_a": "A5" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 1.0, 6.0 ], [ 3.0, 6.0 ], [ 3.0, 10.0 ], [ 1.0, 10.0 ], [ 1.0, 6.0 ] ] ] } },
+{ "type": "Feature", "properties": { "id_a": "A6" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 3.0, 6.0 ], [ 5.0, 6.0 ], [ 5.0, 10.0 ], [ 3.0, 10.0 ], [ 3.0, 6.0 ] ] ] } },
+{ "type": "Feature", "properties": { "id_a": "A7" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 6.0, 6.0 ], [ 10.0, 6.0 ], [ 10.0, 10.0 ], [ 6.0, 10.0 ], [ 6.0, 6.0 ] ] ] } },
+{ "type": "Feature", "properties": { "id_a": "A8" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 1.0, 11.0 ], [ 4.0, 11.0 ], [ 4.0, 14.0 ], [ 1.0, 14.0 ], [ 1.0, 11.0 ] ] ] } },
+{ "type": "Feature", "properties": { "id_a": "A9" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 1.0, 13.0 ], [ 4.0, 13.0 ], [ 4.0, 16.0 ], [ 1.0, 16.0 ], [ 1.0, 13.0 ] ] ] } },
+{ "type": "Feature", "properties": { "id_a": "A10" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 2.0, 12.0 ], [ 5.0, 12.0 ], [ 5.0, 15.0 ], [ 2.0, 15.0 ], [ 2.0, 12.0 ] ] ] } },
+{ "type": "Feature", "properties": { "id_a": "A11" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 6.0, 11.0 ], [ 10.0, 11.0 ], [ 10.0, 12.0 ], [ 7.0, 12.0 ], [ 7.0, 15.0 ], [ 6.0, 15.0 ], [ 6.0, 11.0 ] ] ] } },
+{ "type": "Feature", "properties": { "id_a": "A12" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 8.0, 13.0 ], [ 10.0, 13.0 ], [ 10.0, 15.0 ], [ 8.0, 15.0 ], [ 8.0, 13.0 ] ] ] } }
+]
+}
diff --git a/python/plugins/processing/tests/testdata/expected/union0.gml b/python/plugins/processing/tests/testdata/expected/union0.gml
new file mode 100644
index 000000000000..598724d9ecc2
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/expected/union0.gml
@@ -0,0 +1,152 @@
+
+
+
+
+ 11
+ 1016
+
+
+
+
+
+ 2,2 2,4 4,4 4,2 2,2
+ A2
+
+
+
+
+ 2,2 2,4 4,4 4,2 2,2
+ A1
+
+
+
+
+ 1,1 1,5 5,5 5,1 1,12,2 4,2 4,4 2,4 2,2
+ A1
+
+
+
+
+ 7,2 7,4 9,4 9,2 7,2
+ A4
+
+
+
+
+ 7,2 7,4 9,4 9,2 7,2
+ A3
+
+
+
+
+ 2,13 1,13 1,14 2,14 2,13
+ A9
+
+
+
+
+ 2,13 1,13 1,14 2,14 2,13
+ A8
+
+
+
+
+ 6,1 6,5 10,5 10,1 6,17,2 9,2 9,4 7,4 7,2
+ A4
+
+
+
+
+ 4,12 2,12 2,13 4,13 4,12
+ A10
+
+
+
+
+ 4,12 2,12 2,13 4,13 4,12
+ A8
+
+
+
+
+ 1,6 3,6 3,10 1,10 1,6
+ A5
+
+
+
+
+ 2,13 2,14 4,14 4,13 2,13
+ A10
+
+
+
+
+ 2,13 2,14 4,14 4,13 2,13
+ A9
+
+
+
+
+ 2,13 2,14 4,14 4,13 2,13
+ A8
+
+
+
+
+ 3,6 5,6 5,10 3,10 3,6
+ A6
+
+
+
+
+ 2,14 2,15 4,15 4,14 2,14
+ A10
+
+
+
+
+ 2,14 2,15 4,15 4,14 2,14
+ A9
+
+
+
+
+ 6,6 10,6 10,10 6,10 6,6
+ A7
+
+
+
+
+ 4,12 4,11 1,11 1,13 2,13 2,12 4,12
+ A8
+
+
+
+
+ 1,14 1,16 4,16 4,15 2,15 2,14 1,14
+ A9
+
+
+
+
+ 4,15 5,15 5,12 4,12 4,13 4,14 4,15
+ A10
+
+
+
+
+ 6,11 10,11 10,12 7,12 7,15 6,15 6,11
+ A11
+
+
+
+
+ 8,13 10,13 10,15 8,15 8,13
+ A12
+
+
+
diff --git a/python/plugins/processing/tests/testdata/expected/union0.xsd b/python/plugins/processing/tests/testdata/expected/union0.xsd
new file mode 100644
index 000000000000..12b2c4dae386
--- /dev/null
+++ b/python/plugins/processing/tests/testdata/expected/union0.xsd
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml b/python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
index b2eae7eddced..8a9c50c5118f 100644
--- a/python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
+++ b/python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
@@ -5330,6 +5330,21 @@ tests:
fields:
fid: skip
+ - algorithm: native:union
+ name: Test Union of single layer
+ params:
+ INPUT:
+ name: custom/overlay0.geojson
+ type: vector
+ results:
+ OUTPUT:
+ name: expected/union0.gml
+ type: vector
+ compare:
+ unordered: true
+ fields:
+ fid: skip
+
- algorithm: native:union
name: Test Union (basic)
params: