23 require_once(
'reportClass.php');
24 require_once(
'testSuites.php');
29 $options = getopt(
"hf:");
31 $Usage =
"$argv[0] [-h] -f <test-results-file>\n";
38 if(array_key_exists(
'h',$options)) {
42 if(array_key_exists(
'f',$options)) {
43 $filePath = $options[
'f'];
44 if(!strlen($filePath)) {
48 if(!file_exists($filePath)) {
49 print
"Error! $filePath does not exist or is not readable\n";
56 $results = $tr->parseResultsFile($filePath);
75 function groupByType($suiteName, $list) {
77 if(!is_array($list)) {
80 if(!strlen($suiteName)) {
84 foreach($list as $nextList){
85 foreach($nextList as $index => $resultList){
86 $failTypeList[] = $resultList;
89 return($failType[$suiteName] = $failTypeList);
92 function printByType($typeName, $typeList) {
94 if(!is_array($typeList)) {
97 if(!strlen($typeName)) {
101 print
"The following Test Suites had $typeName:\n";
102 foreach($typeList as $suite => $flist){
105 $len = strlen($suite);
107 printf(
"%'-{$len}s\n",
'');
108 foreach ($flist as $fline) {
117 $suiteFailures = array();
118 $suiteExceptions = array();
119 $suitesRun = array();
121 foreach($results as $suite => $result) {
122 foreach($result as $partResult) {
125 if (array_key_exists($suite, $testSuites))
127 if(!in_array($suite, $suitesRun))
129 $suitesRun[] = $suite;
132 if (is_array($partResult)) {
133 if(array_key_exists(
'failures',$partResult)) {
134 $suiteFailures[$suite] = groupByType($suite,$partResult);
137 if(array_key_exists(
'exceptions',$partResult)) {
138 $suiteExceptions[$suite] = groupByType($suite,$partResult);
143 list($passes, $fail, $except) = preg_split(
'/:/',$partResult);
145 $totalPasses += $passes;
146 $totalFailures += $fail;
147 $totalExceptions+= $except;
153 print
"Test Results for FOSSology UI Test suite\n";
154 print
"Tests run on $tr->Date at $tr->Time using SVN Version $tr->Svn\n";
155 print
"The tests Suites that were run are:\n";
156 printf(
"%'-35s\n",
'');
158 foreach ($suitesRun as $suite)
160 if (array_key_exists($suite, $testSuites))
162 print
"$suite: $testSuites[$suite]\n\n";
166 print
"Test Results Summary\n";
167 printf(
"%'-37s\n",
'');
168 print
"Total Passes: $totalPasses\n";
169 print
"Total Failures: $totalFailures\n";
170 print
"Total Exceptions: $totalExceptions\n";
171 printf(
"%'-37s\n",
'');
173 printByType(
'failures', $suiteFailures);
174 printf(
"%'-37s\n",
'');
176 printByType(
'Exceptions', $suiteExceptions);
list_t type structure used to keep various lists. (e.g. there are multiple lists).