34 require_once(
'reportClass.php');
35 require_once(
'testSuites.php');
40 $options = getopt(
"hf:");
42 $Usage =
"$argv[0] [-h] -f <test-results-file>\n";
49 if(array_key_exists(
'h',$options)) {
53 if(array_key_exists(
'f',$options)) {
54 $filePath = $options[
'f'];
55 if(!strlen($filePath)) {
59 if(!file_exists($filePath)) {
60 print
"Error! $filePath does not exist or is not readable\n";
67 $results = $tr->parseResultsFile($filePath);
86 function groupByType($suiteName, $list) {
88 if(!is_array($list)) {
91 if(!strlen($suiteName)) {
95 foreach($list as $nextList){
96 foreach($nextList as $index => $resultList){
97 $failTypeList[] = $resultList;
100 return($failType[$suiteName] = $failTypeList);
103 function printByType($typeName, $typeList) {
105 if(!is_array($typeList)) {
108 if(!strlen($typeName)) {
112 print
"The following Test Suites had $typeName:\n";
113 foreach($typeList as $suite => $flist){
116 $len = strlen($suite);
118 printf(
"%'-{$len}s\n",
'');
119 foreach ($flist as $fline) {
128 $suiteFailures = array();
129 $suiteExceptions = array();
130 $suitesRun = array();
132 foreach($results as $suite => $result) {
133 foreach($result as $partResult) {
136 if (array_key_exists($suite, $testSuites))
138 if(!in_array($suite, $suitesRun))
140 $suitesRun[] = $suite;
143 if (is_array($partResult)) {
144 if(array_key_exists(
'failures',$partResult)) {
145 $suiteFailures[$suite] = groupByType($suite,$partResult);
148 if(array_key_exists(
'exceptions',$partResult)) {
149 $suiteExceptions[$suite] = groupByType($suite,$partResult);
154 list($passes, $fail, $except) = preg_split(
'/:/',$partResult);
156 $totalPasses += $passes;
157 $totalFailures += $fail;
158 $totalExceptions+= $except;
164 print
"Test Results for FOSSology UI Test suite\n";
165 print
"Tests run on $tr->Date at $tr->Time using SVN Version $tr->Svn\n";
166 print
"The tests Suites that were run are:\n";
167 printf(
"%'-35s\n",
'');
169 foreach ($suitesRun as $suite)
171 if (array_key_exists($suite, $testSuites))
173 print
"$suite: $testSuites[$suite]\n\n";
177 print
"Test Results Summary\n";
178 printf(
"%'-37s\n",
'');
179 print
"Total Passes: $totalPasses\n";
180 print
"Total Failures: $totalFailures\n";
181 print
"Total Exceptions: $totalExceptions\n";
182 printf(
"%'-37s\n",
'');
184 printByType(
'failures', $suiteFailures);
185 printf(
"%'-37s\n",
'');
187 printByType(
'Exceptions', $suiteExceptions);
list_t type structure used to keep various lists. (e.g. there are multiple lists).