@@ -41,6 +41,12 @@ abstract class BaseParallelTestManifest extends BaseTestManifest
41
41
*/
42
42
protected $ dirPath ;
43
43
44
+ /**
45
+ * An array of test name count in a single group
46
+ * @var array
47
+ */
48
+ protected $ testCountsToGroup = [];
49
+
44
50
/**
45
51
* BaseParallelTestManifest constructor.
46
52
*
@@ -87,6 +93,8 @@ public function generate()
87
93
foreach ($ this ->testGroups as $ groupNumber => $ groupContents ) {
88
94
$ this ->generateGroupFile ($ groupContents , $ groupNumber , $ suites );
89
95
}
96
+
97
+ $ this ->generateGroupSummaryFile ($ this ->testCountsToGroup );
90
98
}
91
99
92
100
/**
@@ -114,17 +122,35 @@ protected function generateGroupFile($testGroup, $nodeNumber, $suites)
114
122
foreach ($ testGroup as $ entryName => $ testValue ) {
115
123
$ fileResource = fopen ($ this ->dirPath . DIRECTORY_SEPARATOR . "group {$ nodeNumber }.txt " , 'a ' );
116
124
117
- $ line = null ;
125
+ $ this ->testCountsToGroup ["group {$ nodeNumber }" ] = $ this ->testCountsToGroup ["group {$ nodeNumber }" ] ?? 0 ;
126
+
118
127
if (!empty ($ suites [$ entryName ])) {
119
128
$ line = "-g {$ entryName }" ;
129
+ $ this ->testCountsToGroup ["group {$ nodeNumber }" ] += count ($ suites [$ entryName ]);
120
130
} else {
121
131
$ line = $ this ->relativeDirPath . DIRECTORY_SEPARATOR . $ entryName . '.php ' ;
132
+ $ this ->testCountsToGroup ["group {$ nodeNumber }" ]++;
122
133
}
123
134
fwrite ($ fileResource , $ line . PHP_EOL );
124
135
fclose ($ fileResource );
125
136
}
126
137
}
127
138
139
+ /**
140
+ * @param array $groups
141
+ * @return void
142
+ */
143
+ protected function generateGroupSummaryFile (array $ groups )
144
+ {
145
+ $ fileResource = fopen ($ this ->dirPath . DIRECTORY_SEPARATOR . "mftf_group_summary.txt " , 'w ' );
146
+ $ contents = "Total Number of Groups: " . count ($ groups ) . PHP_EOL ;
147
+ foreach ($ groups as $ key => $ value ) {
148
+ $ contents .= $ key . " - " . $ value . " tests " .PHP_EOL ;
149
+ }
150
+ fwrite ($ fileResource , $ contents );
151
+ fclose ($ fileResource );
152
+ }
153
+
128
154
/**
129
155
* Function which recusrively parses a given potentially multidimensional array of suites containing their split
130
156
* groups. The result is a flattened array of suite names to relevant tests for generation of the manifest.
0 commit comments