|
1 # |
|
2 # Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 |
|
17 #----------------------------------------------- |
|
18 # Sequence |
|
19 #----------------------------------------------- |
|
20 # Reads parameters -> [if !ok params] ShowHelp |
|
21 # ReadConfigFiles |
|
22 # -> ParseCfg |
|
23 # -> ReadCase |
|
24 # |
|
25 # for all testreports: |
|
26 # ReadTestRunInfoFromStifReport |
|
27 # GetReportLogFileNames |
|
28 # ParseResultsAndLogs |
|
29 # |
|
30 # ParseResultsAndLogs |
|
31 # WriteCaseLog |
|
32 # LogLineTimeMatchesForCase |
|
33 # FormatLogLine |
|
34 # UpdateCase |
|
35 # CheckCaseEntriesInLog |
|
36 # |
|
37 # OLD: |
|
38 # -> ParseReportFile |
|
39 # -> ReadReportLogs |
|
40 # -> WriteCaseLog |
|
41 # -> LogLineTimeMatchesForCase |
|
42 # -> FormatLogLine |
|
43 # -> CheckCaseEntriesInLog |
|
44 # |
|
45 # ReportNotDocumentedCases |
|
46 # SortCases |
|
47 # CalculateStats |
|
48 # WriteOfficeXml -> XmlReadyText |
|
49 # exit() |
|
50 |
|
51 #----------------------------------------------- |
|
52 # Other functions: |
|
53 #----------------------------------------------- |
|
54 # RemoveWhiteSpaces |
|
55 # SpecialChars |
|
56 # ReplaceChar |
|
57 # GetCaseField |
|
58 # GetCase (id or name) |
|
59 # GetCaseDesc (id or name) |
|
60 # PrintCases |
|
61 # JustFormatLogFile |
|
62 |
|
63 # |
|
64 # |
|
65 # |
|
66 # STIF CFG: |
|
67 #************************************************************************************ |
|
68 #[IptvETDescription] |
|
69 # Testname: <insert text here> |
|
70 # |
|
71 # Purpose: <insert text here> |
|
72 # |
|
73 # Means: <insert text here> |
|
74 # |
|
75 # Required environment settings: <insert text here> |
|
76 # |
|
77 # Verification: <insert text here> |
|
78 # |
|
79 # Note: <insert text here> |
|
80 # |
|
81 # Related requirements: <reqid> <reqid> <reqid> .. |
|
82 # |
|
83 #[EndIptvETDescription] |
|
84 #------------------------------------------------------------------------------------ |
|
85 #[Test] |
|
86 # do stuff here |
|
87 #[Endtest] |
|
88 |
|
89 #------------------------------------------------------------------------------------ |
|
90 # Includes |
|
91 #------------------------------------------------------------------------------------ |
|
92 #use strict; |
|
93 use warnings; |
|
94 use Cwd; # for cwd |
|
95 use FindBin; # for FindBin:Bin |
|
96 use File::Path; # for mkpath |
|
97 use File::Copy; |
|
98 use Date::Calc; |
|
99 |
|
100 #------------------------------------------------------------------------------------ |
|
101 # Globals |
|
102 #------------------------------------------------------------------------------------ |
|
103 |
|
104 my $lastCaseLogLine = 0; |
|
105 |
|
106 my $ALT_RESULTCOUNT = 10; # maximum number of runs in alternative report |
|
107 |
|
108 my @cases; #references to case arrays |
|
109 my @gCfgFiles; # list of cfg files. |
|
110 my @caseDescs; # case description and the case itself in text |
|
111 my @notDocumentedCases; #array to hold information about the cases without documentation |
|
112 |
|
113 $regexpCaseName = '[\x3C\x3E\(\)\w.,\/:_\-&\' ]+'; |
|
114 |
|
115 my $caseDefaultStatus = "NOT RUN"; |
|
116 |
|
117 # |
|
118 # Case field numerations |
|
119 # |
|
120 |
|
121 my $CASE_NAME = 0; |
|
122 my $CASE_ID = 1; |
|
123 my $CASE_RUN_TIMES = 2; |
|
124 my $CASE_CRASHED = 3; |
|
125 my $CASE_FAILED = 4; |
|
126 my $CASE_PASSED = 5; |
|
127 my $CASE_STATUS = 6; |
|
128 my $CASE_PURPOSE = 7; |
|
129 my $CASE_MEANS = 8; |
|
130 my $CASE_REQUIRED_SETTINGS = 9; |
|
131 my $CASE_RELATED_REQUIREMENTS = 10; |
|
132 my $CASE_VERIFICATION = 11; |
|
133 my $CASE_NOTE = 12; |
|
134 my $CASE_REASON = 13; # where crashed or what returned the error code |
|
135 my $CASE_RESULT = 14; # error code |
|
136 my $CASE_LOG_FILE = 15; # test case specific log file. |
|
137 my $CASE_LOG_FILE_SCRIPTER = 16; # test case specific log from STIF testscripter logs. |
|
138 my $CASE_CHECK_RESULT_LOG_FILE = 17; # set if the case is in the log files, if next line is found: >>>Case start: ETxxxxx CaseName |
|
139 # or STIF own trace: Starting testcase [ET1000 Add multiple Iaps] (usually from fasttrace or emulator log) |
|
140 my $CASE_CFG_FILE = 18; |
|
141 my $CASE_RUN_TIME_SECONDS = 19; # how many seconds it took to run the case |
|
142 my $CASE_REPORTLINE1 = 20; |
|
143 my $CASE_REPORTLINE2 = 21; |
|
144 my $CASE_REPORTLINE3 = 22; |
|
145 my $CASE_ENTRY_LOG_START = 23; |
|
146 |
|
147 my $TDTOOLRESULTFILE = ".\\text_file.txt"; |
|
148 my $XML_OUTPUT_FILE = ".\\test_cases.xml"; |
|
149 my $XML_BRIEF_OUTPUT_FILE = ".\\test_cases_brief.xml"; |
|
150 my $NOT_DOCUMENTED_CASES_FILE = ".\\test_cases_notdocumented.txt"; |
|
151 |
|
152 my @globalTempFiles; |
|
153 |
|
154 # |
|
155 # Tags inside the xml, will be replaced by case data when writing the xml file |
|
156 # |
|
157 |
|
158 my $CaseCountMul8 = "CASE_COUNT_MUL8"; |
|
159 |
|
160 my $STYLE_ID_STATUS_TAG = "STYLE_ID_STATUS"; # must be in the xml data |
|
161 |
|
162 my $STYLE_ID_STATUS_FAILED = "s36"; |
|
163 my $STYLE_ID_STATUS_PASSED = "s37"; |
|
164 my $STYLE_ID_STATUS_CRASHED = "s38"; |
|
165 my $STYLE_ID_STATUS_UNKNOWN = "s401"; |
|
166 my $STYLE_ID_STATUS_NA = "s39"; |
|
167 |
|
168 my $STYLE_ID_STATUS_FAILED_CENTERED = "s36centered"; |
|
169 my $STYLE_ID_STATUS_PASSED_CENTERED = "s37centered"; |
|
170 my $STYLE_ID_STATUS_CRASHED_CENTERED = "s38centered"; |
|
171 my $STYLE_ID_STATUS_UNKNOWN_CENTERED = "s401centered"; |
|
172 my $STYLE_ID_STATUS_NA_CENTERED = "s39centered"; |
|
173 |
|
174 # these must be in the xml data to get the results inserted into xml |
|
175 my $xmlDataCaseName = "XML_DATA_CASE_NAME"; |
|
176 my $xmlDataCaseRunTimes = "XML_DATA_CASE_RUN_TIMES"; |
|
177 my $xmlDataCaseFailed = "XML_DATA_CASE_FAILED"; |
|
178 my $xmlDataCaseCrashed = "XML_DATA_CASE_CRASHED"; |
|
179 my $xmlDataCasePassed = "XML_DATA_CASE_PASSED"; |
|
180 my $xmlDataCaseStatus = "XML_DATA_CASE_STATUS"; |
|
181 my $xmlDataCasePurpose = "XML_DATA_CASE_PURPOSE"; |
|
182 my $xmlDataCaseMeans = "XML_DATA_CASE_MEANS"; |
|
183 my $xmlDataCaseRequiredSettings = "XML_DATA_CASE_REQUIRED_SETTINGS"; |
|
184 my $xmlDataCaseRelatedRequirements = "XML_DATA_CASE_RELATED_REQUIREMENTS"; |
|
185 my $xmlDataCaseVerification = "XML_DATA_CASE_VERIFICATION"; |
|
186 my $xmlDataCaseNote = "XML_DATA_CASE_NOTE"; |
|
187 my $xmlDataCaseReason = "XML_DATA_CASE_REASON"; |
|
188 my $xmlDataCaseResult = "XML_DATA_CASE_RESULT"; |
|
189 my $xmlDataCaseLink1 = "XML_DATA_CASE_LINK1"; |
|
190 my $xmlDataCaseLink2 = "XML_DATA_CASE_LINK2"; |
|
191 |
|
192 my $xmlDataSummaryCaseCount = "XML_DATA_SUMMARY_TOTAL_CASES"; |
|
193 my $xmlDataSummaryPassed = "XML_DATA_SUMMARY_PASSED"; |
|
194 my $xmlDataSummaryFailed = "XML_DATA_SUMMARY_FAILED"; |
|
195 my $xmlDataSummaryCrashed = "XML_DATA_SUMMARY_CRASHED"; |
|
196 my $xmlDataSummaryTimeout = "XML_DATA_SUMMARY_TIMEOUT"; |
|
197 my $xmlDataSummaryPassRateTotal = "XML_DATA_SUMMARY_PASS_RATE_TOTAL"; |
|
198 my $xmlDataSummaryPassRateRun = "XML_DATA_SUMMARY_PASS_RATE_RUN"; |
|
199 my $xmlDataSummaryRunRate = "XML_DATA_SUMMARY_RUN_RATE"; |
|
200 |
|
201 my $xmlDataAltDateX = "XML_DATA_ALTDATE"; |
|
202 |
|
203 my $xmlDataAltResultX = "XML_DATA_ALTRESULT"; |
|
204 |
|
205 my $xmlDataCfgFile = "XML_DATA_CFG_FILE"; |
|
206 |
|
207 # |
|
208 # Statistics |
|
209 # |
|
210 |
|
211 my $summaryCaseCount = 0; |
|
212 my $summaryPassedCases = 0; |
|
213 my $summaryFailedCases = 0; |
|
214 my $summaryCrashedCases = 0; |
|
215 my $summaryTimeoutCases = 0; |
|
216 my $summaryPassRateTotal = 0; |
|
217 my $summaryPassRateRun = 0; |
|
218 my $summaryRunRate = 0; |
|
219 |
|
220 # |
|
221 # Xml data |
|
222 # |
|
223 |
|
224 my $xmlHeader; |
|
225 my $xmlHeaderTableColumns; |
|
226 my $xmlHeaderTableColumnsBrief; |
|
227 my $xmlFooter; |
|
228 my $xmlDataEmptyRow; |
|
229 my $xmlSummaryData; |
|
230 my $xmlData; |
|
231 my $xmlDataCaseStatusDisabled; |
|
232 my $xmlData2; |
|
233 my $xmlDataBriefHeader; |
|
234 my $xmlDataBrief; |
|
235 my $xmlCfgFileBrief; |
|
236 my $xmlHeaderTableColumnsAlt; |
|
237 my $xmlCfgFileAltHeader; |
|
238 my $xmlCfgFileAltData; |
|
239 |
|
240 InitXmlData(); |
|
241 |
|
242 #------------------------------------------------------------------------------------ |
|
243 # GLOBAL CODE |
|
244 #------------------------------------------------------------------------------------ |
|
245 |
|
246 my $argcount = scalar(@ARGV); |
|
247 |
|
248 my $optionSortCases = 0; |
|
249 my $optionShowMessages = 0; |
|
250 my $optionHtml = 0; |
|
251 my $optionLogAllCases = 1; |
|
252 my $optionNoLogs = 0; |
|
253 my $optionNoSecurityTests = 0; |
|
254 my $optionNoLiveTvTests = 0; |
|
255 my $optionCaseIncludedInLog = 0; |
|
256 my $optionGoodIsBetter = 1; |
|
257 my $optionPrintCfgSummaries = 0; |
|
258 my $optionCaseRunTimes = 0; |
|
259 my $optionFinalDoc = 1; |
|
260 my $optionFixFilename = ""; |
|
261 my $optionDebug = 0; |
|
262 my $optionCaseList = ""; |
|
263 my $optionAltResults = 0; |
|
264 my $optionLogFileName = "fusion"; |
|
265 |
|
266 while(scalar(@ARGV) >= 1) |
|
267 { |
|
268 my $argument = shift(@ARGV); |
|
269 |
|
270 if($argument eq "-h") |
|
271 { |
|
272 ShowHelp(); |
|
273 } |
|
274 |
|
275 elsif($argument eq "-e") |
|
276 { |
|
277 $optionShowMessages = 1; |
|
278 } |
|
279 |
|
280 elsif($argument eq "-s") |
|
281 { |
|
282 $optionSortCases = 1; |
|
283 } |
|
284 |
|
285 elsif($argument eq "-html") |
|
286 { |
|
287 $optionHtml = 1; |
|
288 } |
|
289 |
|
290 elsif($argument eq "-logall") |
|
291 { |
|
292 $optionLogAllCases = 1; |
|
293 } |
|
294 |
|
295 elsif($argument eq "-nologs") |
|
296 { |
|
297 $optionNoLogs = 1; |
|
298 } |
|
299 |
|
300 elsif($argument eq "-nosecuritytests") |
|
301 { |
|
302 $optionNoSecurityTests = 1; |
|
303 } |
|
304 |
|
305 elsif($argument eq "-nolivetvtests") |
|
306 { |
|
307 $optionNoLiveTvTests = 1; |
|
308 } |
|
309 |
|
310 elsif($argument eq "-i") |
|
311 { |
|
312 $optionCaseIncludedInLog = 1; |
|
313 } |
|
314 |
|
315 elsif($argument eq "-file") |
|
316 { |
|
317 $file = shift(@ARGV); |
|
318 |
|
319 JustFormatLogFile($file); |
|
320 exit; |
|
321 } |
|
322 elsif($argument eq "-runtimes") |
|
323 { |
|
324 $optionCaseRunTimes = 1; |
|
325 } |
|
326 |
|
327 elsif($argument eq "-xxx") |
|
328 { |
|
329 $optionCaseIncludedInLog = 1; |
|
330 $optionNoLiveTvTests = 1; |
|
331 $optionNoSecurityTests = 1; |
|
332 $optionHtml = 1; |
|
333 } |
|
334 elsif($argument eq "-good") |
|
335 { |
|
336 $optionGoodIsBetter = 1; |
|
337 } |
|
338 elsif($argument eq "-cfgsum") |
|
339 { |
|
340 $optionPrintCfgSummaries = 1; |
|
341 } |
|
342 elsif($argument eq "-finalize") |
|
343 { |
|
344 $optionFinalDoc = 1; |
|
345 } |
|
346 elsif($argument eq "-fix") { |
|
347 $optionFixFilename = shift(@ARGV); |
|
348 FixExcelLogPaths(); |
|
349 exit(); |
|
350 } |
|
351 elsif($argument eq "-debug") { |
|
352 $optionShowMessages = 1; |
|
353 $optionDebug = 1; |
|
354 } |
|
355 elsif($argument eq "-caselist") { |
|
356 $optionCaseList = shift(@ARGV); |
|
357 } |
|
358 elsif($argument eq "-alt") { |
|
359 $optionAltResults = 1; |
|
360 } |
|
361 elsif( $argument eq "-logfile") { |
|
362 $optionLogFileName = shift(@ARGV); |
|
363 } |
|
364 else |
|
365 { |
|
366 ShowHelp(); |
|
367 } |
|
368 } |
|
369 |
|
370 UnzipAndCopyFiles(); |
|
371 |
|
372 my $totalExecutionTime = 0; |
|
373 |
|
374 my $caseLogOutDir = "testcase_logs\\testcase_logs\\"; |
|
375 |
|
376 my @caseList; |
|
377 |
|
378 if($optionCaseList ne "") |
|
379 { |
|
380 ReadCaseList(\@caseList, $optionCaseList); |
|
381 } |
|
382 |
|
383 # Find cfg files. |
|
384 FindCfgFiles( ".", \@gCfgFiles ); |
|
385 |
|
386 # None found from current dir, see one dir lower. |
|
387 FindCfgFiles( "..", \@gCfgFiles ) if( scalar( @gCfgFiles ) < 1 ); |
|
388 |
|
389 # Parse results |
|
390 if($optionPrintCfgSummaries) |
|
391 { |
|
392 PrintCfgSummaries(); |
|
393 } |
|
394 elsif( !$optionAltResults ) |
|
395 { |
|
396 my $res = ReadTestReports(); |
|
397 |
|
398 if( $res == 0 ) |
|
399 { |
|
400 foreach my $file ( @globalTempFiles ) |
|
401 { |
|
402 unlink $file if( -e $file ); |
|
403 } |
|
404 print("No reports to read.\n"); |
|
405 exit; |
|
406 } |
|
407 |
|
408 #ReportNotDocumentedCases($NOT_DOCUMENTED_CASES_FILE); |
|
409 |
|
410 if($optionSortCases) |
|
411 { |
|
412 @cases = sort SortCases @cases; |
|
413 } |
|
414 |
|
415 CalculateStats(); |
|
416 |
|
417 #WriteOfficeXml($XML_OUTPUT_FILE, 0); |
|
418 WriteOfficeXml($XML_BRIEF_OUTPUT_FILE, 1); |
|
419 } |
|
420 else |
|
421 { |
|
422 my @runs; |
|
423 ReadTestReportsAlt(\@runs); |
|
424 |
|
425 WriteOfficeXmlAlt($XML_BRIEF_OUTPUT_FILE, \@runs); |
|
426 } |
|
427 |
|
428 #print("Total run time: " . $totalExecutionTime . "\n") if( $optionCaseRunTimes ); |
|
429 |
|
430 foreach my $file ( @globalTempFiles ) |
|
431 { |
|
432 unlink $file if( defined( $file ) && -e $file ); |
|
433 } |
|
434 |
|
435 exit(); |
|
436 |
|
437 #------------------------------------------------------------------------------------ |
|
438 # UnzipAndCopyFiles |
|
439 #------------------------------------------------------------------------------------ |
|
440 sub UnzipAndCopyFiles |
|
441 { |
|
442 my @files; |
|
443 system("rmdir ziptemp /s /q>NUL") if( -e "ziptemp" ); |
|
444 |
|
445 # Unzip zips in current directory and one level of subdirectories. -> ATS results. |
|
446 GetAllFiles( ".", \@files, 1 ); |
|
447 |
|
448 foreach my $file ( @files ) |
|
449 { |
|
450 if( $file =~ m/\.zip/i ) |
|
451 { |
|
452 my $fileName = GetPathFileName( $file ); |
|
453 |
|
454 mkdir ("ziptemp"); |
|
455 my $cmd = "unzip -o \"$file\" -d ziptemp\\$fileName >NUL"; |
|
456 print("Unzipping $file\n") if( $optionShowMessages ); |
|
457 system( $cmd ); |
|
458 } |
|
459 } |
|
460 |
|
461 undef( @files ); |
|
462 GetAllFiles( ".", \@files, -1 ); |
|
463 |
|
464 # Copy files to current dir. |
|
465 |
|
466 my $currDir = cwd; |
|
467 |
|
468 foreach my $file ( @files ) |
|
469 { |
|
470 next if( -d $file ); |
|
471 |
|
472 $file =~ s/\//\\/g; |
|
473 |
|
474 # Do nothing for files which are in current dir. |
|
475 my $srcDir = GetPathDir( $file ); |
|
476 my $currpath = cwd; |
|
477 $currpath =~ s/\//\\/g; |
|
478 next if( $srcDir eq $currpath ); |
|
479 |
|
480 my $filename = GetPathFileName( $file ); |
|
481 |
|
482 # LOOP all testreport*.txt testscripter*.txt |
|
483 # if file is testreport.txt |
|
484 # lastFolder = last folder from the path |
|
485 # LOOP all fusion*.txt |
|
486 # LOOP remove tailing text from lastFolder starting from last index of '.' until it matches with folder of fusion*.txt |
|
487 # pair fusion*.txt with testreport |
|
488 |
|
489 |
|
490 if( ( $filename =~ m/testreport/i || $filename =~ m/testscripter/i ) && $filename =~ m/\.txt/i ) |
|
491 #if( ( $filename =~ m/$optionLogFileName/i || $filename =~ m/testreport/i || $filename =~ m/testscripter/i ) && $filename =~ m/\.txt/i ) |
|
492 { |
|
493 my $dst = ""; |
|
494 |
|
495 if( $filename =~ m/testreport/i ) |
|
496 { |
|
497 # Pair testreports and logs. |
|
498 CopyTestReportWithLog( $file, \@files ); |
|
499 } |
|
500 else |
|
501 { |
|
502 print("Copying file $file\n") if( $optionDebug ); |
|
503 # For other files we just need unique filename and copy them. |
|
504 $dst = $filename; |
|
505 |
|
506 if( -e $filename ) |
|
507 { |
|
508 # Separate file's name and extension. |
|
509 my $name = ""; |
|
510 my $ext = ""; |
|
511 my $pos = index($filename, "."); |
|
512 if( $pos != -1) |
|
513 { |
|
514 $ext = substr( $filename, $pos ); |
|
515 $name = substr( $filename, 0, $pos ); |
|
516 |
|
517 my $count = 0; |
|
518 while( 1 ) |
|
519 { |
|
520 $dst = "$name" . "_" . $count . $ext; |
|
521 last if( ! -e "$dst" ); |
|
522 $count++; |
|
523 if( $count > 1000 ) |
|
524 { |
|
525 $dst = ""; |
|
526 last; |
|
527 } |
|
528 } |
|
529 } |
|
530 } |
|
531 push @globalTempFiles, $dst; |
|
532 |
|
533 print("Dest: $dst\n") if( $optionDebug ); |
|
534 |
|
535 copy( $file, $dst ) or die "Could not copy '$file' to '$dst'\n"; |
|
536 } |
|
537 } |
|
538 } |
|
539 |
|
540 system("rmdir ziptemp /s /q>NUL") if( -e "ziptemp" ); |
|
541 } |
|
542 |
|
543 sub CopyTestReportWithLog |
|
544 { |
|
545 my ( $reportFileName, $refFiles ) = @_; |
|
546 |
|
547 print("\nTrying to pair: $reportFileName\n") if( $optionDebug ); |
|
548 |
|
549 my $reportPath = GetPathDir( $reportFileName ); |
|
550 |
|
551 my $logFileName = ""; |
|
552 |
|
553 #\ResultAndLogFiles_vod\22507.23325.1.4.25129-lab.net\TestReport.txt |
|
554 #\ResultAndLogFiles_vod\22507.23325.1.4.25130-lab.net\Fusion.txt |
|
555 # ^^^^^^^^^^^^^^^ matching part |
|
556 # Find log file with about same path with the report. |
|
557 while( 1 ) |
|
558 { |
|
559 # Check the log files. |
|
560 foreach $file ( @$refFiles ) |
|
561 { |
|
562 $file =~ s/\//\\/g; |
|
563 my $filename = GetPathFileName( $file ); |
|
564 |
|
565 if( $filename =~ m/$optionLogFileName/i ) |
|
566 { |
|
567 if( index( $file, $reportPath ) == 0 ) |
|
568 { |
|
569 $logFileName = $file; |
|
570 |
|
571 print("PAIRED: \n") if( $optionDebug ); |
|
572 print("reportPath: $reportPath\n") if( $optionDebug ); |
|
573 print("report: $reportFileName\n") if( $optionDebug ); |
|
574 print("log : $logFileName\n") if( $optionDebug ); |
|
575 |
|
576 print("Report log pair: $logFileName\n") if( $optionShowMessages && !$optionDebug ); |
|
577 last; |
|
578 } |
|
579 } |
|
580 } |
|
581 |
|
582 last if( $logFileName ne "" ); |
|
583 |
|
584 # Remove all from last dot in the path. |
|
585 my $pos = rindex( $reportPath, "." ); |
|
586 last if( $pos == -1 ); |
|
587 $reportPath = substr( $reportPath, 0, $pos ); |
|
588 |
|
589 # The first 4 numbers might be same with multiple reports and logs. Ignore file if match is not found before. |
|
590 last if( rindex( $reportPath, "\\" ) == -1 ); |
|
591 my $dotstr = substr( $reportPath, rindex( $reportPath, "\\" )+1 ); |
|
592 last if( ! ( $dotstr =~ m/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ ) ); |
|
593 print( "DOT: $dotstr\n" ) if( $optionDebug ); |
|
594 } |
|
595 |
|
596 if( $logFileName eq "" ) |
|
597 { |
|
598 print("Could not find log file for: $reportFileName\n") if( $optionShowMessages ); |
|
599 } |
|
600 |
|
601 my $dstReportFileName = ""; |
|
602 my $dstReportLogName = ""; |
|
603 |
|
604 # Find first available name for the report in current directory. |
|
605 my $fileNum = 0; |
|
606 |
|
607 my $filename = GetPathFileName( $reportFileName ); |
|
608 |
|
609 # Separate file's name and extension. |
|
610 my $name = ""; |
|
611 my $ext = ""; |
|
612 |
|
613 my $pos = index($filename, "."); |
|
614 return if( $pos == -1); |
|
615 |
|
616 $ext = substr( $filename, $pos ); |
|
617 $name = substr( $filename, 0, $pos ); |
|
618 |
|
619 # Find free filename. |
|
620 while( 1 ) |
|
621 { |
|
622 $dstReportFileName = "$name" . "_" . $fileNum . $ext; |
|
623 last if( ! -e "$dstReportFileName" ); |
|
624 $fileNum++; |
|
625 if( $fileNum > 1000 ) |
|
626 { |
|
627 die("Too many files to copy."); |
|
628 } |
|
629 } |
|
630 |
|
631 if( $logFileName ne "" ) |
|
632 { |
|
633 # Get new name for the log with same numbering. |
|
634 |
|
635 $filename = GetPathFileName( $logFileName ); |
|
636 |
|
637 $pos = index($filename, "."); |
|
638 return if( $pos == -1); |
|
639 |
|
640 $ext = substr( $filename, $pos ); |
|
641 $name = substr( $filename, 0, $pos ); |
|
642 |
|
643 $dstLogFileName = "$name" . "_" . $fileNum . $ext; |
|
644 die("Log filename already exists.") if( -e "$dstLogFileName" ); # Shouldn't happen. |
|
645 } |
|
646 |
|
647 # Copy the files. |
|
648 |
|
649 push @globalTempFiles, $dstReportFileName; |
|
650 push @globalTempFiles, $dstLogFileName; |
|
651 |
|
652 print("Copying $reportFileName\n") if( $optionShowMessages ); |
|
653 print("Dest: $dstReportFileName\n") if( $optionShowMessages ); |
|
654 |
|
655 copy( $reportFileName, $dstReportFileName ) or die "Could not copy '$reportFileName' to '$dstReportFileName'\n"; |
|
656 |
|
657 if( $logFileName ne "" ) |
|
658 { |
|
659 print("Copying $logFileName\n") if( $optionShowMessages ); |
|
660 print("Dest: $dstLogFileName\n") if( $optionShowMessages ); |
|
661 copy( $logFileName, $dstLogFileName ) or die "Could not copy '$logFileName' to '$dstLogFileName'\n"; |
|
662 } |
|
663 } |
|
664 |
|
665 #------------------------------------------------------------------------------------ |
|
666 # ReadCaseList |
|
667 # |
|
668 #------------------------------------------------------------------------------------ |
|
669 sub ReadCaseList |
|
670 { |
|
671 my ($refList, $filename) = @_; |
|
672 |
|
673 if( open(FILE_HANDLE, ".\\" . $filename) ) |
|
674 { |
|
675 my @lines = <FILE_HANDLE>; |
|
676 close(FILE_HANDLE); |
|
677 foreach $line (@lines) |
|
678 { |
|
679 my $caseId; |
|
680 |
|
681 if($line =~ m/^case /i) |
|
682 { |
|
683 if($line =~ m/^case ET([0-9]+) /i) |
|
684 { |
|
685 $caseId = "ET" . $1; |
|
686 } |
|
687 else |
|
688 { |
|
689 $caseId = substr($line, 4); |
|
690 } |
|
691 RemoveWhiteSpaces(\$caseId); |
|
692 push @$refList, $caseId; |
|
693 } |
|
694 } |
|
695 } |
|
696 } |
|
697 |
|
698 #------------------------------------------------------------------------------------ |
|
699 # IsCaseInCaseList |
|
700 # |
|
701 #------------------------------------------------------------------------------------ |
|
702 sub IsCaseInCaseList |
|
703 { |
|
704 my ($caseNameOrId) = @_; |
|
705 |
|
706 return 1 if(scalar(@caseList) <= 0); |
|
707 |
|
708 my $caseIdFromName = GetCaseIdFromName($caseNameOrId); |
|
709 |
|
710 foreach $caseId (@caseList) |
|
711 { |
|
712 if($caseId eq $caseNameOrId) |
|
713 { |
|
714 return 1; |
|
715 } |
|
716 } |
|
717 |
|
718 foreach $caseId (@caseList) |
|
719 { |
|
720 if($caseId eq $caseIdFromName) |
|
721 { |
|
722 return 1; |
|
723 } |
|
724 } |
|
725 |
|
726 return 0; |
|
727 } |
|
728 |
|
729 #------------------------------------------------------------------------------------ |
|
730 # FixExcelLogPaths |
|
731 # |
|
732 # Changes the paths on lines: |
|
733 #<Cell ss:StyleID="s60" ss:HRef="C:\Documents and Settings\senbom\Desktop\testcase_logs\testcase_logs\ET17099_4371843802.txt"><Data> |
|
734 # To: |
|
735 #<Cell ss:StyleID="s60" ss:HRef="testcase_logs\ET17099_4371843802.txt"><Data> |
|
736 # |
|
737 # Because the absolute path does not work in Excel. |
|
738 # |
|
739 #------------------------------------------------------------------------------------ |
|
740 sub FixExcelLogPaths |
|
741 { |
|
742 if( open(FILE_HANDLE, ".\\" . $optionFixFilename) ) |
|
743 { |
|
744 my @lines = <FILE_HANDLE>; |
|
745 close(FILE_HANDLE); |
|
746 |
|
747 if(!open(FILE_HANDLE, ">" . $optionFixFilename) ) |
|
748 { |
|
749 die("Could not write to file $file\n"); |
|
750 } |
|
751 |
|
752 foreach my $line(@lines) |
|
753 { |
|
754 my $pos = index($line, "\\testcase_logs\\testcase_logs\\"); |
|
755 if($pos != -1) |
|
756 { |
|
757 my $start = rindex($line, "\"", $pos); |
|
758 my $remstr = substr($line, $start+1, $pos-$start + length("\\testcase_logs") ); |
|
759 |
|
760 $line = substr( $line, 0, index($line, $remstr) ) . |
|
761 substr( $line, index($line, $remstr) + length($remstr) ); |
|
762 |
|
763 } |
|
764 |
|
765 print FILE_HANDLE ($line); |
|
766 |
|
767 } |
|
768 close(FILE_HANDLE); |
|
769 |
|
770 print("Fixed paths in $optionFixFilename\n"); |
|
771 } |
|
772 else |
|
773 { |
|
774 die("Coult not open file $optionFixFilename\n"); |
|
775 } |
|
776 } |
|
777 |
|
778 #------------------------------------------------------------------------------------ |
|
779 # CalculateStats |
|
780 #------------------------------------------------------------------------------------ |
|
781 sub CalculateStats |
|
782 { |
|
783 $summaryCaseCount = scalar( @cases ); |
|
784 $summaryPassedCases = 0; |
|
785 $summaryFailedCases = 0; |
|
786 $summaryCrashedCases = 0; |
|
787 $summaryTimeoutCases = 0; |
|
788 $summaryPassRateTotal = 0; |
|
789 $summaryPassRateRun = 0; |
|
790 $summaryRunRate = 0; |
|
791 |
|
792 foreach $case(@cases) |
|
793 { |
|
794 if(defined(@{$case}[$CASE_STATUS])) |
|
795 { |
|
796 my $status = @{$case}[$CASE_STATUS]; |
|
797 |
|
798 $summaryPassedCases++ if($status eq "PASSED"); |
|
799 $summaryFailedCases++ if($status eq "FAILED"); |
|
800 $summaryCrashedCases++ if($status eq "CRASHED"); |
|
801 } |
|
802 } |
|
803 |
|
804 my $runCases = $summaryPassedCases + $summaryFailedCases + $summaryCrashedCases; |
|
805 |
|
806 $summaryPassRateTotal = $summaryPassedCases / $summaryCaseCount * 100; |
|
807 $summaryPassRateRun = $summaryPassedCases / $runCases * 100; |
|
808 $summaryRunRate = $runCases / $summaryCaseCount * 100; |
|
809 } |
|
810 |
|
811 #------------------------------------------------------------------------------------ |
|
812 # SortCases |
|
813 #------------------------------------------------------------------------------------ |
|
814 sub SortCases() |
|
815 { |
|
816 $aprio = 0; |
|
817 $bprio = 0; |
|
818 |
|
819 #print @{$a}[$CASE_STATUS] . " - " . $a . " vs " . $b . " - " . @{$b}[$CASE_STATUS] . "\n"; |
|
820 |
|
821 if(@{$a}[$CASE_STATUS] eq "CRASHED") { $aprio = 5; } |
|
822 elsif(@{$a}[$CASE_STATUS] eq "FAILED") { $aprio = 4; } |
|
823 elsif(@{$a}[$CASE_STATUS] eq "PASSED") { $aprio = 3; } |
|
824 |
|
825 if(@{$b}[$CASE_STATUS] eq "CRASHED") { $bprio = 5; } |
|
826 elsif(@{$b}[$CASE_STATUS] eq "FAILED") { $bprio = 4; } |
|
827 elsif(@{$b}[$CASE_STATUS] eq "PASSED") { $bprio = 3; } |
|
828 |
|
829 if($aprio == $bprio) |
|
830 { |
|
831 return lc(@{$a}[$CASE_NAME]) cmp lc(@{$b}[$CASE_NAME]); |
|
832 } |
|
833 |
|
834 return $bprio cmp $aprio; |
|
835 } |
|
836 |
|
837 |
|
838 #------------------------------------------------------------------------------------ |
|
839 # ShowHelp |
|
840 #------------------------------------------------------------------------------------ |
|
841 sub ShowHelp { |
|
842 |
|
843 print <<USAGE_EOF; |
|
844 testdoc.pl |
|
845 |
|
846 Create folder to VaDo root folder for STIF results and copy this script and |
|
847 the results there. STIF CFG files are searched from . and .. from the script |
|
848 run folder. The STIF results can be either ATS results zips or multiple |
|
849 TestReport*.txt and fusion*.txt files as long as they have the same ending |
|
850 in the name. Script also parses the STIF testscripter logs it finds. |
|
851 |
|
852 Options: |
|
853 -i: STIF case will be included in the start of the case log |
|
854 -s: cases will be sorted by status |
|
855 -e: Shows extra information during the tool run |
|
856 -html: Case logs are generated in html format instead of text |
|
857 -logall: Logs are created for passed cases too. |
|
858 -nologs: Logs are not processed. |
|
859 -nosecuritytests: Security tests are not included in the reports. |
|
860 -nolivetvttests: Live TV tests are not included in the reports. |
|
861 -i: Test case from the CFG is included in the log file |
|
862 -file <file>: Only formats defined log file into html |
|
863 -runtimes: Result of the case will contain the case execution time in seconds. |
|
864 -good: If case has passed once it will be marked as passed no matter how many |
|
865 times it has failed. |
|
866 -cfgsum: Prints summary info for cfgs: how many cases and how long the cfg did |
|
867 take to execute. |
|
868 -finalize |
|
869 -fix if you save the file in Excel the log paths will come absolute and don't |
|
870 work if moved to another directory. use this fix it. |
|
871 -caselist <file>: Only reports the cases in caselist.txt, see genrerun.pl for |
|
872 file format. |
|
873 -logfile <file>: Sets filter for log filenames. Default is fusion. |
|
874 -slogs: Reads STIF testscripter logs instead of custom logs. |
|
875 These files will be generated: |
|
876 test_cases.xml |
|
877 test_cases_brief.xml |
|
878 test_cases_notdocumented.txt |
|
879 |
|
880 Case specific log files are generated in testcase_logs directory and result |
|
881 file has links to them. |
|
882 |
|
883 USAGE_EOF |
|
884 |
|
885 exit(); |
|
886 |
|
887 }; |
|
888 |
|
889 #------------------------------------------------------------------------------------ |
|
890 # ReadReportLogs |
|
891 # |
|
892 # Parameters: |
|
893 # $fileName |
|
894 # $refLogLines |
|
895 # |
|
896 # Reads log file of specific TestReport. |
|
897 # |
|
898 # The function has two different behaviours: |
|
899 # |
|
900 # Filenames for test report and log must match. For example |
|
901 # if test report file is TestReport_XXX.txt then fusion_XXX.txt is read if found. |
|
902 # |
|
903 # If fileName is * then *fusion*.txt files will be read one by one and processed by function CheckCaseEntriesInLog() |
|
904 #------------------------------------------------------------------------------------ |
|
905 sub ReadReportLogs |
|
906 { |
|
907 my ($fileName, $refLogLines) = @_; |
|
908 |
|
909 return if($optionNoLogs || $optionPrintCfgSummaries); |
|
910 |
|
911 opendir(DIR, "."); |
|
912 my @filelist = sort(readdir(DIR)); |
|
913 closedir(DIR); |
|
914 |
|
915 #default mask for logs |
|
916 my $filemask = "^$optionLogFileName\.TXT"; |
|
917 |
|
918 #create file mask for logs if testreport.txt is in format: testreport_*.txt |
|
919 if(index($fileName, "_") != -1) |
|
920 { |
|
921 my $spos = index($fileName, "_"); |
|
922 my $epos = rindex($fileName, "."); |
|
923 |
|
924 $filemask = substr($fileName, $spos, $epos - $spos); |
|
925 #print("filemask: $filemask\n"); |
|
926 |
|
927 #$filemask = "$optionLogFileName" . $filemask . "[a-z\-0-9_]*\.txt"; # this finds $optionLogFileName_xxx*.txt |
|
928 $filemask = "$optionLogFileName" . $filemask . "\.txt"; # this finds only $optionLogFileName_xxx.txt |
|
929 #print("filemask: $filemask\n"); |
|
930 #die(); |
|
931 } |
|
932 |
|
933 my $processLogsHere = 0; |
|
934 |
|
935 if($fileName eq "*") |
|
936 { |
|
937 $processLogsHere = 1; |
|
938 $filemask = $optionLogFileName . "[a-z\-0-9_]*\.txt" |
|
939 } |
|
940 |
|
941 my $i; |
|
942 |
|
943 #read the files into refLogLines array |
|
944 foreach $file(@filelist) |
|
945 { |
|
946 #if($file =~ m/^$optionLogFileName[a-z0-9_]+\.TXT$/i or $file =~ m/^$optionLogFileName\.TXT$/i ) |
|
947 if($file =~ m/$filemask/i ) |
|
948 { |
|
949 print("Reading log file: " . $file . "."); |
|
950 |
|
951 if( open(FILE_HANDLE, ".\\" . $file) ) |
|
952 { |
|
953 my @tempArray = <FILE_HANDLE>; |
|
954 close(FILE_HANDLE); |
|
955 |
|
956 FormatFasttraceTraces(\@tempArray); |
|
957 |
|
958 if($processLogsHere) |
|
959 { |
|
960 FindAndMarkCaseEntriesInLog(\@tempArray, \@cases); |
|
961 |
|
962 CheckCaseEntriesInLog(\@tempArray); |
|
963 } |
|
964 else |
|
965 { |
|
966 while(scalar(@tempArray) > 0) |
|
967 { |
|
968 push @$refLogLines, (shift(@tempArray)); |
|
969 } |
|
970 } |
|
971 } |
|
972 } |
|
973 } |
|
974 |
|
975 FindAndMarkCaseEntriesInLog($refLogLines, \@cases); |
|
976 } |
|
977 |
|
978 #------------------------------------------------------------------------------------ |
|
979 # GetReportLogFileNames |
|
980 # |
|
981 # Parameters: |
|
982 # $fileName |
|
983 # $refLogFiles |
|
984 # |
|
985 # Gets log filenames for specific testreport. |
|
986 # |
|
987 # The function has two different behaviours: |
|
988 # |
|
989 # Filenames for test report and log must match. For example |
|
990 # if test report file is TestReport_XXX.txt then $optionLogFileName_XXX.txt is read if found. |
|
991 # |
|
992 # If fileName is * then *$optionLogFileName*.txt files will be read one by one and processed by function CheckCaseEntriesInLog() |
|
993 #------------------------------------------------------------------------------------ |
|
994 sub GetReportLogFileNames |
|
995 { |
|
996 my ($fileName, $refLogFiles) = @_; |
|
997 |
|
998 return if($optionNoLogs || $optionPrintCfgSummaries); |
|
999 |
|
1000 opendir(DIR, "."); |
|
1001 my @filelist = sort(readdir(DIR)); |
|
1002 closedir(DIR); |
|
1003 |
|
1004 #default mask for logs |
|
1005 my $filemask = "^$optionLogFileName\.TXT"; |
|
1006 |
|
1007 #create file mask for logs if testreport.txt is in format: testreport_*.txt |
|
1008 if(index($fileName, "_") != -1) |
|
1009 { |
|
1010 my $spos = index($fileName, "_"); |
|
1011 my $epos = rindex($fileName, "."); |
|
1012 |
|
1013 $filemask = substr($fileName, $spos, $epos - $spos); |
|
1014 $filemask = "$optionLogFileName" . $filemask . "\.txt"; # this finds only $optionLogFileName_xxx.txt |
|
1015 } |
|
1016 |
|
1017 if($fileName eq "*") |
|
1018 { |
|
1019 $filemask = $optionLogFileName . "[a-z0-9_]*\.txt" |
|
1020 } |
|
1021 |
|
1022 foreach $file(@filelist) |
|
1023 { |
|
1024 if($file =~ m/$filemask/i ) |
|
1025 { |
|
1026 push @$refLogFiles, $file; |
|
1027 } |
|
1028 } |
|
1029 } |
|
1030 |
|
1031 #------------------------------------------------------------------------------------ |
|
1032 # FindAndMarkCaseEntriesInLog |
|
1033 # |
|
1034 # Parameters: |
|
1035 # $refLogLines |
|
1036 # |
|
1037 # Searches for case entries in the log and if found then marks the case in @cases array |
|
1038 #------------------------------------------------------------------------------------ |
|
1039 sub FindAndMarkCaseEntriesInLog |
|
1040 { |
|
1041 my ($refLogLines, $refCases) = @_; |
|
1042 |
|
1043 my $line; |
|
1044 |
|
1045 print(" - Searching case start entries from log\n") if($optionShowMessages); |
|
1046 |
|
1047 my $startLineIndex = 0; |
|
1048 |
|
1049 # scan the log thru and mark if there's log start entries |
|
1050 for( my $i = 0; $i < scalar(@$refLogLines); $i++ ) |
|
1051 { |
|
1052 my $line = @$refLogLines[$i]; |
|
1053 |
|
1054 my $caseStartInLog = 0; |
|
1055 |
|
1056 my $caseId = ""; |
|
1057 |
|
1058 if($line =~ m/>>> Case start:/i) |
|
1059 { |
|
1060 $startLineIndex = $i; |
|
1061 $caseStartInLog = 1; |
|
1062 $caseId = substr($line, index($line, ">>> Case start:") + length(">>> Case start:")); |
|
1063 print("Found case start: $caseId\n") if($optionShowMessages); |
|
1064 } |
|
1065 |
|
1066 if($caseStartInLog) |
|
1067 { |
|
1068 RemoveWhiteSpaces(\$caseId); |
|
1069 |
|
1070 my $refCase = GetCase($caseId, $refCases); |
|
1071 |
|
1072 if(defined($refCase)) |
|
1073 { |
|
1074 @$refCase[$CASE_CHECK_RESULT_LOG_FILE] = 1; |
|
1075 @$refCase[$CASE_ENTRY_LOG_START] = $startLineIndex; |
|
1076 } |
|
1077 else |
|
1078 { |
|
1079 print("Case start in log found: $caseId\n") if($optionShowMessages); |
|
1080 print("ERROR! The start in log found but case is not found from report or cfg.\n"); |
|
1081 } |
|
1082 } |
|
1083 } |
|
1084 } |
|
1085 |
|
1086 #------------------------------------------------------------------------------------ |
|
1087 # FormatFasttraceTraces |
|
1088 # |
|
1089 # Parameters: |
|
1090 # $refLogArray |
|
1091 #------------------------------------------------------------------------------------ |
|
1092 sub FormatFasttraceTraces |
|
1093 { |
|
1094 my ($refLogArray) = @_; |
|
1095 |
|
1096 my $ftDebug = 0; |
|
1097 |
|
1098 # strip fasttrace logging text from the start of lines |
|
1099 #[13:58:17.234] sti: MCU_ASCII_PRINTF; channel:0xE0; msg:$optionLogFileName.TXT 09/10/2006¿1:57:08¿C$optionLogFileName::CheckIsPluginRunning |
|
1100 |
|
1101 my $stripFasttrace = 0; |
|
1102 # find first occurance of Musti message, remove anything before that |
|
1103 my $i; |
|
1104 |
|
1105 for($i= 0; $i<100; $i++) |
|
1106 { |
|
1107 if(defined(@$refLogArray[$i])) |
|
1108 { |
|
1109 if(@$refLogArray[$i] =~ m/MCU_ASCII_PRINTF/i) |
|
1110 { |
|
1111 $stripFasttrace = 1; |
|
1112 last; |
|
1113 } |
|
1114 } |
|
1115 } |
|
1116 |
|
1117 print("fasttrace: end $i, strip: $stripFasttrace\n") if($ftDebug); |
|
1118 |
|
1119 #remove the fasttrace specific lines |
|
1120 print("fasttrace: lines before: " . scalar(@$refLogArray) . "\n") if($ftDebug); |
|
1121 |
|
1122 splice(@$refLogArray, 0, $i) if($stripFasttrace); |
|
1123 |
|
1124 return if(!$stripFasttrace); |
|
1125 |
|
1126 print("fasttrace: lines " . scalar(@$refLogArray) . "\n") if($ftDebug); |
|
1127 |
|
1128 #remove the fasttrace line startings and change format of STIF messages |
|
1129 |
|
1130 for($i = 0; $i<scalar(@$refLogArray); $i++) |
|
1131 { |
|
1132 #before: [14:38:40.641] sti: MCU_ASCII_PRINTF; channel:0xE0; msg:TestCase [ET1024 Sort IapList when it has no IAPs] finished with verdict[0] |
|
1133 #after: [14:38:40.641] sti: MCU_ASCII_PRINTF; channel:0xE0; msg:$optionLogFileName.TXT 18/10/2006¿2:37:37¿TestCase [ET1024 Sort IapList when it has no IAPs] finished with verdict[0] |
|
1134 if(@$refLogArray[$i] =~ m/TestCase \[([[a-z0-9_]+) ($regexpCaseName)\] finished with verdict\[[-]?([0-9]+)/i) |
|
1135 { |
|
1136 #die(@$refLogArray[$i]); |
|
1137 |
|
1138 my $startStr = substr(@$refLogArray[$i], 0, index(@$refLogArray[$i], "TestCase")); |
|
1139 my $endStr = substr(@$refLogArray[$i], index(@$refLogArray[$i], "TestCase")); |
|
1140 |
|
1141 my $timeStr = FasttraceLogFindIptvTraceTime($refLogArray, $i); |
|
1142 |
|
1143 @$refLogArray[$i] = $startStr . "$optionLogFileName.TXT " . $timeStr . "\t" . $endStr; |
|
1144 |
|
1145 print("fasttrace: " . @$refLogArray[$i] . "\n") if($ftDebug); |
|
1146 |
|
1147 #print("\n\n" . $startStr . "'\n$optionLogFileName.TXT \n" . $timeStr . "'\n" . $endStr . "'\n" ); |
|
1148 #die(); |
|
1149 } |
|
1150 |
|
1151 #change the lines where is STIF message saying starting testcase to "$optionLogFileName.TXT <TIME> >>> Case start: <CASEID>" format, otherwise it will be not be recognized later |
|
1152 if(@$refLogArray[$i] =~ m/Starting testcase \[([[a-z0-9_]+) ($regexpCaseName)\]/i) |
|
1153 { |
|
1154 print("debug: " . @$refLogArray[$i] . "\n"); |
|
1155 @$refLogArray[$i] = substr(@$refLogArray[$i], 0, index(@$refLogArray[$i], "Starting testcase")); |
|
1156 |
|
1157 my $timeStr = FasttraceLogFindIptvTraceTime($refLogArray, $i); |
|
1158 |
|
1159 @$refLogArray[$i] .= "$optionLogFileName.TXT $timeStr\t>>> Case start: $1" . "\r\n"; |
|
1160 |
|
1161 print("fasttrace: '" . @$refLogArray[$i] . "'\n") if($ftDebug); |
|
1162 |
|
1163 #@$refLogArray[$i] = "[14:38:37.953] sti: MCU_ASCII_PRINTF; channel:0xE0; msg:$optionLogFileName.TXT 18/10/2006\t2:37:34\t>>> Case start: $1"; |
|
1164 } |
|
1165 |
|
1166 if(@$refLogArray[$i] =~ m/channel\:[0-9a-z]+; msg:$optionLogFileName.TXT [0-9]+\/[0-9]+\/[0-9]+/i) |
|
1167 { |
|
1168 @$refLogArray[$i] = substr(@$refLogArray[$i], index(@$refLogArray[$i], "msg:$optionLogFileName.TXT") + length("msg:$optionLogFileName.TXT") + 1); |
|
1169 |
|
1170 #replace fasttrace tab chars |
|
1171 @$refLogArray[$i] =~ s/¿/\t/g; |
|
1172 #print(@$refLogArray[$i]); |
|
1173 |
|
1174 } |
|
1175 else |
|
1176 { |
|
1177 # if there's no match then this is not a trace for $optionLogFileName |
|
1178 splice(@$refLogArray, $i, 1); |
|
1179 $i--; |
|
1180 } |
|
1181 } |
|
1182 } |
|
1183 |
|
1184 |
|
1185 #------------------------------------------------------------------------------------ |
|
1186 # FastTraceLogFindIptvTraceTime |
|
1187 # |
|
1188 # Parameters: |
|
1189 # $refLines: reference to array of the log line |
|
1190 # $startLine: line where to start looking for |
|
1191 # |
|
1192 # Finds next time stamp of Iptvengine from Fasttrace log |
|
1193 #------------------------------------------------------------------------------------ |
|
1194 sub FasttraceLogFindIptvTraceTime |
|
1195 { |
|
1196 my ($refLines, $startLine) = @_; |
|
1197 |
|
1198 #find next trace of iptvengine and get the time and date |
|
1199 my $timeStr = ""; |
|
1200 for(my $e = $startLine+1; $e < scalar(@$refLines); $e++) |
|
1201 { |
|
1202 if(@$refLines[$e] =~m/msg:$optionLogFileName.TXT/) |
|
1203 { |
|
1204 my $line = @$refLines[$e]; |
|
1205 #remove the fasttrace trace from line start, we don't want it's time |
|
1206 $line = substr($line, index($line, "msg:$optionLogFileName.TXT")); |
|
1207 |
|
1208 if($line =~ m/([0-9]+\/[0-9]+\/[0-9]+)/i) |
|
1209 { |
|
1210 $timeStr .= $1 . "\t"; |
|
1211 } |
|
1212 |
|
1213 if($line =~ m/([0-9]+:[0-9]+:[0-9]+)/i) |
|
1214 { |
|
1215 $timeStr .= $1; |
|
1216 } |
|
1217 last if($timeStr ne ""); |
|
1218 } |
|
1219 } |
|
1220 |
|
1221 return $timeStr; |
|
1222 } |
|
1223 |
|
1224 #------------------------------------------------------------------------------------ |
|
1225 # ReportNotDocumentedCases |
|
1226 # |
|
1227 # Parameters: |
|
1228 # $file |
|
1229 # |
|
1230 # Writes the @notDocumentedCases array into a file |
|
1231 #------------------------------------------------------------------------------------ |
|
1232 sub ReportNotDocumentedCases |
|
1233 { |
|
1234 my ($file) = @_; |
|
1235 |
|
1236 if(scalar(@notDocumentedCases) > 0) |
|
1237 { |
|
1238 if(!open(FILE_HANDLE, ">" . $file) ) |
|
1239 { |
|
1240 print("ERROR! Could not open file '" . $file . "'\n"); |
|
1241 } else { |
|
1242 print FILE_HANDLE ( @notDocumentedCases ); |
|
1243 close(FILE_HANDLE); |
|
1244 print("Report " . $NOT_DOCUMENTED_CASES_FILE . " written.\n"); |
|
1245 } |
|
1246 } else |
|
1247 { |
|
1248 print("All cases are documented."); |
|
1249 } |
|
1250 } |
|
1251 |
|
1252 #------------------------------------------------------------------------------------ |
|
1253 # ReadTestReports |
|
1254 # |
|
1255 # Reads TestReportXX.txt files from the current directory and updates the cases with the results. |
|
1256 # Reads also logs for the report and creates case specific logs. |
|
1257 #------------------------------------------------------------------------------------ |
|
1258 sub ReadTestReports |
|
1259 { |
|
1260 # Read filelist of current directory |
|
1261 opendir(DIR, "."); |
|
1262 my @filelist = sort(readdir(DIR)); |
|
1263 closedir(DIR); |
|
1264 |
|
1265 my $readSomething = 0; |
|
1266 |
|
1267 my @testScripterLogLines; |
|
1268 ReadTestScripterLogs( \@testScripterLogLines ); |
|
1269 |
|
1270 # Read reports and logs in the current directory |
|
1271 foreach $file(@filelist) |
|
1272 { |
|
1273 next if( -d $file or $file eq "." or $file eq ".."); |
|
1274 |
|
1275 # Read results STIF testreport |
|
1276 if($file =~ m/^TestReport[a-z\-0-9_]+\.txt$/i or $file =~ m/^TestReport\.txt$/i ) |
|
1277 { |
|
1278 if($optionShowMessages) { print("***************************\n"); }; |
|
1279 print("Report file: " . $file . "\n"); |
|
1280 |
|
1281 my @logFiles; |
|
1282 my @caseResults; |
|
1283 |
|
1284 ReadTestRunInfoFromStifReport( $file, \@caseResults, \@logFiles ); |
|
1285 ParseResultsAndLogs( \@caseResults, \@logFiles, \@testScripterLogLines ); |
|
1286 |
|
1287 undef(@logFiles); |
|
1288 undef(@caseResults); |
|
1289 |
|
1290 $readSomething++; |
|
1291 } |
|
1292 } |
|
1293 |
|
1294 return if($optionPrintCfgSummaries); |
|
1295 |
|
1296 # No testreports found. Read all logs and parse them. |
|
1297 if($readSomething == 0) |
|
1298 { |
|
1299 print("\nNo test reports found in the current directory. Trying to read all the logs.\n"); |
|
1300 |
|
1301 my @logFileLines; |
|
1302 |
|
1303 ReadReportLogs("*", \@logFileLines); |
|
1304 |
|
1305 if( scalar( @logFileLines ) > 0 ) |
|
1306 { |
|
1307 $readSomething = 1; |
|
1308 } |
|
1309 |
|
1310 undef(@logFileLines); |
|
1311 } |
|
1312 |
|
1313 return $readSomething; |
|
1314 } |
|
1315 |
|
1316 #------------------------------------------------------------------------------------ |
|
1317 # ReadTestReportsAlt |
|
1318 # |
|
1319 # Every test report is one run and those should have as much same cases as possible. |
|
1320 #------------------------------------------------------------------------------------ |
|
1321 sub ReadTestReportsAlt |
|
1322 { |
|
1323 my ($refRuns) = @_; |
|
1324 |
|
1325 # Read filelist of current directory |
|
1326 opendir(DIR, "."); |
|
1327 my @filelist = sort(readdir(DIR)); |
|
1328 closedir(DIR); |
|
1329 |
|
1330 my @runs; |
|
1331 |
|
1332 # Read reports and logs in the current directory |
|
1333 foreach $file(@filelist) |
|
1334 { |
|
1335 if($file eq "." or $file eq "..") {next}; |
|
1336 |
|
1337 # Read results STIF testreport |
|
1338 if($file =~ m/^TestReport[a-z0-9_]+\.txt$/i or $file =~ m/^TestReport\.txt$/i ) |
|
1339 { |
|
1340 if($optionShowMessages) { print("***************************\n"); }; |
|
1341 print("Report file: " . $file . "\n"); |
|
1342 |
|
1343 # Store report filename, run date and then cases into array |
|
1344 |
|
1345 # Read date from report |
|
1346 if( !open(FILE_HANDLE, $file) ) { |
|
1347 print("ERROR! Could not open file '" . $file . "'\n"); |
|
1348 return; |
|
1349 } |
|
1350 my @array = <FILE_HANDLE>; |
|
1351 close(FILE_HANDLE); |
|
1352 |
|
1353 #Monday 25th August 2008 |
|
1354 my @pieces = split(' ', $array[1]); |
|
1355 |
|
1356 $pieces[1] =~ s/st//; |
|
1357 $pieces[1] =~ s/nd//; |
|
1358 $pieces[1] =~ s/rd//; |
|
1359 $pieces[1] =~ s/th//; |
|
1360 |
|
1361 undef(@array); |
|
1362 |
|
1363 my @runInfo; |
|
1364 $runInfo[0] = $file; |
|
1365 $runInfo[1] = substr( $pieces[0], 0, 3 ) . " " . $pieces[1] . " " . substr( $pieces[2], 0, 3 ); |
|
1366 |
|
1367 my @runResults; |
|
1368 my @logFiles; |
|
1369 ReadTestRunInfoFromStifReport($file, \@runResults, \@logFiles ); |
|
1370 $runInfo[2] = \@runResults; |
|
1371 |
|
1372 push @$refRuns, \@runInfo; |
|
1373 } |
|
1374 } |
|
1375 } |
|
1376 |
|
1377 #------------------------------------------------------------------------------------ |
|
1378 # ReadTestScripterLogs |
|
1379 #------------------------------------------------------------------------------------ |
|
1380 sub ReadTestScripterLogs |
|
1381 { |
|
1382 my ( $refLogLines ) = @_; |
|
1383 |
|
1384 return if($optionNoLogs || $optionPrintCfgSummaries); |
|
1385 |
|
1386 opendir(DIR, "."); |
|
1387 my @filelist = sort(readdir(DIR)); |
|
1388 closedir(DIR); |
|
1389 |
|
1390 foreach $file(@filelist) |
|
1391 { |
|
1392 if($file =~ m/^testscripter[a-z0-9_]+.txt/i ) |
|
1393 { |
|
1394 print("Reading scripter log: $file\n") if( $optionDebug ); |
|
1395 if( open(FILE_HANDLE, $file) ) |
|
1396 { |
|
1397 my @tempArray = <FILE_HANDLE>; |
|
1398 close(FILE_HANDLE); |
|
1399 |
|
1400 while(scalar(@tempArray) > 0) |
|
1401 { |
|
1402 push @$refLogLines, ( shift( @tempArray ) ); |
|
1403 } |
|
1404 undef(@tempArray); |
|
1405 } |
|
1406 else |
|
1407 { |
|
1408 print("ERROR: Could not open the log file: $file!\n"); |
|
1409 } |
|
1410 } |
|
1411 else |
|
1412 { |
|
1413 print("Not a scripter log: $file\n") if( $optionDebug ); |
|
1414 } |
|
1415 } |
|
1416 } |
|
1417 |
|
1418 |
|
1419 #------------------------------------------------------------------------------------ |
|
1420 # ReadTestReportDates |
|
1421 # |
|
1422 # Reads the date from each testreport in current directory |
|
1423 #------------------------------------------------------------------------------------ |
|
1424 sub ReadTestReportDates |
|
1425 { |
|
1426 my ($refDates) = @_; |
|
1427 |
|
1428 # Read filelist of current directory |
|
1429 opendir(DIR, "."); |
|
1430 my @filelist = sort(readdir(DIR)); |
|
1431 closedir(DIR); |
|
1432 |
|
1433 my @runs; |
|
1434 |
|
1435 # Read reports and logs in the current directory |
|
1436 foreach $file(@filelist) |
|
1437 { |
|
1438 if($file eq "." or $file eq "..") {next}; |
|
1439 |
|
1440 # Read results STIF testreport |
|
1441 if($file =~ m/^TestReport[a-z0-9_]+\.txt$/i or $file =~ m/^TestReport\.txt$/i ) |
|
1442 { |
|
1443 my @fileDate; |
|
1444 $fileDate[0] = $file; |
|
1445 |
|
1446 if( !open(FILE_HANDLE, $file) ) { |
|
1447 print("ERROR! Could not open file '" . $file . "'\n"); |
|
1448 return; |
|
1449 } |
|
1450 my @array = <FILE_HANDLE>; |
|
1451 close(FILE_HANDLE); |
|
1452 |
|
1453 #Monday 25th August 2008 |
|
1454 my @pieces = split(' ', $array[1]); |
|
1455 |
|
1456 $pieces[1] =~ s/st//; |
|
1457 $pieces[1] =~ s/nd//; |
|
1458 $pieces[1] =~ s/rd//; |
|
1459 $pieces[1] =~ s/th//; |
|
1460 |
|
1461 $fileDate[1] = substr( $pieces[0], 0, 3 ) . " " . $pieces[1] . " " . substr( $pieces[2], 0, 3 ); |
|
1462 |
|
1463 undef(@array); |
|
1464 |
|
1465 push @$refDates, \@fileDate; |
|
1466 } |
|
1467 } |
|
1468 } |
|
1469 |
|
1470 #------------------------------------------------------------------------------------ |
|
1471 # ParseTimeFromLine |
|
1472 # |
|
1473 #------------------------------------------------------------------------------------ |
|
1474 sub ParseTimeFromLine |
|
1475 { |
|
1476 my ($line) = @_; |
|
1477 |
|
1478 my $timestr = ""; |
|
1479 |
|
1480 if($line =~ m/([0-9]+)(:[0-9]+:[0-9]+\,[0-9]*)/i || $line =~ m/([0-9]+)(:[0-9]+:[0-9]+\.[0-9]*)/i) |
|
1481 { |
|
1482 $timestr = "" . $1 . $2; |
|
1483 if($1 > 12) |
|
1484 { |
|
1485 $timestr = "" . ($1-12) . $2; |
|
1486 } |
|
1487 } |
|
1488 |
|
1489 return $timestr; |
|
1490 } |
|
1491 |
|
1492 #------------------------------------------------------------------------------------ |
|
1493 # ReadTestRunInfoFromStifReport |
|
1494 # |
|
1495 # Parameters: |
|
1496 # $file, the testreport |
|
1497 # $refCaseResults, results for all cases of the testreport |
|
1498 # $refLogFiles, filenames for the log files of the testreport |
|
1499 #------------------------------------------------------------------------------------ |
|
1500 sub ReadTestRunInfoFromStifReport |
|
1501 { |
|
1502 my ($file, $refCaseResults, $refLogFiles) = @_; |
|
1503 |
|
1504 if( !open(FILE_HANDLE, $file) ) { |
|
1505 print("ERROR! Could not open file '" . $file . "'\n"); |
|
1506 return; |
|
1507 } |
|
1508 my @array = <FILE_HANDLE>; |
|
1509 close(FILE_HANDLE); |
|
1510 |
|
1511 # Get log files for the report |
|
1512 GetReportLogFileNames($file, $refLogFiles); |
|
1513 |
|
1514 my $index = 0; |
|
1515 my $line = ""; |
|
1516 |
|
1517 for(my $i = 0; $i < scalar(@array); $i++) |
|
1518 { |
|
1519 $line = $array[$i]; |
|
1520 RemoveWhiteSpaces(\$line); |
|
1521 |
|
1522 #[testscripter_iptvservicetest][C:\TestFramework\IptvServiceTest.cfg][10] Title:[ET9009 Set id] |
|
1523 #[testscripter][c:\testframework\iptvvoddlapitest2.cfg][2] Title:[ET12100 Purchase] |
|
1524 # StartTime: 8:54:23.5565 PM, EndTime: 8:54:24.3471 PM |
|
1525 # Result: 0 [] ==> PASSED |
|
1526 # Info: xxx |
|
1527 |
|
1528 # found a start of a result |
|
1529 #[1] Title:[ET1000 Add multiple Iaps] |
|
1530 my $cfgFile = ""; |
|
1531 |
|
1532 if($line =~ m/([a-z_0-9.]+)\]\[[0-9]+\][ ]+Title:\[/i) |
|
1533 { |
|
1534 $cfgFile = $1; |
|
1535 if($optionShowMessages) { print(" - Cfg: $cfgFile\n"); }; |
|
1536 |
|
1537 for( my $e = 0; $e < scalar( @gCfgFiles ); $e++ ) |
|
1538 { |
|
1539 if( $gCfgFiles[$e] =~ m/$cfgFile/i ) |
|
1540 { |
|
1541 my $caseCount = ParseCfg( $gCfgFiles[$e] ); |
|
1542 $gCfgFiles[$e] = ""; # We don't want to read it again. |
|
1543 } |
|
1544 } |
|
1545 } |
|
1546 |
|
1547 if($line =~ m/\[[0-9]+\][ ]+Title:\[($regexpCaseName)\]$/i) |
|
1548 { |
|
1549 if($optionShowMessages) { print(" - Case: " . $1 . "\n"); }; |
|
1550 |
|
1551 #get the case name |
|
1552 my $caseName = $1; |
|
1553 my $caseId = GetCaseIdFromName($caseName); |
|
1554 my $caseRunTime = CountCaseRunTime($array[$i+1]); |
|
1555 |
|
1556 # Save case report lines for later use |
|
1557 my $caseLine1 = $array[$i]; |
|
1558 my $caseLine2 = $array[$i+1]; |
|
1559 my $caseLine3 = $array[$i+2]; |
|
1560 |
|
1561 # Read the case result |
|
1562 |
|
1563 # StartTime: 3:54:10.1670 PM, EndTime: 3:54:23.8226 PM |
|
1564 $line = $array[$i+2]; |
|
1565 RemoveWhiteSpaces(\$line); |
|
1566 |
|
1567 my $info = ""; |
|
1568 my $result = "N/A"; |
|
1569 my $status = "$caseDefaultStatus"; |
|
1570 my $reason = ""; |
|
1571 |
|
1572 # Result: 0 [] ==> PASSED / something |
|
1573 if($line =~ m/^Result:[ ]([-]*[0-9]+)[ ]\[[\w]*\][ ]==>[ ]([\w ]+)$/i) |
|
1574 { |
|
1575 $result = $1; |
|
1576 $status = $2; |
|
1577 } |
|
1578 # Result: -2 [CTestRunner::RunError [CTestRunner::ExecuteCommandL returned error]] ==> FAILED |
|
1579 # Result: -2 [CTestRunner::ExecuteCommandL returned error] ==> FAILED |
|
1580 elsif($line =~ m/^Result:[ ]([-]*[0-9]+)[ ]\[([\w: ]+)\][ ]==>[ ]([\w]+)$/i or |
|
1581 $line =~ m/^Result:[ ]([-]*[0-9]+)[ ]\[[\w: ]+\[([\w: ]+)\]\][ ]==>[ ]([\w]+)$/i ) |
|
1582 { |
|
1583 $result = $1; |
|
1584 $status = $3; |
|
1585 $reason = $2; |
|
1586 } |
|
1587 |
|
1588 #CaseExecutionResult: Test case execution fails with -15 |
|
1589 elsif($line =~ m/^CaseExecutionResult:[ ]Test case execution fails with ([-]*[0-9]+)$/i) |
|
1590 { |
|
1591 $result = $1; |
|
1592 $status = "FAILED"; |
|
1593 $reason = "Test case execution failed."; |
|
1594 } |
|
1595 |
|
1596 # CaseExecutionResult: Leave during case: with -4 |
|
1597 elsif($line =~ m/^CaseExecutionResult:[ ]Leave during case: with ([-]*[0-9]+)$/i) |
|
1598 { |
|
1599 $result = $1; |
|
1600 $status = "FAILED"; |
|
1601 $reason = "Leave during case"; |
|
1602 } |
|
1603 #CaseExecutionResult: Crash reason:Error in test ca with 69 |
|
1604 #CaseExecutionResult: Crash reason:IptvEngineServer with 13 |
|
1605 elsif($line =~ m/^CaseExecutionResult:[ ]Crash reason:([\w_ \-]+)[ ]with[ ]([-]*[0-9]+)$/i) |
|
1606 { |
|
1607 $result = $2; |
|
1608 $status = "CRASHED"; |
|
1609 $reason = $1; |
|
1610 } |
|
1611 |
|
1612 # Result: -2 [Crash reason:KERN-EXEC] ==> FAILED |
|
1613 elsif($line =~ m/^Result:[ ]([-]*[0-9]+)[ ]\[Crash reason:([\w\-:\. ]+)\] ==> ([\w]+)/i) |
|
1614 { |
|
1615 $result = $1; |
|
1616 $status = "CRASHED"; |
|
1617 $reason = $2; |
|
1618 } |
|
1619 |
|
1620 # CaseExecutionResult: TestModule loading fails, cannot connect to the TestModule with -2 |
|
1621 elsif($line =~ m/^CaseExecutionResult: TestModule loading fails, cannot connect to the TestModule with ([-]*[0-9]+)/i) |
|
1622 { |
|
1623 $result = $1; |
|
1624 $status = "FAILED"; |
|
1625 $reason = "Test module loading failed."; |
|
1626 } |
|
1627 else |
|
1628 { |
|
1629 print("Error while parsing case result line: " . $line . "\n"); |
|
1630 } |
|
1631 |
|
1632 $line = $array[$i+3]; |
|
1633 RemoveWhiteSpaces(\$line); |
|
1634 |
|
1635 # Info: xxx |
|
1636 if($line =~ m/^Info:/i) |
|
1637 { |
|
1638 $info = substr($line, 5) . " / "; |
|
1639 RemoveWhiteSpaces(\$info); |
|
1640 $info .= " "; |
|
1641 } |
|
1642 |
|
1643 my @caseResult; |
|
1644 |
|
1645 $caseResult[$CASE_CFG_FILE] = $cfgFile; |
|
1646 $caseResult[$CASE_NAME] = $caseName; |
|
1647 $caseResult[$CASE_ID] = $caseId; |
|
1648 $caseResult[$CASE_RUN_TIME_SECONDS] = $caseRunTime; |
|
1649 $caseResult[$CASE_NOTE] = $info; |
|
1650 $caseResult[$CASE_RESULT] = $result; |
|
1651 $caseResult[$CASE_STATUS] = $status; |
|
1652 $caseResult[$CASE_REASON] = $reason; |
|
1653 $caseResult[$CASE_REPORTLINE1] = $caseLine1; |
|
1654 $caseResult[$CASE_REPORTLINE2] = $caseLine2; |
|
1655 $caseResult[$CASE_REPORTLINE3] = $caseLine3; |
|
1656 |
|
1657 push @$refCaseResults, \@caseResult; |
|
1658 } |
|
1659 } |
|
1660 } |
|
1661 |
|
1662 #------------------------------------------------------------------------------------ |
|
1663 # ParseResultsAndLogs |
|
1664 # |
|
1665 # Parameters: |
|
1666 # $refCaseResults |
|
1667 # $refLogFiles |
|
1668 # $refTestScripterLogLines |
|
1669 #------------------------------------------------------------------------------------ |
|
1670 sub ParseResultsAndLogs |
|
1671 { |
|
1672 my ($refCaseResults, $refLogFiles, $refTestScripterLogLines) = @_; |
|
1673 |
|
1674 my @logLines; |
|
1675 |
|
1676 # Read log files |
|
1677 foreach $file (@$refLogFiles) |
|
1678 { |
|
1679 $file =~ s/\//\\/g; |
|
1680 |
|
1681 print("Reading log file: " . $file . " .. "); |
|
1682 |
|
1683 if( open(FILE_HANDLE, $file) ) |
|
1684 { |
|
1685 my @tempArray = <FILE_HANDLE>; |
|
1686 close(FILE_HANDLE); |
|
1687 |
|
1688 FormatFasttraceTraces(\@tempArray); |
|
1689 print " .. "; |
|
1690 |
|
1691 while(scalar(@tempArray) > 0) |
|
1692 { |
|
1693 push @logLines, (shift(@tempArray)); |
|
1694 } |
|
1695 print " done.\n"; |
|
1696 |
|
1697 undef(@tempArray); |
|
1698 } |
|
1699 else |
|
1700 { |
|
1701 print("ERROR: Could not open the log file: $file!\n"); |
|
1702 } |
|
1703 } |
|
1704 |
|
1705 FindAndMarkCaseEntriesInLog( \@logLines, $refCaseResults ); |
|
1706 |
|
1707 my @caseSpecificLogs; |
|
1708 |
|
1709 foreach $refCaseResult (@$refCaseResults) |
|
1710 { |
|
1711 my $cfgFile = @$refCaseResult[$CASE_CFG_FILE]; |
|
1712 my $caseName = @$refCaseResult[$CASE_NAME]; |
|
1713 my $caseId = @$refCaseResult[$CASE_ID]; |
|
1714 my $caseRunTime = @$refCaseResult[$CASE_RUN_TIME_SECONDS]; |
|
1715 my $info = @$refCaseResult[$CASE_NOTE]; |
|
1716 my $result = @$refCaseResult[$CASE_RESULT]; |
|
1717 my $status = @$refCaseResult[$CASE_STATUS]; |
|
1718 my $reason = @$refCaseResult[$CASE_REASON]; |
|
1719 my $reportLine1 = @$refCaseResult[$CASE_REPORTLINE1]; |
|
1720 my $reportLine2 = @$refCaseResult[$CASE_REPORTLINE2]; |
|
1721 my $reportLine3 = @$refCaseResult[$CASE_REPORTLINE3]; |
|
1722 |
|
1723 if($optionShowMessages) { print(" - Case: " . $caseName . "\n"); }; |
|
1724 |
|
1725 # Create case specific log into the log directory |
|
1726 my $caseLogFile = GetCaseField($caseId, $CASE_LOG_FILE); |
|
1727 my $caseScripterLogFile = GetCaseField($caseId, $CASE_LOG_FILE_SCRIPTER); |
|
1728 my $refCaseDesc = GetCaseDesc($caseId); |
|
1729 |
|
1730 $caseLogFile = GetFileNameForCaseLog( $reportLine1, $reportLine2, $reportLine3 ); |
|
1731 $caseScripterLogFile = GetFileNameForCaseLog( $reportLine1, $reportLine2, $reportLine3, "_scripter" ); |
|
1732 |
|
1733 if( -e $caseLogFile ) |
|
1734 { |
|
1735 unlink ( $caseLogFile ); |
|
1736 } |
|
1737 |
|
1738 if( -e $caseScripterLogFile ) |
|
1739 { |
|
1740 unlink ( $caseScripterLogFile ); |
|
1741 } |
|
1742 |
|
1743 my @logInfo; |
|
1744 $logInfo[0] = $caseLogFile; |
|
1745 if( defined( @$refCaseResult[$CASE_CHECK_RESULT_LOG_FILE] ) ) |
|
1746 { |
|
1747 # Case start entry trace was found from log. |
|
1748 $logInfo[1] = @$refCaseResult[$CASE_ENTRY_LOG_START]; |
|
1749 } |
|
1750 else |
|
1751 { |
|
1752 $logInfo[1] = -1; |
|
1753 } |
|
1754 $logInfo[2] = $reportLine1; |
|
1755 $logInfo[3] = $reportLine2; |
|
1756 $logInfo[4] = $reportLine3; |
|
1757 $logInfo[5] = $refCaseDesc; |
|
1758 $logInfo[6] = $caseScripterLogFile; |
|
1759 push @caseSpecificLogs, \@logInfo; |
|
1760 |
|
1761 # Update case |
|
1762 my $refCase = GetCase($caseId, \@cases); |
|
1763 if(!defined($refCase)) |
|
1764 { |
|
1765 $refCase = GetCaseByNameOnly($caseName); |
|
1766 } |
|
1767 |
|
1768 if(defined($refCase)) |
|
1769 { |
|
1770 UpdateCase($refCase, $caseLogFile, $caseScripterLogFile, $result, $status, $info, $reason, $caseRunTime); |
|
1771 } |
|
1772 else |
|
1773 { |
|
1774 # Case doesn't exist yet, add it. |
|
1775 my @case; |
|
1776 $case[$CASE_NAME] = $caseName; |
|
1777 $case[$CASE_ID] = $caseId; |
|
1778 $case[$CASE_RUN_TIMES] = 0; |
|
1779 $case[$CASE_CRASHED] = 0; |
|
1780 $case[$CASE_FAILED] = 0; |
|
1781 $case[$CASE_PASSED] = 0; |
|
1782 $case[$CASE_STATUS] = "$caseDefaultStatus"; |
|
1783 $case[$CASE_PURPOSE] = "N/A"; |
|
1784 $case[$CASE_MEANS] = "N/A"; |
|
1785 $case[$CASE_REQUIRED_SETTINGS] = "N/A"; |
|
1786 $case[$CASE_RELATED_REQUIREMENTS] = "N/A"; |
|
1787 $case[$CASE_VERIFICATION] = "N/A"; |
|
1788 $case[$CASE_NOTE] = "N/A"; |
|
1789 $case[$CASE_REASON] = ""; |
|
1790 $case[$CASE_RESULT] = ""; |
|
1791 $case[$CASE_LOG_FILE] = ""; |
|
1792 $case[$CASE_LOG_FILE_SCRIPTER] = ""; |
|
1793 $case[$CASE_CHECK_RESULT_LOG_FILE] = 0; |
|
1794 $case[$CASE_CFG_FILE] = $cfgFile; |
|
1795 $case[$CASE_RUN_TIME_SECONDS] = 0; |
|
1796 |
|
1797 $refCase = GetCaseByNameOnly($caseName); |
|
1798 |
|
1799 UpdateCase(\@case, $caseLogFile, $caseScripterLogFile, $result, $status, $info, $reason, $caseRunTime); |
|
1800 |
|
1801 # Insert case after other cases from same CFG, if any. |
|
1802 |
|
1803 my $indexToInsert = -1; |
|
1804 |
|
1805 for( my $i = 0; $i < scalar(@cases); $i++ ) |
|
1806 { |
|
1807 my $case = $cases[$i]; |
|
1808 |
|
1809 if( defined(@$case[$CASE_CFG_FILE]) ) |
|
1810 { |
|
1811 if( @$case[$CASE_CFG_FILE] eq $cfgFile ) |
|
1812 { |
|
1813 $indexToInsert = $i; |
|
1814 } |
|
1815 } |
|
1816 } |
|
1817 |
|
1818 if( $indexToInsert == -1 ) |
|
1819 { |
|
1820 push @cases, [ @case ]; |
|
1821 } |
|
1822 else |
|
1823 { |
|
1824 splice @cases, $indexToInsert+1, 0, [ @case ]; |
|
1825 } |
|
1826 } |
|
1827 } |
|
1828 |
|
1829 my $caseCount = scalar( @$refCaseResults ); |
|
1830 |
|
1831 my @testScripterLogCaseLocations; |
|
1832 PrepareTestScripterLogs( $refTestScripterLogLines, \@testScripterLogCaseLocations ); |
|
1833 WriteCaseSpecificScripterLogs( \@caseSpecificLogs, $refTestScripterLogLines, \@testScripterLogCaseLocations ); |
|
1834 WriteCaseSpecificLogs( \@caseSpecificLogs, $caseCount, \@logLines ); |
|
1835 |
|
1836 if($caseCount >= 10 && $optionShowMessages == 0) |
|
1837 { |
|
1838 print("\n"); #line break for the progress bar |
|
1839 } |
|
1840 elsif($optionShowMessages == 0) |
|
1841 { |
|
1842 print("##########\n"); # fake it |
|
1843 } |
|
1844 |
|
1845 undef(@logLines); |
|
1846 } |
|
1847 |
|
1848 #------------------------------------------------------------------------------------ |
|
1849 # WriteCaseSpecificLogs |
|
1850 # |
|
1851 # Parameters: |
|
1852 # $refCaseSpecificLogs |
|
1853 # $caseCount |
|
1854 # $refLogLines |
|
1855 #------------------------------------------------------------------------------------ |
|
1856 sub WriteCaseSpecificLogs |
|
1857 { |
|
1858 my ($refCaseSpecificLogs, $caseCount, $refLogLines ) = @_; |
|
1859 |
|
1860 my $caseLogProgress = 0; |
|
1861 |
|
1862 foreach my $refLogInfo ( @$refCaseSpecificLogs ) |
|
1863 { |
|
1864 #@logInfo[1] = @$refCaseResult[$CASE_ENTRY_LOG_START]; |
|
1865 |
|
1866 my $caseLogFile = @$refLogInfo[0]; |
|
1867 my $reportLine1 = @$refLogInfo[2]; |
|
1868 my $reportLine2 = @$refLogInfo[3]; |
|
1869 my $reportLine3 = @$refLogInfo[4]; |
|
1870 my $refCaseDesc = @$refLogInfo[5]; |
|
1871 |
|
1872 my $logWritten = 0; |
|
1873 if( @$refLogInfo[1] != -1 ) |
|
1874 { |
|
1875 # Case start entry trace found from log files. |
|
1876 $logWritten = WriteCaseLogFromEntry($caseLogFile, $refLogLines, @$refLogInfo[1], $reportLine1, $reportLine2, $reportLine3); |
|
1877 } |
|
1878 |
|
1879 if( !$logWritten ) |
|
1880 { |
|
1881 # Use case start and end times to write case specific log. |
|
1882 WriteCaseLog($caseLogFile, $refLogLines, $refCaseDesc, $reportLine1, $reportLine2, $reportLine3); |
|
1883 } |
|
1884 |
|
1885 # Show simple progress bar |
|
1886 if($caseCount >= 10 && $optionShowMessages == 0) |
|
1887 { |
|
1888 $caseLogProgress++; |
|
1889 if($caseLogProgress > $caseCount/10) |
|
1890 { |
|
1891 $caseLogProgress = 0; |
|
1892 print("#"); |
|
1893 } |
|
1894 } |
|
1895 } |
|
1896 |
|
1897 if($caseCount >= 10 && $optionShowMessages == 0) |
|
1898 { |
|
1899 print("\n"); #line break for the progress bar |
|
1900 } |
|
1901 elsif($optionShowMessages == 0) |
|
1902 { |
|
1903 print("##########\n"); # fake it |
|
1904 } |
|
1905 } |
|
1906 |
|
1907 #------------------------------------------------------------------------------------ |
|
1908 # PrepareTestScripterLogs |
|
1909 # |
|
1910 # Parameters: |
|
1911 # $refTestScripterLogLines |
|
1912 # $refTestScripterLogCaseLocations |
|
1913 #------------------------------------------------------------------------------------ |
|
1914 sub PrepareTestScripterLogs |
|
1915 { |
|
1916 my ($refTestScripterLogLines, $refTestScripterLogCaseLocations ) = @_; |
|
1917 |
|
1918 for( my $i = 0; $i < scalar(@$refTestScripterLogLines); $i++ ) |
|
1919 { |
|
1920 my $line = @$refTestScripterLogLines[$i]; |
|
1921 |
|
1922 if( $line =~ m/RunTest:/ ) |
|
1923 { |
|
1924 push @$refTestScripterLogCaseLocations, ( $i ); |
|
1925 } |
|
1926 } |
|
1927 } |
|
1928 |
|
1929 #------------------------------------------------------------------------------------ |
|
1930 # WriteCaseSpecificScripterLogs |
|
1931 # |
|
1932 # Parameters: |
|
1933 # $refLogFiles |
|
1934 # $refCaseResults |
|
1935 # $refTestScripterLogCaseLocations |
|
1936 #------------------------------------------------------------------------------------ |
|
1937 sub WriteCaseSpecificScripterLogs |
|
1938 { |
|
1939 my ($refCaseSpecificLogs, $refScripterLogLines, $refTestScripterLogCaseLocations ) = @_; |
|
1940 |
|
1941 foreach my $refLogInfo ( @$refCaseSpecificLogs ) |
|
1942 { |
|
1943 my $caseLogFile = @$refLogInfo[6]; |
|
1944 my $reportLine1 = @$refLogInfo[2]; |
|
1945 my $reportLine2 = @$refLogInfo[3]; |
|
1946 my $reportLine3 = @$refLogInfo[4]; |
|
1947 my $refCaseDesc = @$refLogInfo[5]; |
|
1948 |
|
1949 WriteCaseLogFromTestScripterLogs( $caseLogFile, $refScripterLogLines, $refTestScripterLogCaseLocations, $refCaseDesc, $reportLine1, $reportLine2, $reportLine3); |
|
1950 } |
|
1951 } |
|
1952 |
|
1953 #------------------------------------------------------------------------------------ |
|
1954 # WriteCaseLogFromTestScripterLogs |
|
1955 # |
|
1956 #------------------------------------------------------------------------------------ |
|
1957 sub WriteCaseLogFromTestScripterLogs |
|
1958 { |
|
1959 my ( $caseLogFile, $refLogLines, $refTestScripterLogCaseLocations, $refCaseDesc, $line1, $line2, $line3 ) = @_; |
|
1960 |
|
1961 print("### WriteCaseLogFromTestScripterLogs") if( $optionDebug ); |
|
1962 |
|
1963 # Don't generate log files if we only print summary |
|
1964 if($optionPrintCfgSummaries) |
|
1965 { |
|
1966 return; |
|
1967 } |
|
1968 |
|
1969 RemoveWhiteSpaces(\$line1); |
|
1970 RemoveWhiteSpaces(\$line2); |
|
1971 RemoveWhiteSpaces(\$line3); |
|
1972 |
|
1973 my $lineBreak = "\n"; |
|
1974 $lineBreak = "<br>\n" if($optionHtml); |
|
1975 |
|
1976 my $caseName = ""; |
|
1977 |
|
1978 if($line1 =~ m/\[[0-9]+\][ ]+Title:\[([a-z0-9]+$regexpCaseName)\]$/i) |
|
1979 { |
|
1980 #"' ultraedit |
|
1981 $caseName = $1; |
|
1982 print(" Writing scripter log for: $caseName.\n") if($optionShowMessages); |
|
1983 } |
|
1984 else |
|
1985 { |
|
1986 return; |
|
1987 } |
|
1988 |
|
1989 # Write header for case |
|
1990 |
|
1991 my @writeArray; |
|
1992 |
|
1993 # split the first line |
|
1994 push @writeArray, ( "<hr>" ) if($optionHtml); |
|
1995 push @writeArray, ( substr($line1, 0, index($line1, "Title:")) . $lineBreak ); |
|
1996 push @writeArray, ( substr($line1, index($line1, "Title:")) . $lineBreak ); |
|
1997 my $title = substr($line1, index($line1, "Title:")); |
|
1998 |
|
1999 #($line1 . "\n"); |
|
2000 push @writeArray, ($line2 . $lineBreak); |
|
2001 push @writeArray, ($line3 . $lineBreak); |
|
2002 push @writeArray, ("\n"); |
|
2003 push @writeArray, ( "<hr>" ) if($optionHtml); |
|
2004 |
|
2005 # Include the script for the case in the file? |
|
2006 |
|
2007 if($optionCaseIncludedInLog) |
|
2008 { |
|
2009 foreach $linexxx (@{$refCaseDesc}) |
|
2010 { |
|
2011 push @writeArray, ("$linexxx"); |
|
2012 push @writeArray, ($lineBreak) if($optionHtml); |
|
2013 } |
|
2014 push @writeArray, ( "<hr>" ) if($optionHtml); |
|
2015 push @writeArray, ("\n"); |
|
2016 } |
|
2017 |
|
2018 # Create log directory |
|
2019 |
|
2020 if ( !(-e "testcase_logs") ) |
|
2021 { |
|
2022 mkdir("testcase_logs"); |
|
2023 } |
|
2024 |
|
2025 if ( !(-e "$caseLogOutDir") ) |
|
2026 { |
|
2027 mkdir($caseLogOutDir, 0755); |
|
2028 } |
|
2029 |
|
2030 # Find start and end lines for the case. |
|
2031 my $startLine = -1; |
|
2032 my $endLine = -1; |
|
2033 |
|
2034 my $caseNameRegexp = $caseName; |
|
2035 $caseNameRegexp =~s/\)/\\\)/; |
|
2036 $caseNameRegexp =~s/\(/\\\(/; |
|
2037 |
|
2038 # Try to find case start from cached locations. |
|
2039 foreach my $lineNum ( @$refTestScripterLogCaseLocations ) |
|
2040 { |
|
2041 if( @$refLogLines[$lineNum] =~ m/RunTest: $caseNameRegexp/ ) |
|
2042 { |
|
2043 print(" - found cached start: $lineNum") if( $optionDebug ); |
|
2044 $startLine = $lineNum; |
|
2045 last; |
|
2046 } |
|
2047 } |
|
2048 |
|
2049 for( my $i = $startLine; $i < scalar(@$refLogLines); $i++ ) |
|
2050 { |
|
2051 $i++ if( $i < 0 ); |
|
2052 |
|
2053 my $line = @$refLogLines[$i]; |
|
2054 |
|
2055 next if( !defined $line ); |
|
2056 |
|
2057 # Case start was not found from cached locations, find it as we go thru the lines. |
|
2058 if( $startLine == -1 ) |
|
2059 { |
|
2060 if( $line =~ m/RunTest: $caseNameRegexp/ ) |
|
2061 { |
|
2062 print(" - found start: $line") if( $optionDebug ); |
|
2063 $startLine = $i; |
|
2064 } |
|
2065 } |
|
2066 else |
|
2067 { |
|
2068 if( $line =~ m/\*\*\*Testcase [a-z]+\*\*\*/i ) |
|
2069 { |
|
2070 print(" - found end: $line") if( $optionDebug ); |
|
2071 $endLine = $i + 1; |
|
2072 last; |
|
2073 } |
|
2074 } |
|
2075 } |
|
2076 |
|
2077 if( $startLine == -1 || $endLine == -1 ) |
|
2078 { |
|
2079 return; |
|
2080 } |
|
2081 |
|
2082 # Write the log file |
|
2083 |
|
2084 my $fileMode = ">>"; |
|
2085 |
|
2086 print(" - Case log file: " . $caseLogFile ."\n") if($optionShowMessages); |
|
2087 |
|
2088 if( open(FILE_HANDLE, $fileMode . $caseLogFile) ) |
|
2089 { |
|
2090 if($optionHtml) |
|
2091 { |
|
2092 print FILE_HANDLE ( |
|
2093 "<html>\n" . |
|
2094 "<head>\n" . |
|
2095 "<title>$title</title>\n" . |
|
2096 "</head>\n" . |
|
2097 "<body>\n" . |
|
2098 "<basefont color=\"black\" face=\"arial\" size=\"4\">\n" |
|
2099 ); |
|
2100 } |
|
2101 |
|
2102 foreach $line(@writeArray) |
|
2103 { |
|
2104 print FILE_HANDLE ($line); |
|
2105 } |
|
2106 |
|
2107 for( my $i = $startLine; $i < $endLine; $i++ ) |
|
2108 { |
|
2109 my $line = @$refLogLines[$i]; |
|
2110 FormatLogLine(\$line) if($optionHtml); |
|
2111 |
|
2112 print FILE_HANDLE ($line); |
|
2113 } |
|
2114 |
|
2115 if($optionHtml) |
|
2116 { |
|
2117 print FILE_HANDLE ( |
|
2118 "</body>\n" . |
|
2119 "</html>" |
|
2120 ); |
|
2121 } |
|
2122 |
|
2123 print FILE_HANDLE ( $lineBreak ); |
|
2124 print FILE_HANDLE ( $lineBreak ); |
|
2125 |
|
2126 close FILE_HANDLE; |
|
2127 |
|
2128 } else |
|
2129 { |
|
2130 print("ERROR: Could not write to file: " . $caseLogFile . "\n"); |
|
2131 } |
|
2132 } |
|
2133 |
|
2134 #------------------------------------------------------------------------------------ |
|
2135 # CheckCaseEntriesInLog |
|
2136 # |
|
2137 # Parameters: |
|
2138 # $refLogLines: reference to array of log lines |
|
2139 # |
|
2140 # Finds if there's log entries for cases that are not reported in the testreport files |
|
2141 # and create case specific logs for them |
|
2142 #------------------------------------------------------------------------------------ |
|
2143 sub CheckCaseEntriesInLog |
|
2144 { |
|
2145 my ($refLogLines) = @_; |
|
2146 |
|
2147 foreach $case(@cases) |
|
2148 { |
|
2149 if(@{$case}[$CASE_CHECK_RESULT_LOG_FILE] == 1) |
|
2150 { |
|
2151 @{$case}[$CASE_CHECK_RESULT_LOG_FILE] = 0; |
|
2152 |
|
2153 #create the next lines for WriteCaseLog function |
|
2154 |
|
2155 #line1: [testscripter_iptvservicemanagementapitestasync][c:\TestFramework\IptvServiceManagementApiTestAsync.cfg][2] Title:[ET08203 Add valid hardcoded service_0 ASYNC] |
|
2156 #line2: StartTime: 3:06:14.2212 PM, EndTime: 3:06:18.1037 PM |
|
2157 #line3: Result: 0 [] ==> PASSED |
|
2158 |
|
2159 #starttime = case startline |
|
2160 #endttime = next case starttline | lastline |
|
2161 |
|
2162 my $line1 = "[unknown.cfg][0] Title:[" . @{$case}[$CASE_NAME] . "]"; |
|
2163 my $line2 = ""; |
|
2164 my $line3 = "Result: 0 [] ==> UNKNOWN"; |
|
2165 |
|
2166 my $startTime = ""; |
|
2167 my $endTime = ""; |
|
2168 my $status = "UNKNOWN"; |
|
2169 my $caseLogFile = ""; |
|
2170 my $result = "0"; |
|
2171 my $info = ""; |
|
2172 my $reason = ""; |
|
2173 |
|
2174 my $caseId = ""; |
|
2175 foreach $line(@$refLogLines) |
|
2176 { |
|
2177 # take the times from lines where is case start text |
|
2178 |
|
2179 if($startTime eq "" && $line =~ m/>>> Case start:/i) |
|
2180 { |
|
2181 $caseId = substr($line, index($line, ">>> Case start:") + length(">>> Case start:")); |
|
2182 |
|
2183 RemoveWhiteSpaces(\$caseId); |
|
2184 |
|
2185 # set start time if case matches |
|
2186 #02/08/2006 12:15:42 >>> Case start: ET00000 caseId |
|
2187 if($caseId eq @{$case}[$CASE_ID]) |
|
2188 { |
|
2189 #print("*** Reading case name\n\n"); |
|
2190 if($line =~ m/([0-9]+):([0-9]+):([0-9]+)/) |
|
2191 { |
|
2192 #print("CASESTART: $line\n"); |
|
2193 $startTime = "$1:$2:$3.0000"; |
|
2194 #print("*** READ TIME $startTime\n\n"); |
|
2195 next; # skip the rest of loop otherwise endtime will be same |
|
2196 } |
|
2197 } |
|
2198 } |
|
2199 |
|
2200 # find endtime for case if starttime is set |
|
2201 if($startTime ne "") |
|
2202 { |
|
2203 #[14:38:40.641] sti: MCU_ASCII_PRINTF; channel:0xE0; msg:TestCase [ET1024 Sort IapList when it has no IAPs] finished with verdict[0] |
|
2204 |
|
2205 #die("$line") if($line =~m/$caseId/i); |
|
2206 #die("line: $line\n") if($line =~ m/finished with verdict/); |
|
2207 |
|
2208 if($line =~ m/$caseId/i and $line =~ m/finished with verdict\[([-]*[0-9]+)\]/) |
|
2209 { |
|
2210 |
|
2211 $result = $1; |
|
2212 |
|
2213 if($1 eq "0") |
|
2214 { |
|
2215 $status = "PASSED"; |
|
2216 $line3 = "Result: $1 [] ==> PASSED"; |
|
2217 } |
|
2218 else |
|
2219 { |
|
2220 $status = "FAILED"; |
|
2221 $line3 = "Result: $1 [] ==> FAILED"; |
|
2222 } |
|
2223 } |
|
2224 |
|
2225 #if line has time then grab it |
|
2226 if($line =~ m/([0-9]+):([0-9]+):([0-9]+)/) |
|
2227 { |
|
2228 $endTime = "$1:$2:$3.9999"; |
|
2229 # stop searching when next case is starting |
|
2230 if( ($line =~ m/>>> Case start:/i || $line =~ m/>>> Case end./i) and !($line =~ m/$caseId/) ) |
|
2231 { |
|
2232 #print("CASEEND: $line\n"); |
|
2233 last; |
|
2234 } |
|
2235 } |
|
2236 } |
|
2237 |
|
2238 } |
|
2239 |
|
2240 $line2 = "StartTime: $startTime PM, EndTime: $endTime PM"; |
|
2241 |
|
2242 #print("l1: $line1\nl2: $line2\nl3: $line3\n\n"); |
|
2243 |
|
2244 my $refCaseDesc = GetCaseDesc($caseId); |
|
2245 |
|
2246 $caseLogFile = GetFileNameForCaseLog( $line1, $line2, $line3 ); |
|
2247 |
|
2248 WriteCaseLog($caseLogFile, $refLogLines, $refCaseDesc, $line1, $line2, $line3); |
|
2249 |
|
2250 my $refCase = GetCase($caseId, \@cases); |
|
2251 |
|
2252 UpdateCase($refCase, $caseLogFile, "", $result, $status, $info, $reason, 0); |
|
2253 } |
|
2254 } |
|
2255 } |
|
2256 |
|
2257 sub UpdateCase |
|
2258 { |
|
2259 my ($refCase, $caseLogFile, $caseScripterLogFile, $result, $status, $info, $reason, $caseRunTimeSeconds) = @_; |
|
2260 |
|
2261 if($optionShowMessages) { print(" - Case update: $result, $status, $reason, $caseRunTimeSeconds\n\n"); }; |
|
2262 |
|
2263 die("Result not defined. Cannot update.\n") if(!defined($result) ); |
|
2264 die("Status not defined. Cannot update.\n") if(!defined($status) ); |
|
2265 die("Info not defined. Cannot update.\n") if( !defined($info) ); |
|
2266 die("Reason not defined. Cannot update.\n") if( !defined($reason) ); |
|
2267 |
|
2268 $caseRunTimeSeconds = 0 if($caseRunTimeSeconds < 0); |
|
2269 |
|
2270 # we have actual result, no need for this anymore |
|
2271 @$refCase[$CASE_CHECK_RESULT_LOG_FILE] = 0; |
|
2272 |
|
2273 if(!$optionFinalDoc) |
|
2274 { |
|
2275 @$refCase[$CASE_RUN_TIMES]++; |
|
2276 |
|
2277 @$refCase[$CASE_RUN_TIME_SECONDS] = $caseRunTimeSeconds; |
|
2278 |
|
2279 if($status eq "CRASHED") { |
|
2280 @$refCase[$CASE_CRASHED]++; |
|
2281 } |
|
2282 elsif($status eq "FAILED") { |
|
2283 @$refCase[$CASE_FAILED]++; |
|
2284 } |
|
2285 elsif($status eq "PASSED") { |
|
2286 @$refCase[$CASE_PASSED]++; |
|
2287 } |
|
2288 } |
|
2289 else |
|
2290 { |
|
2291 if($status eq "PASSED") { |
|
2292 @$refCase[$CASE_PASSED] = 1; |
|
2293 @$refCase[$CASE_CRASHED] = 0; |
|
2294 @$refCase[$CASE_FAILED] = 0; |
|
2295 } |
|
2296 elsif($status eq "CRASHED" && @$refCase[$CASE_STATUS] ne "PASSED") { |
|
2297 @$refCase[$CASE_PASSED] = 0; |
|
2298 @$refCase[$CASE_CRASHED] = 1; |
|
2299 @$refCase[$CASE_FAILED] = 0; |
|
2300 } |
|
2301 elsif($status eq "FAILED" && @$refCase[$CASE_STATUS] ne "PASSED" && @$refCase[$CASE_STATUS] ne "CRASHED") { |
|
2302 @$refCase[$CASE_PASSED] = 0; |
|
2303 @$refCase[$CASE_CRASHED] = 0; |
|
2304 @$refCase[$CASE_FAILED] = 1; |
|
2305 } |
|
2306 } |
|
2307 |
|
2308 my $updateCase = 0; |
|
2309 |
|
2310 if(!$optionGoodIsBetter and !$optionFinalDoc) |
|
2311 { |
|
2312 # Only update case status if it's more fatal than the current, CRASHED > FAILED > UNKNOWN > PASSED |
|
2313 if($status ne "$caseDefaultStatus") |
|
2314 { |
|
2315 if (@$refCase[$CASE_STATUS] eq "$caseDefaultStatus") { |
|
2316 $updateCase = 1; |
|
2317 } |
|
2318 elsif (@$refCase[$CASE_STATUS] eq "CRASHED" ) { |
|
2319 |
|
2320 } |
|
2321 elsif (@$refCase[$CASE_STATUS] eq "FAILED") { |
|
2322 $updateCase = 1 if($status eq "CRASHED"); |
|
2323 } |
|
2324 elsif(@$refCase[$CASE_STATUS] eq "PASSED") { |
|
2325 $updateCase = 1; |
|
2326 } |
|
2327 } |
|
2328 } |
|
2329 else |
|
2330 { |
|
2331 # Only update case status if it's less fatal than the current, PASSED > FAILED > CRASHED > UNKNOWN |
|
2332 if($status ne "$caseDefaultStatus") |
|
2333 { |
|
2334 if (@$refCase[$CASE_STATUS] eq "$caseDefaultStatus") { |
|
2335 $updateCase = 1; |
|
2336 } |
|
2337 elsif(@$refCase[$CASE_STATUS] eq "UNKNOWN") { |
|
2338 $updateCase = 1; |
|
2339 } |
|
2340 elsif($status eq "PASSED") |
|
2341 { |
|
2342 $updateCase = 1; |
|
2343 } |
|
2344 elsif (@$refCase[$CASE_STATUS] eq "CRASHED" ) { |
|
2345 $updateCase = 1 if($status eq "FAILED"); |
|
2346 } |
|
2347 elsif (@$refCase[$CASE_STATUS] eq "FAILED") { |
|
2348 |
|
2349 } |
|
2350 } |
|
2351 } |
|
2352 |
|
2353 if($updateCase) |
|
2354 { |
|
2355 @$refCase[$CASE_REASON] = $info . $reason; |
|
2356 @$refCase[$CASE_RESULT] = $result; |
|
2357 @$refCase[$CASE_STATUS] = $status; |
|
2358 @$refCase[$CASE_LOG_FILE] = $caseLogFile; |
|
2359 @$refCase[$CASE_LOG_FILE_SCRIPTER] = $caseScripterLogFile; |
|
2360 } |
|
2361 else |
|
2362 { |
|
2363 # -1112 overrides other error codes because the case succeeded but verifying has failed. |
|
2364 if(@$refCase[$CASE_RESULT] ne "-1112" and $result eq "-1112") |
|
2365 { |
|
2366 @$refCase[$CASE_RESULT] = $result; |
|
2367 } |
|
2368 } |
|
2369 #print "case: " . @{$case}[$CASE_NAME] . "\n" . "run: " . @{$case}[$CASE_RUN_TIMES] . ", crash: " . @{$case}[$CASE_CRASHED] . ", fail " . @{$case}[$CASE_FAILED] . ", passed: " . @{$case}[$CASE_PASSED] . "\n"; |
|
2370 } |
|
2371 |
|
2372 sub CountCaseRunTime |
|
2373 { |
|
2374 my ($line) = @_; |
|
2375 my $found = 0; |
|
2376 RemoveWhiteSpaces(\$line); |
|
2377 #StartTime: 16:12:10,2440, EndTime: 16:12:34,3880 |
|
2378 #StartTime: 12:02:49.9302 pm, EndTime: 12:03:04.5781 pm |
|
2379 if($line =~ m/^StartTime: ([0-9]+):([0-9]+):([0-9]+)\,[0-9]*, Endtime: ([0-9]+):([0-9]+):([0-9]+)\,[0-9]*$/i) |
|
2380 { |
|
2381 $found = 1; |
|
2382 } |
|
2383 elsif($line =~ m/^StartTime: ([0-9]+):([0-9]+):([0-9]+)\.[0-9]*[ A-Z]*, Endtime: ([0-9]+):([0-9]+):([0-9]+)\.[0-9]*[ A-Z]*$/i) |
|
2384 { |
|
2385 $found = 1; |
|
2386 } |
|
2387 |
|
2388 my $caseRunTime = 0; |
|
2389 |
|
2390 if($found) |
|
2391 { |
|
2392 my $startSeconds = ($1 * 60 * 60) + $2 * 60 + $3; |
|
2393 my $endSeconds = ($4 * 60 * 60) + $5 * 60 + $6; |
|
2394 |
|
2395 $caseRunTime = $endSeconds - $startSeconds; |
|
2396 } |
|
2397 $caseRunTime = 0 if($caseRunTime < 0); |
|
2398 |
|
2399 $totalExecutionTime += $caseRunTime; |
|
2400 return $caseRunTime; |
|
2401 } |
|
2402 |
|
2403 sub GetFileNameForCaseLog |
|
2404 { |
|
2405 my ($line1, $line2, $line3, $extra) = @_; |
|
2406 |
|
2407 RemoveWhiteSpaces(\$line1); |
|
2408 RemoveWhiteSpaces(\$line2); |
|
2409 RemoveWhiteSpaces(\$line3); |
|
2410 |
|
2411 my $caseId = ""; |
|
2412 |
|
2413 if($line1 =~ m/\[[0-9]+\][ ]+Title:\[([a-z0-9]+)$regexpCaseName\]$/i) |
|
2414 { |
|
2415 #"' ultraedit |
|
2416 $caseId = $1; |
|
2417 } |
|
2418 |
|
2419 my $caseTimeStr = ""; |
|
2420 |
|
2421 #StartTime: 16:12:10,2440, EndTime: 16:12:34,3880 |
|
2422 if($line2 =~ m/^StartTime: ([0-9]+):([0-9]+):([0-9]+)\,[0-9]*, Endtime: ([0-9]+):([0-9]+):([0-9]+)\,[0-9]*$/i) |
|
2423 { |
|
2424 $found = 1; |
|
2425 } |
|
2426 elsif($line2 =~ m/^StartTime: ([0-9]+):([0-9]+):([0-9]+)\.[0-9]*[ A-Z]*, Endtime: ([0-9]+):([0-9]+):([0-9]+)\.[0-9]*[ A-Z]*$/i) |
|
2427 { |
|
2428 $found = 1; |
|
2429 } |
|
2430 |
|
2431 if( $found ) |
|
2432 { |
|
2433 $caseTimeStr = $1 . $2 . $3 . $4 . $5 . $6; |
|
2434 } |
|
2435 |
|
2436 my $fileext = ".txt"; |
|
2437 $fileext = ".html" if($optionHtml); |
|
2438 |
|
2439 my $caseLogFile; |
|
2440 |
|
2441 if( !defined( $extra ) ) |
|
2442 { |
|
2443 $caseLogFile = $caseLogOutDir . $caseId . "_" . $caseTimeStr . $fileext; |
|
2444 } |
|
2445 else |
|
2446 { |
|
2447 $caseLogFile = $caseLogOutDir . $caseId . "_" . $caseTimeStr . $extra . $fileext; |
|
2448 } |
|
2449 |
|
2450 print(" - Case log file: " . $caseLogFile ."\n") if($optionShowMessages); |
|
2451 return $caseLogFile; |
|
2452 } |
|
2453 |
|
2454 #------------------------------------------------------------------------------------ |
|
2455 # WriteCaseLog |
|
2456 # |
|
2457 # Parameters: |
|
2458 # $caseLogFile: filename to write |
|
2459 # $refLogLines: input where log lines are stored |
|
2460 # $caseDesc: optional text description of case which will be written into the log file |
|
2461 # $line1: [testscripter_iptvservicemanagementapitestasync][c:\TestFramework\IptvServiceManagementApiTestAsync.cfg][2] Title:[ET08203 Add valid hardcoded service_0 ASYNC] |
|
2462 # $line2: StartTime: 3:06:14.2212 PM, EndTime: 3:06:18.1037 PM |
|
2463 # $line3: Result: 0 [] ==> PASSED |
|
2464 # |
|
2465 # Writes case specific log file into testcase_logs/testcase_logs directory. Reads the lines from @caseLogLines array |
|
2466 #------------------------------------------------------------------------------------ |
|
2467 sub WriteCaseLog |
|
2468 { |
|
2469 #[testscripter_iptvservicemanagementapitestasync][c:\TestFramework\IptvServiceManagementApiTestAsync.cfg][2] Title:[ET08203 Add valid hardcoded service_0 ASYNC] |
|
2470 # StartTime: 3:06:14.2212 PM, EndTime: 3:06:18.1037 PM |
|
2471 # StartTime: 12:34:41.5407, EndTime: 12:34:41.9687 |
|
2472 # Result: 0 [] ==> PASSED |
|
2473 |
|
2474 my ($caseLogFile, $refLogLines, $refCaseDesc, $line1, $line2, $line3) = @_; |
|
2475 |
|
2476 # Don't generate log files if we only print summary |
|
2477 if($optionPrintCfgSummaries) |
|
2478 { |
|
2479 return; |
|
2480 } |
|
2481 |
|
2482 #print("1: $line1"); print("2: $line2"); print("3: $line3"); |
|
2483 |
|
2484 RemoveWhiteSpaces(\$line1); |
|
2485 RemoveWhiteSpaces(\$line2); |
|
2486 RemoveWhiteSpaces(\$line3); |
|
2487 |
|
2488 my $lineBreak = "\n"; |
|
2489 $lineBreak = "<br>\n" if($optionHtml); |
|
2490 |
|
2491 my $caseId = ""; |
|
2492 |
|
2493 if($line1 =~ m/\[[0-9]+\][ ]+Title:\[([a-z0-9]+)$regexpCaseName\]$/i) |
|
2494 { |
|
2495 #"' ultraedit |
|
2496 $caseId = $1; |
|
2497 print("Writing log for: $caseId.\n") if($optionShowMessages); |
|
2498 } |
|
2499 |
|
2500 # Write header for case |
|
2501 |
|
2502 my @writeArray; |
|
2503 |
|
2504 # split the first line |
|
2505 push @writeArray, ( "<hr>" ) if($optionHtml); |
|
2506 push @writeArray, ( substr($line1, 0, index($line1, "Title:")) . $lineBreak ); |
|
2507 push @writeArray, ( substr($line1, index($line1, "Title:")) . $lineBreak ); |
|
2508 my $title = substr($line1, index($line1, "Title:")); |
|
2509 |
|
2510 #($line1 . "\n"); |
|
2511 push @writeArray, ($line2 . $lineBreak); |
|
2512 push @writeArray, ($line3 . $lineBreak); |
|
2513 push @writeArray, ("\n"); |
|
2514 push @writeArray, ( "<hr>" ) if($optionHtml); |
|
2515 |
|
2516 # Include the script for the case in the file? |
|
2517 |
|
2518 if($optionCaseIncludedInLog) |
|
2519 { |
|
2520 foreach $linexxx (@{$refCaseDesc}) |
|
2521 { |
|
2522 push @writeArray, ("$linexxx"); |
|
2523 push @writeArray, ($lineBreak) if($optionHtml); |
|
2524 } |
|
2525 push @writeArray, ( "<hr>" ) if($optionHtml); |
|
2526 push @writeArray, ("\n"); |
|
2527 } |
|
2528 |
|
2529 my $passed = 0; |
|
2530 $passed = 1 if($line3 =~ m/==> PASSED/); |
|
2531 |
|
2532 # Get the log for the case |
|
2533 |
|
2534 my $startLine = 0; |
|
2535 my $endLine = 0; |
|
2536 |
|
2537 my $logLineCount = scalar(@$refLogLines); |
|
2538 |
|
2539 if($logLineCount > 0 && ($optionLogAllCases || !$passed) ) |
|
2540 { |
|
2541 if($lastCaseLogLine >= $logLineCount) |
|
2542 { |
|
2543 $lastCaseLogLine = 0; |
|
2544 } |
|
2545 |
|
2546 # Get the start and end time for the case |
|
2547 |
|
2548 my $found = 0; |
|
2549 #StartTime: 16:12:10,2440, EndTime: 16:12:34,3880 |
|
2550 if($line2 =~ m/^StartTime: ([0-9]+):([0-9]+):([0-9]+)\,[0-9]*, Endtime: ([0-9]+):([0-9]+):([0-9]+)\,[0-9]*$/i) |
|
2551 { |
|
2552 $found = 1; |
|
2553 } |
|
2554 elsif($line2 =~ m/^StartTime: ([0-9]+):([0-9]+):([0-9]+)\.[0-9]*[ A-Z]*, Endtime: ([0-9]+):([0-9]+):([0-9]+)\.[0-9]*[ A-Z]*$/i) |
|
2555 { |
|
2556 $found = 1; |
|
2557 } |
|
2558 else |
|
2559 { |
|
2560 print(" *ERROR* Could not parse case run time for case $caseId. Can not write case log note. Returning.\n"); |
|
2561 return; |
|
2562 } |
|
2563 |
|
2564 my $startSeconds = 0; |
|
2565 my $endSeconds = 0; |
|
2566 |
|
2567 if($found) |
|
2568 { |
|
2569 $startSeconds = ($1 * 60 * 60) + $2 * 60 + $3; |
|
2570 $endSeconds = ($4 * 60 * 60) + $5 * 60 + $6; |
|
2571 |
|
2572 my $caseRunTime = $endSeconds - $startSeconds; |
|
2573 |
|
2574 if($caseRunTime < 0) |
|
2575 { |
|
2576 # It's possible to code solution but it'd slow down the script. |
|
2577 print(" *ERROR* Case $caseId has probably passed midnight/midday. Giving up writing case specific log.\n"); |
|
2578 return; |
|
2579 } |
|
2580 |
|
2581 #print " - start:" . $1 . ":" . $2 . ":" . $3 . " = " . $startSeconds . "\n"; |
|
2582 #print " - end: " . $4 . ":" . $5 . ":" . $6 . " = " . $endSeconds . "\n"; |
|
2583 } |
|
2584 |
|
2585 # Find indexes for start and end lines |
|
2586 |
|
2587 $startLine = -1; |
|
2588 # If the line at $lastCaseLogLine matches then find backwards the first matching line, |
|
2589 # otherwise some lines might be missed from the log note. |
|
2590 if(LogLineTimeMatchesForCase(\@$refLogLines[$lastCaseLogLine], $startSeconds, $startSeconds)) |
|
2591 { |
|
2592 #print("find back\n"); |
|
2593 for(my $i=$lastCaseLogLine; $i > 0; $i--) |
|
2594 { |
|
2595 if(!LogLineTimeMatchesForCase(\@$refLogLines[$i], $startSeconds, $startSeconds)) |
|
2596 { |
|
2597 $startLine = $i+1; |
|
2598 last; |
|
2599 } |
|
2600 } |
|
2601 } |
|
2602 # Otherwise try to find match forward. |
|
2603 else |
|
2604 { |
|
2605 $startLine = FindLogLineMatch($refLogLines, $startSeconds, $endSeconds, $lastCaseLogLine, 1); |
|
2606 } |
|
2607 # If that doesn't succeed then lets go at start of the log. SLOW for huge logs. |
|
2608 if($startLine == -1) |
|
2609 { |
|
2610 $startLine = FindLogLineMatch($refLogLines, $startSeconds, $endSeconds, 0, 1); |
|
2611 $lastCaseLogLine = 0; |
|
2612 } |
|
2613 if($startLine == -1) |
|
2614 { |
|
2615 print(" *ERROR* startLine not found!\n"); |
|
2616 return; |
|
2617 } |
|
2618 |
|
2619 print(" - StartLine: $startLine\n") if($optionShowMessages); |
|
2620 |
|
2621 # Find forward the last line which does not match. |
|
2622 $endLine = FindLogLineMatch($refLogLines, $startSeconds, $endSeconds, $startLine+1, 0); |
|
2623 |
|
2624 if($endLine == -1 || $endLine < $startLine) |
|
2625 { |
|
2626 print(" - End line not found, trying alternative method.\n") if($optionShowMessages); |
|
2627 # Find first not matching line forward from the case start. |
|
2628 $endLine = FindLogLineMatch($refLogLines, $startSeconds, $endSeconds, scalar(@$refLogLines)-1, 0); |
|
2629 if( $endLine == -1 || $endLine < $startLine ) |
|
2630 { |
|
2631 # Just take the rest of the log |
|
2632 $endLine = scalar(@$refLogLines)-1; |
|
2633 } |
|
2634 } |
|
2635 |
|
2636 print(" - EndLine: $endLine\n") if($optionShowMessages); |
|
2637 |
|
2638 $lastCaseLogLine = $endLine-1; |
|
2639 } |
|
2640 |
|
2641 # Create log directory |
|
2642 |
|
2643 if ( !(-e "testcase_logs") ) |
|
2644 { |
|
2645 mkdir("testcase_logs"); |
|
2646 } |
|
2647 |
|
2648 if ( !(-e "$caseLogOutDir") ) |
|
2649 { |
|
2650 mkdir($caseLogOutDir, 0755); |
|
2651 } |
|
2652 |
|
2653 # Write the log file |
|
2654 |
|
2655 my $fileMode = ">>"; |
|
2656 |
|
2657 print(" - Case log file: " . $caseLogFile ."\n") if($optionShowMessages); |
|
2658 |
|
2659 if( open(FILE_HANDLE, $fileMode . $caseLogFile) ) |
|
2660 { |
|
2661 if($optionHtml) |
|
2662 { |
|
2663 print FILE_HANDLE ( |
|
2664 "<html>\n" . |
|
2665 "<head>\n" . |
|
2666 "<title>$title</title>\n" . |
|
2667 "</head>\n" . |
|
2668 "<body>\n" . |
|
2669 "<basefont color=\"black\" face=\"arial\" size=\"4\">\n" |
|
2670 ); |
|
2671 } |
|
2672 |
|
2673 foreach $line(@writeArray) |
|
2674 { |
|
2675 print FILE_HANDLE ($line); |
|
2676 } |
|
2677 |
|
2678 for(my $i=$startLine;$i<$endLine;$i++) |
|
2679 { |
|
2680 my $line = @$refLogLines[$i]; |
|
2681 FormatLogLine(\$line) if($optionHtml); |
|
2682 |
|
2683 print FILE_HANDLE ($line); |
|
2684 } |
|
2685 |
|
2686 if($optionHtml) |
|
2687 { |
|
2688 print FILE_HANDLE ( |
|
2689 "</body>\n" . |
|
2690 "</html>" |
|
2691 ); |
|
2692 } |
|
2693 |
|
2694 print FILE_HANDLE ( $lineBreak ); |
|
2695 print FILE_HANDLE ( $lineBreak ); |
|
2696 |
|
2697 close FILE_HANDLE; |
|
2698 |
|
2699 } else |
|
2700 { |
|
2701 print("ERROR: Could not write to file: " . $caseLogFile . "\n"); |
|
2702 } |
|
2703 } |
|
2704 |
|
2705 # There's case start entry in the log, write case log from there onwards. |
|
2706 sub WriteCaseLogFromEntry |
|
2707 { |
|
2708 my ($caseLogFile, $refLogLines, $caseEntryLogStartLine, $line1, $line2, $line3) = @_; |
|
2709 |
|
2710 # Don't generate log files if we only print summary |
|
2711 if($optionPrintCfgSummaries) |
|
2712 { |
|
2713 return 0; |
|
2714 } |
|
2715 |
|
2716 RemoveWhiteSpaces(\$line1); |
|
2717 RemoveWhiteSpaces(\$line2); |
|
2718 RemoveWhiteSpaces(\$line3); |
|
2719 |
|
2720 my $lineBreak = "\n"; |
|
2721 $lineBreak = "<br>\n" if($optionHtml); |
|
2722 |
|
2723 my $caseId = ""; |
|
2724 |
|
2725 if($line1 =~ m/\[[0-9]+\][ ]+Title:\[([a-z0-9]+)$regexpCaseName\]$/i) |
|
2726 { |
|
2727 #"' ultraedit |
|
2728 $caseId = $1; |
|
2729 } |
|
2730 |
|
2731 # Write header for case |
|
2732 |
|
2733 my @writeArray; |
|
2734 |
|
2735 # split the first line |
|
2736 push @writeArray, ( "<hr>" ) if($optionHtml); |
|
2737 push @writeArray, ( substr($line1, 0, index($line1, "Title:")) . $lineBreak ); |
|
2738 push @writeArray, ( substr($line1, index($line1, "Title:")) . $lineBreak ); |
|
2739 my $title = substr($line1, index($line1, "Title:")); |
|
2740 |
|
2741 #($line1 . "\n"); |
|
2742 push @writeArray, ($line2 . $lineBreak); |
|
2743 push @writeArray, ($line3 . $lineBreak); |
|
2744 push @writeArray, ("\n"); |
|
2745 push @writeArray, ( "<hr>" ) if($optionHtml); |
|
2746 |
|
2747 my $passed = 0; |
|
2748 $passed = 1 if($line3 =~ m/==> PASSED/); |
|
2749 |
|
2750 # Get the log for the case |
|
2751 |
|
2752 my $logLineCount = scalar(@$refLogLines); |
|
2753 |
|
2754 if($logLineCount > 0 && ($optionLogAllCases || !$passed) ) |
|
2755 { |
|
2756 # Get the start and end time for the case |
|
2757 |
|
2758 my $found = 0; |
|
2759 #StartTime: 16:12:10,2440, EndTime: 16:12:34,3880 |
|
2760 if($line2 =~ m/^StartTime: ([0-9]+):([0-9]+):([0-9]+)\,[0-9]*, Endtime: ([0-9]+):([0-9]+):([0-9]+)\,[0-9]*$/i) |
|
2761 { |
|
2762 $found = 1; |
|
2763 } |
|
2764 elsif($line2 =~ m/^StartTime: ([0-9]+):([0-9]+):([0-9]+)\.[0-9]*[ A-Z]*, Endtime: ([0-9]+):([0-9]+):([0-9]+)\.[0-9]*[ A-Z]*$/i) |
|
2765 { |
|
2766 $found = 1; |
|
2767 } |
|
2768 else |
|
2769 { |
|
2770 print(" *ERROR* Could not parse case run time for case $caseId. Can not write case log note. Returning.\n"); |
|
2771 return 0; |
|
2772 } |
|
2773 |
|
2774 my $startSeconds = 0; |
|
2775 my $endSeconds = 0; |
|
2776 |
|
2777 if($found) |
|
2778 { |
|
2779 $startSeconds = ($1 * 60 * 60) + $2 * 60 + $3; |
|
2780 $endSeconds = ($4 * 60 * 60) + $5 * 60 + $6; |
|
2781 |
|
2782 my $caseRunTime = $endSeconds - $startSeconds; |
|
2783 |
|
2784 if($caseRunTime < 0) |
|
2785 { |
|
2786 # It's possible to code solution but it'd slow down the script. |
|
2787 #print(" *ERROR* Case has probably passed midnight/midday. Giving up writing case specific log.\n"); |
|
2788 #return; |
|
2789 } |
|
2790 } |
|
2791 } |
|
2792 |
|
2793 # Create log directory |
|
2794 |
|
2795 if ( !(-e "testcase_logs") ) |
|
2796 { |
|
2797 mkdir("testcase_logs"); |
|
2798 } |
|
2799 |
|
2800 if ( !(-e "$caseLogOutDir") ) |
|
2801 { |
|
2802 mkdir($caseLogOutDir, 0755); |
|
2803 } |
|
2804 |
|
2805 # Write the log file |
|
2806 |
|
2807 my $fileMode = ">>"; |
|
2808 |
|
2809 print(" - Case log file: " . $caseLogFile ."\n") if($optionShowMessages); |
|
2810 |
|
2811 my $caseEntryLogEndLine = -1; |
|
2812 for(my $i=$caseEntryLogStartLine; $i<scalar(@$refLogLines); $i++ ) |
|
2813 { |
|
2814 if(@$refLogLines[$i] =~ m/<<< Case end/i) |
|
2815 { |
|
2816 $caseEntryLogEndLine = $i; |
|
2817 last; |
|
2818 } |
|
2819 } |
|
2820 if( $caseEntryLogEndLine == -1 ) |
|
2821 { |
|
2822 print("ERROR: $caseId is missing case end command in the script?\n"); |
|
2823 return 0; |
|
2824 } |
|
2825 |
|
2826 if( open(FILE_HANDLE, $fileMode . $caseLogFile) ) |
|
2827 { |
|
2828 if($optionHtml) |
|
2829 { |
|
2830 print FILE_HANDLE ( |
|
2831 "<html>\n" . |
|
2832 "<head>\n" . |
|
2833 "<title>$title</title>\n" . |
|
2834 "</head>\n" . |
|
2835 "<body>\n" . |
|
2836 "<basefont color=\"black\" face=\"arial\" size=\"4\">\n" |
|
2837 ); |
|
2838 } |
|
2839 |
|
2840 for( my $i = $caseEntryLogStartLine; $i < $caseEntryLogEndLine; $i++ ) |
|
2841 { |
|
2842 my $line = @$refLogLines[$i]; |
|
2843 FormatLogLine(\$line) if($optionHtml); |
|
2844 print FILE_HANDLE ($line); |
|
2845 } |
|
2846 |
|
2847 if($optionHtml) |
|
2848 { |
|
2849 print FILE_HANDLE ( |
|
2850 "</body>\n" . |
|
2851 "</html>" |
|
2852 ); |
|
2853 } |
|
2854 print FILE_HANDLE ( $lineBreak ); |
|
2855 print FILE_HANDLE ( $lineBreak ); |
|
2856 |
|
2857 close FILE_HANDLE; |
|
2858 |
|
2859 } else |
|
2860 { |
|
2861 print("ERROR: Could not write to file: " . $caseLogFile . "\n"); |
|
2862 return 0; |
|
2863 } |
|
2864 |
|
2865 return 1; |
|
2866 } |
|
2867 |
|
2868 #------------------------------------------------------------------------------------ |
|
2869 # FindLogLineMatchRecurse |
|
2870 # |
|
2871 # Parameters: |
|
2872 # $startsSeconds the min time the log line will match |
|
2873 # $endSeconds the max time the log line will match |
|
2874 # $refStartLine index of line to start searching |
|
2875 # $refLogLines reference to array of the log |
|
2876 # $boolOp 1 = first line with match is returned, 0 = first line with no match is returned |
|
2877 # $inc increment in the search loop |
|
2878 # $recurse can the function call itself, if yes this will be passed to the new call too |
|
2879 # $maxLine the last line to search |
|
2880 # |
|
2881 #------------------------------------------------------------------------------------ |
|
2882 sub FindLogLineMatchRecurse |
|
2883 { |
|
2884 my ($startSeconds, $endSeconds, $refStartLine, $refLogLines, $boolOp, $inc, $recurse, $maxLine) = @_; |
|
2885 |
|
2886 print("IN FindLogLineMatchRecurse\n") if($optionDebug); |
|
2887 my $spacer = ""; |
|
2888 for(my $i = 0;$i<$recurse; $i++) |
|
2889 { |
|
2890 $spacer .= "-"; |
|
2891 } |
|
2892 |
|
2893 $maxLine = scalar(@$refLogLines) if(!defined($maxLine) or $maxLine > scalar(@$refLogLines)); |
|
2894 print("s: $startSeconds, e: $endSeconds, sl: $$refStartLine, b: $boolOp, i: $inc, r: $recurse, ml: $maxLine\n") if($optionDebug); |
|
2895 print("$spacer ENTER: range: $$refStartLine - $maxLine, $inc\n") if($optionDebug); |
|
2896 print("$spacer rec: $recurse\n") if($optionDebug); |
|
2897 print("$spacer prev: $$refStartLine\n") if($optionDebug); |
|
2898 print("$spacer inc: $inc\n") if($optionDebug); |
|
2899 |
|
2900 # First try to find the start line without recursion. |
|
2901 for(my $i = $$refStartLine; $i < $maxLine; $i += $inc) |
|
2902 { |
|
2903 if(LogLineTimeMatchesForCase(\@$refLogLines[$i], $startSeconds, $endSeconds) == $boolOp) |
|
2904 { |
|
2905 # We have exact match. |
|
2906 if($inc == 1) |
|
2907 { |
|
2908 $$refStartLine = $i; |
|
2909 } |
|
2910 # Not exatch match. Return start of previous block. |
|
2911 elsif($i >= $$refStartLine + $inc) |
|
2912 { |
|
2913 $$refStartLine = $i - $inc; |
|
2914 } |
|
2915 |
|
2916 print("MATCH LINE: $i: " . @$refLogLines[$i] . "\n") if($optionDebug); |
|
2917 print("return line: " . $$refStartLine . "\n") if($optionDebug); |
|
2918 print("EXIT FindLogLineMatchRecurse. return 1\n") if($optionDebug); |
|
2919 return 1; |
|
2920 } |
|
2921 } |
|
2922 |
|
2923 if($recurse && $inc > 500) |
|
2924 { |
|
2925 # Split the current search block to smaller blocks and do search to them |
|
2926 for(my $i = $$refStartLine; $i < $maxLine; $i += $inc) |
|
2927 { |
|
2928 print("$spacer $i\n") if($inc != 1 && $optionDebug); |
|
2929 print("...RECURSING!\n") if($optionDebug); |
|
2930 |
|
2931 # Start search from the start of current block. |
|
2932 my $prevPos = $i; |
|
2933 |
|
2934 # New last line to search |
|
2935 my $end = $i + $inc; |
|
2936 $end = scalar(@$refLogLines)-1 if($end > scalar(@$refLogLines)-1); |
|
2937 |
|
2938 # New increment, twice smaller than now |
|
2939 my $newInc = int($inc / 2 + 0.5); |
|
2940 $newInc = 200 if($newInc < 200); |
|
2941 |
|
2942 if(FindLogLineMatchRecurse($startSeconds, $endSeconds, \$prevPos, $refLogLines, $boolOp, $newInc, $recurse-1, $end) == 1) |
|
2943 { |
|
2944 $$refStartLine = $prevPos; |
|
2945 print("EXIT FindLogLineMatchRecurse. return 1\n") if($optionDebug); |
|
2946 return 1; |
|
2947 } |
|
2948 } |
|
2949 } |
|
2950 |
|
2951 print("EXIT FindLogLineMatchRecurse. return 0\n") if($optionDebug); |
|
2952 return 0; |
|
2953 } |
|
2954 |
|
2955 #------------------------------------------------------------------------------------ |
|
2956 # FindLogLineMatch |
|
2957 # |
|
2958 # Searches for log line with time between the startSeconds and endSeconds. |
|
2959 # |
|
2960 # Parameters: |
|
2961 # $refLogLines reference to array of the log |
|
2962 # $startsSeconds the min time the log line will match |
|
2963 # $endSeconds the max time the log line will match |
|
2964 # $startLine index of line to start searching |
|
2965 # $boolOp 1 = first line with match is returned, 0 = first line with no match is returned |
|
2966 #------------------------------------------------------------------------------------ |
|
2967 sub FindLogLineMatch |
|
2968 { |
|
2969 my ($refLogLines, $startSeconds, $endSeconds, $startLine, $boolOp) = @_; |
|
2970 print("IN FindLogLineMatch\n") if($optionDebug); |
|
2971 my $prevPos = $startLine; |
|
2972 |
|
2973 #print("\n\nSTART: $startLine, boolop: $boolOp \n"); |
|
2974 |
|
2975 my $match = 0; |
|
2976 $match = FindLogLineMatchRecurse($startSeconds, $endSeconds, \$prevPos, $refLogLines, $boolOp, 6000, 5); |
|
2977 $prevPos = 0 if(!$match); |
|
2978 # Refine the search to be exact line |
|
2979 $match = FindLogLineMatchRecurse($startSeconds, $endSeconds, \$prevPos, $refLogLines, $boolOp, 1, 0); |
|
2980 |
|
2981 print("EXIT FindLogLineMatch\n") if($optionDebug); |
|
2982 # Not found. |
|
2983 return -1 if(!$match); |
|
2984 |
|
2985 return $prevPos; |
|
2986 } |
|
2987 |
|
2988 #------------------------------------------------------------------------------------ |
|
2989 # JustFormatLogFile |
|
2990 # |
|
2991 # Parameters: |
|
2992 # $fileName |
|
2993 #------------------------------------------------------------------------------------ |
|
2994 sub JustFormatLogFile |
|
2995 { |
|
2996 my ($fileName) = @_; |
|
2997 |
|
2998 if( !open(FILE_HANDLE, $fileName) ) |
|
2999 { |
|
3000 die("ERROR! Could not open file '" . $fileName . "'\n"); |
|
3001 } |
|
3002 my @array = <FILE_HANDLE>; |
|
3003 close(FILE_HANDLE); |
|
3004 |
|
3005 $fileName = substr($fileName, 0, index($fileName, ".txt")) . ".html"; |
|
3006 |
|
3007 if( open(FILE_HANDLE, ">" . $fileName) ) |
|
3008 { |
|
3009 |
|
3010 print FILE_HANDLE ( |
|
3011 "<html>\n" . |
|
3012 "<head>\n" . |
|
3013 "<title>$fileName</title>\n" . |
|
3014 "</head>\n" . |
|
3015 "<body>\n" . |
|
3016 "<basefont color=\"black\" face=\"arial\" size=\"4\">\n" |
|
3017 ); |
|
3018 |
|
3019 |
|
3020 my $i; |
|
3021 for($i = 0;$i<scalar(@array); $i++) |
|
3022 { |
|
3023 my $line = $array[$i]; |
|
3024 $line =~ s/\t/ /; #remove tabs |
|
3025 FormatLogLine(\$line); |
|
3026 |
|
3027 print FILE_HANDLE ($line); |
|
3028 } |
|
3029 |
|
3030 print FILE_HANDLE ( |
|
3031 "</body>\n" . |
|
3032 "</html>" |
|
3033 ); |
|
3034 |
|
3035 close FILE_HANDLE; |
|
3036 } else |
|
3037 { |
|
3038 print("ERROR: Could not write to file: " . $fileName . "\n"); |
|
3039 } |
|
3040 |
|
3041 } |
|
3042 |
|
3043 #------------------------------------------------------------------------------------ |
|
3044 # LogLineTimeMatchesForCase |
|
3045 # |
|
3046 # Parameters: |
|
3047 # $refLine |
|
3048 # $startSeconds |
|
3049 # $endSeconds |
|
3050 #------------------------------------------------------------------------------------ |
|
3051 sub LogLineTimeMatchesForCase |
|
3052 { |
|
3053 my ($refLine, $startSeconds, $endSeconds) = @_; |
|
3054 |
|
3055 return 0 if(!defined($$refLine)); |
|
3056 |
|
3057 $$refLine =~ s/\t/ /; #remove tabs |
|
3058 |
|
3059 #print($$refLine . "\n"); |
|
3060 #print(" - $startSeconds, $endSeconds\n"); |
|
3061 |
|
3062 if(${$refLine} =~ m/[0-9\/]+ ([0-9]+):([0-9]+):([0-9]+)/i) |
|
3063 { |
|
3064 # print("YES " . $1 . "\n"); |
|
3065 |
|
3066 my $currSeconds = $1 * 60 * 60 + $2 * 60 + $3; |
|
3067 #print(" - curr: $currSeconds\n"); |
|
3068 |
|
3069 #print("curr: $currSeconds, start: $startSeconds, end: $endSeconds\n"); |
|
3070 |
|
3071 if($currSeconds >= $startSeconds and $currSeconds <= $endSeconds) |
|
3072 { |
|
3073 #print("MATCH curr: " . $1 . ":" . $2 . ":" . $3 . " = " . $currSeconds . "\n"); |
|
3074 return 1; |
|
3075 } |
|
3076 } |
|
3077 #print("NO MATCH\n"); |
|
3078 return 0; |
|
3079 } |
|
3080 |
|
3081 #------------------------------------------------------------------------------------ |
|
3082 # FormatLogLine |
|
3083 # Parameters: |
|
3084 # $line |
|
3085 #------------------------------------------------------------------------------------ |
|
3086 sub FormatLogLine |
|
3087 { |
|
3088 my ($line) = @_; |
|
3089 |
|
3090 #Color |
|
3091 |
|
3092 # sisään |
|
3093 #27/06/2006 9:37:52 >>>* royalblue #2B60DE |
|
3094 # pois |
|
3095 #27/06/2006 9:37:52 <<<* lightblue #0000FF |
|
3096 #27/06/2006 9:23:57 * exit |
|
3097 # destructor |
|
3098 #27/06/2006 9:23:58 ~* #FF0000 |
|
3099 #27/06/2006 9:23:58 >>>~* |
|
3100 |
|
3101 #27/06/2006 9:37:52 CIptv*Test * GREY #808080 |
|
3102 #27/06/2006 9:37:52 *error/fail RED #FF0000 |
|
3103 #27/06/2006 9:23:41 CreateServerProcess() GREEN #00FF00 |
|
3104 |
|
3105 #!! TTestObject::~TTestObject #800080 |
|
3106 |
|
3107 my $color = "#000000"; |
|
3108 |
|
3109 |
|
3110 if(${$line} =~ m/([0-9\/]+ [0-9]+:[0-9]+:[0-9]+)/i) |
|
3111 { |
|
3112 $date = $1; |
|
3113 ${$line} = substr(${$line}, length($date)); |
|
3114 |
|
3115 $color = "#808080" if(${$line} =~ m/CIptvTest[a-z0-9]+Test/i); |
|
3116 |
|
3117 $color = "#2B60DE" if(${$line} =~ m/^[\t ]*>>>/i); |
|
3118 $color = "#2B60DE" if(${$line} =~ m/\(\)$/i); |
|
3119 $color = "#2B60DE" if(${$line} =~ m/enter$/i); |
|
3120 |
|
3121 $color = "#0000FF" if(${$line} =~ m/^[\t ]*<<<*/i); |
|
3122 $color = "#0000FF" if(${$line} =~ m/ exit$/i); |
|
3123 |
|
3124 $color = "#800080" if(${$line} =~ m/^[\t ]*~/i); |
|
3125 $color = "#800080" if(${$line} =~ m/^[\t ]*>>>~/i); |
|
3126 $color = "#800080" if(${$line} =~ m/::~/i); |
|
3127 |
|
3128 $color = "#FF0000" if(${$line} =~ m/error|fail/i); |
|
3129 |
|
3130 $color = "#00AA00" if(${$line} =~ m/passed/i); |
|
3131 $color = "#FF0000" if(${$line} =~ m/\*\*\*Testcase[a-z ]+\*\*\*/i); |
|
3132 $color = "#00AA00" if(${$line} =~ m/\*\*\*Testcase PASSED+\*\*\*/i); |
|
3133 $color = "#0000FF" if(${$line} =~ m/Executing line/i); |
|
3134 |
|
3135 my $formatStart = "", $formatEnd = ""; |
|
3136 |
|
3137 if(${$line} =~ m/Client created semaphore, init/i) { $formatStart = "<b>"; $formatEnd = "</b>"; } |
|
3138 if(${$line} =~ m/CIptvEngineServer:: ->Starting server shutdown/i) { $formatStart = "<b>"; $formatEnd = "</b>"; } |
|
3139 |
|
3140 SpecialChars($line); |
|
3141 |
|
3142 $date = "<font color=\"black\" face=\"arial\" size=\"2\">" . $date . "</font>"; |
|
3143 ${$line} = $date . "$formatStart<font color=\"$color\" face=\"arial\" size=\"2\">" . ${$line} . "</font>$formatEnd<br>"; |
|
3144 } |
|
3145 |
|
3146 |
|
3147 #$line = "<font color=\"$color\" face=\"arial\" size=\"2\"> . $line |
|
3148 |
|
3149 #$color = "#2B60DE" if($line =~ m/([0-9\/]+ [0-9]+:[0-9]+:[0-9]+) >>>/i) |
|
3150 |
|
3151 |
|
3152 } |
|
3153 |
|
3154 sub PrintCfgSummaries |
|
3155 { |
|
3156 my $caseCfgFileName = ""; |
|
3157 my %cfgCaseCount; |
|
3158 my %cfgCaseTotalTime; |
|
3159 |
|
3160 foreach $case(@cases) |
|
3161 { |
|
3162 $caseCfgFileName = @{$case}[$CASE_CFG_FILE]; |
|
3163 |
|
3164 if(!defined($cfgCaseCount{$caseCfgFileName})) |
|
3165 { |
|
3166 $cfgCaseCount{$caseCfgFileName} = 0; |
|
3167 $cfgCaseTotalTime{$caseCfgFileName} = 0; |
|
3168 } |
|
3169 |
|
3170 if(defined(@{$case}[$CASE_RUN_TIME_SECONDS])) |
|
3171 { |
|
3172 $cfgCaseTotalTime{$caseCfgFileName} += @{$case}[$CASE_RUN_TIME_SECONDS]; |
|
3173 } |
|
3174 |
|
3175 |
|
3176 $cfgCaseCount{$caseCfgFileName}++ if(@{$case}[$CASE_STATUS] ne "$caseDefaultStatus") ; |
|
3177 } |
|
3178 |
|
3179 my $totalTime = 0; |
|
3180 printf("\n%-50s %10s %10s\n", "CFG", "Case count", "Case run time"); |
|
3181 foreach $caseCfgFileName (sort keys(%cfgCaseCount)) |
|
3182 { |
|
3183 if($cfgCaseCount{$caseCfgFileName} > 0) |
|
3184 { |
|
3185 my $mins = ($cfgCaseTotalTime{$caseCfgFileName}/60); |
|
3186 $totalTime += $mins; |
|
3187 printf("%-50s %10d %10.1f\n", $caseCfgFileName, $cfgCaseCount{$caseCfgFileName}, $mins); |
|
3188 } |
|
3189 } |
|
3190 printf("Total time: %.2f hours\n\n", $totalTime/60 ); |
|
3191 |
|
3192 print("No cases run for:\n"); |
|
3193 foreach $caseCfgFileName (sort keys(%cfgCaseCount)) |
|
3194 { |
|
3195 if($cfgCaseCount{$caseCfgFileName} == 0) |
|
3196 { |
|
3197 print("$caseCfgFileName\n"); |
|
3198 } |
|
3199 } |
|
3200 } |
|
3201 |
|
3202 #------------------------------------------------------------------------------------ |
|
3203 # WriteOfficeXml |
|
3204 # |
|
3205 # Parameters: |
|
3206 # $outputFile |
|
3207 # $briefSummary |
|
3208 # |
|
3209 # Writes the cases into a word formatted xml file. |
|
3210 #------------------------------------------------------------------------------------ |
|
3211 sub WriteOfficeXml |
|
3212 { |
|
3213 my ($outputFile, $briefSummary) = @_; |
|
3214 |
|
3215 if( !open(FILE_HANDLE, ">" . $outputFile) ) |
|
3216 { |
|
3217 print("ERROR! Could not open file '" . $outputFile . "'\n"); |
|
3218 return; |
|
3219 } |
|
3220 |
|
3221 my $writeData = $xmlHeader; |
|
3222 my $replacement; |
|
3223 |
|
3224 if($briefSummary == 0) { |
|
3225 $writeData .= $xmlHeaderTableColumns; |
|
3226 } |
|
3227 else { |
|
3228 $writeData .= $xmlHeaderTableColumnsBrief; |
|
3229 } |
|
3230 |
|
3231 $excelRowCount = scalar(@cases) * 9 + 100; |
|
3232 $writeData =~ s/$CaseCountMul8/$excelRowCount/; |
|
3233 |
|
3234 print FILE_HANDLE ( $writeData ); |
|
3235 |
|
3236 if($briefSummary) { |
|
3237 $writeData = $xmlSummaryData; |
|
3238 |
|
3239 $writeData =~ s/$xmlDataSummaryCaseCount/$summaryCaseCount/; |
|
3240 $writeData =~ s/$xmlDataSummaryPassed/$summaryPassedCases/; |
|
3241 $writeData =~ s/$xmlDataSummaryFailed/$summaryFailedCases/; |
|
3242 $writeData =~ s/$xmlDataSummaryCrashed/$summaryCrashedCases/; |
|
3243 $writeData =~ s/$xmlDataSummaryTimeout/$summaryTimeoutCases/; |
|
3244 $writeData =~ s/$xmlDataSummaryRunRate/$summaryRunRate/; |
|
3245 $writeData =~ s/$xmlDataSummaryPassRateTotal/$summaryPassRateTotal/; |
|
3246 $writeData =~ s/$xmlDataSummaryPassRateRun/$summaryPassRateRun/; |
|
3247 |
|
3248 print FILE_HANDLE ( $writeData ); |
|
3249 } |
|
3250 |
|
3251 my $caseCfgFileName = ""; |
|
3252 |
|
3253 my %cfgCaseCount; |
|
3254 |
|
3255 # Sort the cases by the config files, cfg's which have no run cases come last |
|
3256 |
|
3257 if(!$optionSortCases) |
|
3258 { |
|
3259 #print("HASH CREATE\n"); |
|
3260 #create hash of cfg case counts |
|
3261 foreach $case(@cases) |
|
3262 { |
|
3263 $caseCfgFileName = @{$case}[$CASE_CFG_FILE]; |
|
3264 |
|
3265 if(!defined($cfgCaseCount{$caseCfgFileName})) |
|
3266 { |
|
3267 $cfgCaseCount{$caseCfgFileName} = 0; |
|
3268 } |
|
3269 |
|
3270 $cfgCaseCount{$caseCfgFileName}++ if(@{$case}[$CASE_STATUS] ne "$caseDefaultStatus") ; |
|
3271 } |
|
3272 |
|
3273 #print("THRU CASES\n"); |
|
3274 |
|
3275 foreach $caseCfgFileName (keys(%cfgCaseCount)) |
|
3276 { |
|
3277 # if cfg has zero cases run then it's cases are put back of the array |
|
3278 if($cfgCaseCount{$caseCfgFileName} == 0) |
|
3279 { |
|
3280 #print("ZERO CASES RUN: $caseCfgFileName\n"); |
|
3281 my @moveCases; |
|
3282 |
|
3283 my $i; |
|
3284 for($i=0; $i< scalar(@cases); $i++) |
|
3285 { |
|
3286 if($cases[$i][$CASE_CFG_FILE] eq $caseCfgFileName) |
|
3287 { |
|
3288 push @moveCases, splice(@cases, $i, 1); |
|
3289 $i--; |
|
3290 } |
|
3291 } |
|
3292 |
|
3293 push @cases, @moveCases; |
|
3294 } |
|
3295 } |
|
3296 } |
|
3297 |
|
3298 # Write the xml file |
|
3299 |
|
3300 $caseCfgFileName = ""; |
|
3301 |
|
3302 foreach $case(@cases) |
|
3303 { |
|
3304 if($optionShowMessages || $optionDebug) |
|
3305 { |
|
3306 print(" - Case Xml : " . @{$case}[$CASE_NAME] . ", status: " . @{$case}[$CASE_STATUS] . "\n") if( $optionDebug || @{$case}[$CASE_STATUS] ne "Not planned" ); |
|
3307 } |
|
3308 |
|
3309 if($briefSummary == 0) |
|
3310 { |
|
3311 $writeData = $xmlData; |
|
3312 $writeData .= $xmlData2; |
|
3313 $writeData .= $xmlDataEmptyRow; |
|
3314 } |
|
3315 else |
|
3316 { |
|
3317 $writeData = ""; |
|
3318 |
|
3319 # Write cfg file to the brief xml if it has changed for the case |
|
3320 if($optionSortCases == 0 && $caseCfgFileName ne @{$case}[$CASE_CFG_FILE]) |
|
3321 { |
|
3322 $caseCfgFileName = @{$case}[$CASE_CFG_FILE]; |
|
3323 |
|
3324 $writeData .= $xmlDataEmptyRow; |
|
3325 $writeData .= $xmlCfgFileBrief; |
|
3326 $writeData .= $xmlDataBriefHeader; |
|
3327 |
|
3328 $replacement = @{$case}[$CASE_CFG_FILE]; |
|
3329 XmlReadyText(\$replacement); |
|
3330 $writeData =~ s/$xmlDataCfgFile/$replacement/; |
|
3331 } |
|
3332 |
|
3333 # Write log file links to xml. |
|
3334 |
|
3335 my $caseHasLog = ( defined(@{$case}[$CASE_LOG_FILE]) and @{$case}[$CASE_LOG_FILE] ne "" ); |
|
3336 my $caseHasScripterLog = ( defined(@{$case}[$CASE_LOG_FILE_SCRIPTER]) and @{$case}[$CASE_LOG_FILE_SCRIPTER] ne "" ); |
|
3337 my $caseLogLink1 = ""; |
|
3338 my $caseLogLink2 = ""; |
|
3339 |
|
3340 if( $caseHasLog && $caseHasScripterLog ) |
|
3341 { |
|
3342 print(" - Case has both log files\n") if ($optionDebug ); |
|
3343 $writeData .= $xmlDataBrief2Links; |
|
3344 $caseLogLink1 = @{$case}[$CASE_LOG_FILE]; |
|
3345 $caseLogLink2 = @{$case}[$CASE_LOG_FILE_SCRIPTER]; |
|
3346 } |
|
3347 elsif( $caseHasLog ) |
|
3348 { |
|
3349 print(" - Case has log file\n") if ($optionDebug ); |
|
3350 $writeData .= $xmlDataBrief1Link; |
|
3351 $caseLogLink1 = @{$case}[$CASE_LOG_FILE]; |
|
3352 } |
|
3353 elsif( $caseHasScripterLog ) |
|
3354 { |
|
3355 print(" - Case has scripter log file\n") if ($optionDebug ); |
|
3356 $writeData .= $xmlDataBrief1Link; |
|
3357 $caseLogLink1 = @{$case}[$CASE_LOG_FILE_SCRIPTER]; |
|
3358 } |
|
3359 else |
|
3360 { |
|
3361 print(" - Case has no log files\n") if ($optionDebug ); |
|
3362 $writeData .= $xmlDataBriefNoLinks; |
|
3363 } |
|
3364 |
|
3365 if( $caseLogLink1 ne "" ) |
|
3366 { |
|
3367 print(" - Log file 1: $caseLogLink1\n") if ($optionDebug ); |
|
3368 $replacement = $caseLogLink1; |
|
3369 XmlReadyText(\$replacement); |
|
3370 |
|
3371 #print("wordxml log file 1: $replacement\n"; |
|
3372 |
|
3373 #print("repl: " . $replacement . "\n"); |
|
3374 $replacement = substr($replacement, index($replacement, "\\") + 1); |
|
3375 #$replacement = ".\\testcase_logs\\..\\" . $replacement; |
|
3376 #print("repl: " . $replacement . "\n"); |
|
3377 |
|
3378 $writeData =~ s/$xmlDataCaseLink1/$replacement/; |
|
3379 } |
|
3380 |
|
3381 if( $caseLogLink2 ne "" ) |
|
3382 { |
|
3383 print(" - Log file 2: $caseLogLink2\n") if ($optionDebug ); |
|
3384 $replacement = $caseLogLink2; |
|
3385 XmlReadyText(\$replacement); |
|
3386 |
|
3387 #print("wordxml log file 2: $replacement\n"; |
|
3388 |
|
3389 #print("repl: " . $replacement . "\n"); |
|
3390 $replacement = substr($replacement, index($replacement, "\\") + 1); |
|
3391 #$replacement = ".\\testcase_logs\\..\\" . $replacement; |
|
3392 #print("repl: " . $replacement . "\n"); |
|
3393 |
|
3394 $writeData =~ s/$xmlDataCaseLink2/$replacement/; |
|
3395 } |
|
3396 |
|
3397 # Write case fail reason to xml. |
|
3398 |
|
3399 $replacement = @{$case}[$CASE_REASON]; |
|
3400 XmlReadyText(\$replacement); |
|
3401 $writeData =~ s/$xmlDataCaseReason/$replacement/; |
|
3402 |
|
3403 # Write case run time or result to xml. |
|
3404 |
|
3405 if(!$optionCaseRunTimes) |
|
3406 { |
|
3407 $replacement = @{$case}[$CASE_RESULT]; |
|
3408 } |
|
3409 else |
|
3410 { |
|
3411 $replacement = @{$case}[$CASE_RUN_TIME_SECONDS]; |
|
3412 } |
|
3413 |
|
3414 # Write result to xml. |
|
3415 |
|
3416 XmlReadyText(\$replacement); |
|
3417 $writeData =~ s/$xmlDataCaseResult/$replacement/; |
|
3418 } |
|
3419 |
|
3420 #$writeData = $xmlData; |
|
3421 #if($option_brief_summary == 0) { $writeData .= $xmlData2; } |
|
3422 #$writeData .= $xmlDataEmptyRow; |
|
3423 |
|
3424 $replacement = @{$case}[$CASE_NAME]; |
|
3425 XmlReadyText(\$replacement); |
|
3426 $writeData =~ s/$xmlDataCaseName/$replacement/; |
|
3427 |
|
3428 $replacement = @{$case}[$CASE_RUN_TIMES]; |
|
3429 XmlReadyText(\$replacement); |
|
3430 $writeData =~ s/$xmlDataCaseRunTimes/$replacement/; |
|
3431 |
|
3432 $replacement = @{$case}[$CASE_FAILED]; |
|
3433 XmlReadyText(\$replacement); |
|
3434 $writeData =~ s/$xmlDataCaseFailed/$replacement/; |
|
3435 |
|
3436 $replacement = @{$case}[$CASE_CRASHED]; |
|
3437 XmlReadyText(\$replacement); |
|
3438 $writeData =~ s/$xmlDataCaseCrashed/$replacement/; |
|
3439 |
|
3440 $replacement = @{$case}[$CASE_PASSED]; |
|
3441 XmlReadyText(\$replacement); |
|
3442 $writeData =~ s/$xmlDataCasePassed/$replacement/; |
|
3443 |
|
3444 $replacement = @{$case}[$CASE_STATUS]; |
|
3445 XmlReadyText(\$replacement); |
|
3446 $writeData =~ s/$xmlDataCaseStatus/$replacement/; |
|
3447 |
|
3448 $replacement = @{$case}[$CASE_PURPOSE]; |
|
3449 XmlReadyText(\$replacement); |
|
3450 $writeData =~ s/$xmlDataCasePurpose/$replacement/; |
|
3451 |
|
3452 $replacement = @{$case}[$CASE_MEANS]; |
|
3453 XmlReadyText(\$replacement); |
|
3454 $writeData =~ s/$xmlDataCaseMeans/$replacement/; |
|
3455 |
|
3456 $replacement = @{$case}[$CASE_REQUIRED_SETTINGS]; |
|
3457 XmlReadyText(\$replacement); |
|
3458 $writeData =~ s/$xmlDataCaseRequiredSettings/$replacement/; |
|
3459 |
|
3460 $replacement = @{$case}[$CASE_RELATED_REQUIREMENTS]; |
|
3461 XmlReadyText(\$replacement); |
|
3462 $writeData =~ s/$xmlDataCaseRelatedRequirements/$replacement/; |
|
3463 |
|
3464 $replacement = @{$case}[$CASE_VERIFICATION]; |
|
3465 XmlReadyText(\$replacement); |
|
3466 $writeData =~ s/$xmlDataCaseVerification/$replacement/; |
|
3467 |
|
3468 $replacement = @{$case}[$CASE_NOTE]; |
|
3469 XmlReadyText(\$replacement); |
|
3470 $writeData =~ s/$xmlDataCaseNote/$replacement/; |
|
3471 |
|
3472 if(@{$case}[$CASE_STATUS] eq "UNKNOWN") { |
|
3473 $replacement = $STYLE_ID_STATUS_UNKNOWN; |
|
3474 } |
|
3475 elsif(@{$case}[$CASE_STATUS] eq "CRASHED") { |
|
3476 $replacement = $STYLE_ID_STATUS_CRASHED; |
|
3477 } |
|
3478 elsif(@{$case}[$CASE_STATUS] eq "FAILED") { |
|
3479 $replacement = $STYLE_ID_STATUS_FAILED; |
|
3480 } |
|
3481 elsif(@{$case}[$CASE_STATUS] eq "PASSED") { |
|
3482 $replacement = $STYLE_ID_STATUS_PASSED; |
|
3483 } |
|
3484 else { |
|
3485 $replacement = $STYLE_ID_STATUS_NA; |
|
3486 } |
|
3487 |
|
3488 $writeData =~ s/$STYLE_ID_STATUS_TAG/$replacement/; |
|
3489 |
|
3490 print FILE_HANDLE ( $writeData ); |
|
3491 } |
|
3492 |
|
3493 print FILE_HANDLE ( $xmlFooter ); |
|
3494 |
|
3495 close(FILE_HANDLE); |
|
3496 |
|
3497 print("Report " . $outputFile . " written.\n"); |
|
3498 } |
|
3499 |
|
3500 #------------------------------------------------------------------------------------ |
|
3501 # WriteOfficeXmlAlt |
|
3502 # |
|
3503 # Parameters: |
|
3504 # $outputFile |
|
3505 # |
|
3506 # Writes the cases into a word formatted xml file. |
|
3507 #------------------------------------------------------------------------------------ |
|
3508 sub WriteOfficeXmlAlt |
|
3509 { |
|
3510 my ($outputFile, $refRuns) = @_; |
|
3511 |
|
3512 CalculateStats(); |
|
3513 |
|
3514 if( !open(FILE_HANDLE, ">" . $outputFile) ) |
|
3515 { |
|
3516 print("ERROR! Could not open file '" . $outputFile . "'\n"); |
|
3517 return; |
|
3518 } |
|
3519 |
|
3520 my $writeData = $xmlHeader; |
|
3521 my $replacement; |
|
3522 |
|
3523 $writeData .= $xmlHeaderTableColumnsAlt; |
|
3524 |
|
3525 my $xRefRunInfo = @$refRuns[0]; |
|
3526 my $xRefCases = @$xRefRunInfo[2]; |
|
3527 my $caseCount = scalar( @$xRefCases ) + 1000; |
|
3528 |
|
3529 $excelRowCount = $caseCount * 9 + 100; |
|
3530 $writeData =~ s/$CaseCountMul8/$excelRowCount/; |
|
3531 |
|
3532 print FILE_HANDLE ( $writeData ); |
|
3533 |
|
3534 my $caseCfgFileName = ""; |
|
3535 |
|
3536 my %cfgCaseCount; |
|
3537 |
|
3538 # Sort the cases by the config files, cfg's which have no run cases come last |
|
3539 |
|
3540 if(!$optionSortCases) |
|
3541 { |
|
3542 #print("HASH CREATE\n"); |
|
3543 #create hash of cfg case counts |
|
3544 foreach $case(@cases) |
|
3545 { |
|
3546 $caseCfgFileName = @{$case}[$CASE_CFG_FILE]; |
|
3547 |
|
3548 if(!defined($cfgCaseCount{$caseCfgFileName})) |
|
3549 { |
|
3550 $cfgCaseCount{$caseCfgFileName} = 0; |
|
3551 } |
|
3552 |
|
3553 $cfgCaseCount{$caseCfgFileName}++ if(@{$case}[$CASE_STATUS] ne "$caseDefaultStatus") ; |
|
3554 } |
|
3555 |
|
3556 #print("THRU CASES\n"); |
|
3557 |
|
3558 foreach $caseCfgFileName (keys(%cfgCaseCount)) |
|
3559 { |
|
3560 # if cfg has zero cases run then it's cases are put back of the array |
|
3561 if($cfgCaseCount{$caseCfgFileName} == 0) |
|
3562 { |
|
3563 #print("ZERO CASES RUN: $caseCfgFileName\n"); |
|
3564 my @moveCases; |
|
3565 |
|
3566 my $i; |
|
3567 for($i=0; $i< scalar(@cases); $i++) |
|
3568 { |
|
3569 if($cases[$i][$CASE_CFG_FILE] eq $caseCfgFileName) |
|
3570 { |
|
3571 push @moveCases, splice(@cases, $i, 1); |
|
3572 $i--; |
|
3573 } |
|
3574 } |
|
3575 |
|
3576 push @cases, @moveCases; |
|
3577 } |
|
3578 } |
|
3579 } |
|
3580 |
|
3581 my @sortedRuns; |
|
3582 |
|
3583 #Monday 25th August 2008 |
|
3584 while( 1 ) |
|
3585 { |
|
3586 my $maxTotal = 0; |
|
3587 my $refWinner; |
|
3588 for( my $i=0; $i<scalar(@$refRuns); $i++ ) |
|
3589 { |
|
3590 my $refRunInfo = @$refRuns[$i]; |
|
3591 my $date = @$refRunInfo[1]; |
|
3592 my @parts = split(" ", $date); |
|
3593 my $total = 0 + $parts[1]; |
|
3594 |
|
3595 if( $parts[2] eq "Jan" ) |
|
3596 { |
|
3597 $total += 1 * 30; |
|
3598 } |
|
3599 elsif( $parts[2] eq "Feb" ) |
|
3600 { |
|
3601 $total += 2 * 30; |
|
3602 } |
|
3603 elsif( $parts[2] eq "Mar" ) |
|
3604 { |
|
3605 $total += 3 * 30; |
|
3606 } |
|
3607 elsif( $parts[2] eq "Apr" ) |
|
3608 { |
|
3609 $total += 4 * 30; |
|
3610 } |
|
3611 elsif( $parts[2] eq "May" ) |
|
3612 { |
|
3613 $total += 5 * 30; |
|
3614 } |
|
3615 elsif( $parts[2] eq "Jun" ) |
|
3616 { |
|
3617 $total += 6 * 30; |
|
3618 } |
|
3619 elsif( $parts[2] eq "Jul" ) |
|
3620 { |
|
3621 $total += 7 * 30; |
|
3622 } |
|
3623 elsif( $parts[2] eq "Aug" ) |
|
3624 { |
|
3625 $total += 8 * 30; |
|
3626 } |
|
3627 elsif( $parts[2] eq "Sep" ) |
|
3628 { |
|
3629 $total += 9 * 30; |
|
3630 } |
|
3631 elsif( $parts[2] eq "Oct" ) |
|
3632 { |
|
3633 $total += 10 * 30; |
|
3634 } |
|
3635 elsif( $parts[2] eq "Nov" ) |
|
3636 { |
|
3637 $total += 11 * 30; |
|
3638 } |
|
3639 elsif( $parts[2] eq "Dec" ) |
|
3640 { |
|
3641 $total += 12 * 30; |
|
3642 } |
|
3643 |
|
3644 if( $maxTotal < $total ) |
|
3645 { |
|
3646 my $foundAlready = 0; |
|
3647 foreach my $xrun ( @sortedRuns ) |
|
3648 { |
|
3649 if( $xrun == @$refRuns[$i] ) |
|
3650 { |
|
3651 $foundAlready = 1; |
|
3652 } |
|
3653 |
|
3654 } |
|
3655 |
|
3656 if( !$foundAlready ) |
|
3657 { |
|
3658 $maxTotal = $total; |
|
3659 $winner = @$refRuns[$i]; |
|
3660 } |
|
3661 } |
|
3662 } |
|
3663 push @sortedRuns, $winner; |
|
3664 if( scalar(@sortedRuns) == scalar(@$refRuns) ) |
|
3665 { |
|
3666 last; |
|
3667 } |
|
3668 } |
|
3669 |
|
3670 foreach $run ( @sortedRuns ) |
|
3671 { |
|
3672 #print("sorted: " . @$run[1] . "\n"); |
|
3673 } |
|
3674 foreach $run ( @$refRuns ) |
|
3675 { |
|
3676 #print("orig: " . @$run[1] . "\n"); |
|
3677 } |
|
3678 |
|
3679 my $refMainRunInfo = $sortedRuns[0]; |
|
3680 my $refMainCases = @$refMainRunInfo[2]; |
|
3681 |
|
3682 $caseCfgFileName = ""; |
|
3683 $replacement = ""; |
|
3684 |
|
3685 # This prints only cases which are in first run. Build list of cases in all runs and use that. |
|
3686 foreach $mainCase ( @$refMainCases ) |
|
3687 { |
|
3688 $writeData = ""; |
|
3689 |
|
3690 # Status of the current case in different runs |
|
3691 my @statuses; |
|
3692 my @results; |
|
3693 for( my $i = 0; $i<100; $i++ ) |
|
3694 { |
|
3695 $statuses[$i] = "UNKNOWN"; |
|
3696 $results[$i] = ""; |
|
3697 } |
|
3698 |
|
3699 for( my $i = 0; $i<scalar( @sortedRuns ); $i++ ) |
|
3700 { |
|
3701 my $refRunInfo = $sortedRuns[$i]; |
|
3702 |
|
3703 my $refCases = @$refRunInfo[2]; |
|
3704 |
|
3705 foreach $case ( @$refCases ) |
|
3706 { |
|
3707 if( @$case[$CASE_ID] eq @$mainCase[$CASE_ID] ) |
|
3708 { |
|
3709 $statuses[$i] = @$case[$CASE_STATUS]; |
|
3710 $results[$i] = @$case[$CASE_RESULT]; |
|
3711 } |
|
3712 } |
|
3713 } |
|
3714 |
|
3715 # If cfg changes, write xml header for it |
|
3716 if($caseCfgFileName ne @$mainCase[$CASE_CFG_FILE]) |
|
3717 { |
|
3718 $caseCfgFileName = @$mainCase[$CASE_CFG_FILE]; |
|
3719 |
|
3720 $writeData .= $xmlDataEmptyRow; |
|
3721 $writeData .= $xmlCfgFileBrief; |
|
3722 $writeData .= $xmlCfgFileAltHeader; |
|
3723 |
|
3724 $replacement = @$mainCase[$CASE_CFG_FILE]; |
|
3725 XmlReadyText(\$replacement); |
|
3726 $writeData =~ s/$xmlDataCfgFile/$replacement/; |
|
3727 |
|
3728 |
|
3729 for( $i = 0; $i<$ALT_RESULTCOUNT; $i++ ) |
|
3730 { |
|
3731 $replacement = ""; |
|
3732 if( defined( $sortedRuns[$i] ) ) |
|
3733 { |
|
3734 $refRunInfo = $sortedRuns[$i]; |
|
3735 $replacement = @$refRunInfo[1]; |
|
3736 } |
|
3737 my $field = $xmlDataAltDateX . ($i+1); |
|
3738 $writeData =~ s/$field/$replacement/; |
|
3739 } |
|
3740 } |
|
3741 |
|
3742 # Write xml for X cases |
|
3743 |
|
3744 $writeData .= $xmlCfgFileAltData; |
|
3745 |
|
3746 $replacement = @$mainCase[$CASE_NAME]; |
|
3747 XmlReadyText(\$replacement); |
|
3748 $writeData =~ s/$xmlDataCaseName/$replacement/; |
|
3749 |
|
3750 # Replace the X fields for runs |
|
3751 for( my $i = 0; $i<$ALT_RESULTCOUNT; $i++ ) |
|
3752 { |
|
3753 $replacement = $statuses[$i]; |
|
3754 $replacement = $results[$i]; |
|
3755 my $field = $xmlDataAltResultX . ($i+1); |
|
3756 $writeData =~ s/$field/$replacement/; |
|
3757 |
|
3758 $replacement = $STYLE_ID_STATUS_NA_CENTERED; |
|
3759 if($statuses[$i] eq "CRASHED") { |
|
3760 $replacement = $STYLE_ID_STATUS_CRASHED_CENTERED; |
|
3761 } |
|
3762 elsif($statuses[$i] eq "FAILED") { |
|
3763 $replacement = $STYLE_ID_STATUS_FAILED_CENTERED; |
|
3764 } |
|
3765 elsif($statuses[$i] eq "PASSED") { |
|
3766 $replacement = $STYLE_ID_STATUS_PASSED_CENTERED; |
|
3767 } |
|
3768 else { |
|
3769 $replacement = $STYLE_ID_STATUS_NA_CENTERED; |
|
3770 } |
|
3771 |
|
3772 $writeData =~ s/$STYLE_ID_STATUS_TAG/$replacement/; |
|
3773 } |
|
3774 print FILE_HANDLE ( $writeData ); |
|
3775 } |
|
3776 |
|
3777 print FILE_HANDLE ( $xmlFooter ); |
|
3778 close(FILE_HANDLE); |
|
3779 print("Alternative report " . $outputFile . " written.\n"); |
|
3780 return; |
|
3781 } |
|
3782 |
|
3783 #------------------------------------------------------------------------------------ |
|
3784 # WriteTDToolResultFile |
|
3785 # |
|
3786 # Parameters: |
|
3787 # $outputFile |
|
3788 # |
|
3789 # Writes the cases into TDTool formatted file which can be exported into Quality Center |
|
3790 #------------------------------------------------------------------------------------ |
|
3791 sub WriteTDToolResultFile |
|
3792 { |
|
3793 my ($outputFile) = @_; |
|
3794 |
|
3795 if( !open(FILE_HANDLE, ">" . $outputFile) ) |
|
3796 { |
|
3797 print("ERROR! Could not open file '" . $outputFile . "'\n"); |
|
3798 return; |
|
3799 } |
|
3800 |
|
3801 my $writeData; |
|
3802 my $replacement; |
|
3803 |
|
3804 my %cfgCaseCount; |
|
3805 |
|
3806 # sort the cases by the config files, cfg's which have no run cases come last |
|
3807 if(!$optionSortCases) |
|
3808 { |
|
3809 foreach $case(@cases) |
|
3810 { |
|
3811 $caseCfgFileName = @{$case}[$CASE_CFG_FILE]; |
|
3812 |
|
3813 if(!defined($cfgCaseCount{$caseCfgFileName})) |
|
3814 { |
|
3815 $cfgCaseCount{$caseCfgFileName} = 0; |
|
3816 } |
|
3817 |
|
3818 $cfgCaseCount{$caseCfgFileName}++ if(@{$case}[$CASE_STATUS] ne "$caseDefaultStatus") ; |
|
3819 } |
|
3820 |
|
3821 #print("THRU CASES\n"); |
|
3822 |
|
3823 foreach $caseCfgFileName (keys(%cfgCaseCount)) |
|
3824 { |
|
3825 # if cfg has zero cases run then it's cases are put back of the array |
|
3826 if($cfgCaseCount{$caseCfgFileName} == 0) |
|
3827 { |
|
3828 #print("ZERO CASES RUN: $caseCfgFileName\n"); |
|
3829 my @moveCases; |
|
3830 |
|
3831 my $i; |
|
3832 for($i=0; $i< scalar(@cases); $i++) |
|
3833 { |
|
3834 if($cases[$i][$CASE_CFG_FILE] eq $caseCfgFileName) |
|
3835 { |
|
3836 push @moveCases, splice(@cases, $i, 1); |
|
3837 $i--; |
|
3838 } |
|
3839 } |
|
3840 |
|
3841 push @cases, @moveCases; |
|
3842 } |
|
3843 } |
|
3844 } |
|
3845 |
|
3846 #test_set_name_here |
|
3847 #[1]APES PTSW_WBA_TS -1.1. - Server Version - (01) - COMM_SERVER_VERSION_GET_REQ |
|
3848 #Passed&Actual result: Info: 0 |
|
3849 |
|
3850 print FILE_HANDLE ( "IPTV_Engine test set\n" ); |
|
3851 |
|
3852 foreach $case(@cases) |
|
3853 { |
|
3854 $writeData = "[1]"; |
|
3855 |
|
3856 my $caseName = @{$case}[$CASE_NAME]; |
|
3857 $writeData .= $caseName; |
|
3858 |
|
3859 $writeData .= "\n"; |
|
3860 |
|
3861 my $result; |
|
3862 |
|
3863 if(@{$case}[$CASE_STATUS] eq "UNKNOWN") { |
|
3864 $result = "N/A"; |
|
3865 } |
|
3866 elsif(@{$case}[$CASE_STATUS] eq "CRASHED") { |
|
3867 $result = "Failed"; |
|
3868 } |
|
3869 elsif(@{$case}[$CASE_STATUS] eq "FAILED") { |
|
3870 $result = "Failed"; |
|
3871 } |
|
3872 elsif(@{$case}[$CASE_STATUS] eq "PASSED") { |
|
3873 $result = "Passed"; |
|
3874 } |
|
3875 else { |
|
3876 $result = "No Run"; |
|
3877 } |
|
3878 |
|
3879 $writeData .= $result; |
|
3880 |
|
3881 |
|
3882 |
|
3883 my $comments = "&Info"; |
|
3884 |
|
3885 #$comments = "CFG file: @{$case}[$CASE_CFG_FILE]; |
|
3886 |
|
3887 #$comments .= "Actual result = " . @{$case}[$CASE_RESULT] . ", Info = " . @{$case}[$CASE_REASON]; |
|
3888 |
|
3889 $writeData .= $comments; |
|
3890 |
|
3891 $writeData .= "\n"; |
|
3892 |
|
3893 # Replace bad characters for QC |
|
3894 $writeData =~ s/\\/-/g; |
|
3895 $writeData =~ s/\//-/g; |
|
3896 $writeData =~ s/:/-/g; |
|
3897 $writeData =~ s/\"/-/g; |
|
3898 $writeData =~ s/\?/-/g; |
|
3899 $writeData =~ s/\'/-/g; |
|
3900 $writeData =~ s/\|/-/g; |
|
3901 $writeData =~ s/\*/-/g; |
|
3902 $writeData =~ s/\%/-/g; |
|
3903 $writeData =~ s/ä/a/g; |
|
3904 $writeData =~ s/ö/o/g; |
|
3905 $writeData =~ s/\å/a/g; |
|
3906 $writeData =~ s/</(/g; |
|
3907 $writeData =~ s/>/)/g; |
|
3908 |
|
3909 if($result eq "Passed" or $result eq "Failed") |
|
3910 { |
|
3911 print FILE_HANDLE ( $writeData ); |
|
3912 } |
|
3913 } |
|
3914 |
|
3915 close(FILE_HANDLE); |
|
3916 |
|
3917 print("Report " . $outputFile . " written.\n"); |
|
3918 } |
|
3919 |
|
3920 |
|
3921 #------------------------------------------------------------------------------------ |
|
3922 # FindCfgFiles |
|
3923 # Parameters: |
|
3924 # $godir, $refFiles |
|
3925 # |
|
3926 # Finds cfg files from the the specified directory and it's sub directories. |
|
3927 #------------------------------------------------------------------------------------ |
|
3928 sub FindCfgFiles |
|
3929 { |
|
3930 my ($godir, $refFiles) = @_; |
|
3931 |
|
3932 my $startDir = cwd; |
|
3933 |
|
3934 chdir($godir) or die("Could not change dir to $godir"); |
|
3935 |
|
3936 opendir(DIR, "."); |
|
3937 my @files = sort(readdir(DIR)); |
|
3938 closedir(DIR); |
|
3939 |
|
3940 foreach $file(@files) |
|
3941 { |
|
3942 if($file eq "." or $file eq "..") {next}; |
|
3943 |
|
3944 if (-d $file) |
|
3945 { |
|
3946 FindCfgFiles( $file, $refFiles ); |
|
3947 } else { |
|
3948 if($file =~ m/\.cfg$/i) |
|
3949 { |
|
3950 next if($file =~ m/livetv/i and $optionNoLiveTvTests); |
|
3951 |
|
3952 next if( |
|
3953 ($file =~ m/IptvSecurityServicesTest/i or |
|
3954 $file =~ m/IptvRssSecurityTest/i or |
|
3955 $file =~ m/IptvLiveTvSep/i or |
|
3956 $file =~ m/IptvRssDownloadSecurityTest/i) |
|
3957 |
|
3958 and $optionNoSecurityTests |
|
3959 ); |
|
3960 |
|
3961 next if($file =~ m/example.cfg/i); |
|
3962 |
|
3963 push @$refFiles, ( cwd . "/" . $file ); |
|
3964 } |
|
3965 } |
|
3966 } |
|
3967 |
|
3968 chdir("$startDir") or die("Could not change dir to $startDir"); |
|
3969 } |
|
3970 |
|
3971 #------------------------------------------------------------------------------------ |
|
3972 # ParseCfg |
|
3973 # Parameters: |
|
3974 # $file |
|
3975 #------------------------------------------------------------------------------------ |
|
3976 sub ParseCfg |
|
3977 { |
|
3978 my ($file) = @_; |
|
3979 |
|
3980 my $fileCaseCount = 0; |
|
3981 |
|
3982 if( !open(FILE_HANDLE, $file) ) |
|
3983 { |
|
3984 print("ERROR! Could not open file '" . $file . "'\n"); |
|
3985 return 0; |
|
3986 } |
|
3987 my @array = <FILE_HANDLE>; |
|
3988 close(FILE_HANDLE); |
|
3989 |
|
3990 my $lineCount = scalar(@array); |
|
3991 my $i; |
|
3992 my $cfgFileWritten = 0; |
|
3993 my $caseDocumentationStart = -1; |
|
3994 my $line; |
|
3995 |
|
3996 my @caseDesc; # lines for case desc and case itself |
|
3997 |
|
3998 for($i=0; $i<$lineCount; $i++ ) { |
|
3999 $line = $array[$i]; |
|
4000 |
|
4001 RemoveWhiteSpaces(\$line); |
|
4002 |
|
4003 #print(" $line\n"); |
|
4004 |
|
4005 if($line =~ m/^\#\[IptvETDescription\]/) |
|
4006 { |
|
4007 $caseDocumentationStart = $i; |
|
4008 } |
|
4009 |
|
4010 if($line =~ m/\[Test\]/) |
|
4011 { |
|
4012 if($caseDocumentationStart >= 0) |
|
4013 { |
|
4014 ReadCaseAndDescText(\@array, \@caseDesc, $caseDocumentationStart-1) |
|
4015 } |
|
4016 else |
|
4017 { |
|
4018 ReadCaseAndDescText(\@array, \@caseDesc, $i); |
|
4019 } |
|
4020 |
|
4021 #print("readcase desc: " . scalar(@caseDesc) . "\n"); |
|
4022 } |
|
4023 else |
|
4024 { |
|
4025 #print("NOT READ readcase desc: " . scalar(@caseDesc) . "\n"); |
|
4026 } |
|
4027 |
|
4028 #test case starts here |
|
4029 if($line =~ m/^title /) |
|
4030 { |
|
4031 #print("COUNT: " . scalar(@caseDesc) . "\n\n"); |
|
4032 |
|
4033 if($caseDocumentationStart >= 0) |
|
4034 { |
|
4035 #print(">>> Case start: " . $line . "\n"); |
|
4036 #$i += |
|
4037 ReadCase(\@array, $caseDocumentationStart, $file); |
|
4038 $caseDocumentationStart = -1; |
|
4039 } |
|
4040 |
|
4041 my $caseName = substr($line, length("title ")); |
|
4042 my $caseId = GetCaseIdFromName($caseName); |
|
4043 |
|
4044 RemoveWhiteSpaces(\$caseName); |
|
4045 #SpecialChars(\$caseName); |
|
4046 |
|
4047 my $documentationExists = GetCase($caseId, \@cases); |
|
4048 |
|
4049 $caseDesc[0] = $caseName; |
|
4050 push @caseDescs, [ @caseDesc ]; |
|
4051 @caseDesc = (); #new case starts |
|
4052 |
|
4053 # create empty array for case |
|
4054 if(!$documentationExists) |
|
4055 { |
|
4056 if($cfgFileWritten == 0) |
|
4057 { |
|
4058 $cfgFileWritten = 1; |
|
4059 push @notDocumentedCases, ("\n\n" . $file . |
|
4060 "\n************************************************************************************************\n" |
|
4061 ); |
|
4062 |
|
4063 } |
|
4064 push @notDocumentedCases, ($caseName . "\n"); |
|
4065 |
|
4066 #create dummy case |
|
4067 my @case; |
|
4068 $case[$CASE_NAME] = $caseName; |
|
4069 |
|
4070 $case[$CASE_ID] = $caseId; |
|
4071 |
|
4072 $case[$CASE_RUN_TIMES] = 0; |
|
4073 $case[$CASE_CRASHED] = 0; |
|
4074 $case[$CASE_FAILED] = 0; |
|
4075 $case[$CASE_PASSED] = 0; |
|
4076 $case[$CASE_STATUS] = "$caseDefaultStatus"; |
|
4077 $case[$CASE_PURPOSE] = "N/A"; |
|
4078 $case[$CASE_MEANS] = "N/A"; |
|
4079 $case[$CASE_REQUIRED_SETTINGS] = "N/A"; |
|
4080 $case[$CASE_RELATED_REQUIREMENTS] = "N/A"; |
|
4081 $case[$CASE_VERIFICATION] = "N/A"; |
|
4082 $case[$CASE_NOTE] = "N/A"; |
|
4083 $case[$CASE_REASON] = ""; |
|
4084 $case[$CASE_RESULT] = ""; |
|
4085 $case[$CASE_LOG_FILE] = ""; |
|
4086 $case[$CASE_LOG_FILE_SCRIPTER] = ""; |
|
4087 $case[$CASE_CHECK_RESULT_LOG_FILE] = 0; |
|
4088 $case[$CASE_CFG_FILE] = lc( GetPathFileName($file) ); |
|
4089 $case[$CASE_RUN_TIME_SECONDS] = 0; |
|
4090 |
|
4091 if( IsCaseInCaseList( $case[$CASE_ID] ) ) |
|
4092 { |
|
4093 push @cases, [ @case ]; |
|
4094 } |
|
4095 } |
|
4096 |
|
4097 $fileCaseCount++; |
|
4098 if($optionShowMessages) { print(" - Case: " . $caseName . "\n"); }; |
|
4099 } |
|
4100 } |
|
4101 |
|
4102 return $fileCaseCount; |
|
4103 } |
|
4104 |
|
4105 |
|
4106 #------------------------------------------------------------------------------------ |
|
4107 # ReadCaseAndDescText |
|
4108 # |
|
4109 # Parameters: |
|
4110 # $lines |
|
4111 # $caseInfo |
|
4112 # $startIndex |
|
4113 #------------------------------------------------------------------------------------ |
|
4114 sub ReadCaseAndDescText |
|
4115 { |
|
4116 my ($lines, $caseInfo, $startIndex) = @_; |
|
4117 my $lineCount = @{$lines}; |
|
4118 |
|
4119 my $readLines = 0; |
|
4120 my $i = 0; |
|
4121 |
|
4122 @{$caseInfo}[0] = "N/A"; |
|
4123 |
|
4124 for($i=$startIndex; $i<$lineCount; $i++) |
|
4125 { |
|
4126 my $line = @{$lines}[$i]; |
|
4127 |
|
4128 @{$caseInfo}[ scalar(@{$caseInfo}) ] = $line; |
|
4129 |
|
4130 #print($line . "\n"); |
|
4131 |
|
4132 if($line =~ m/\[Endtest\]/i) |
|
4133 { |
|
4134 # push @cases, [ @case ]; |
|
4135 |
|
4136 #foreach $xxx (@{$caseInfo}) { print("XXX: " . $xxx . ""); } |
|
4137 |
|
4138 return $readLines; |
|
4139 } |
|
4140 |
|
4141 $readLines++; |
|
4142 } |
|
4143 |
|
4144 return $readLines; |
|
4145 } |
|
4146 |
|
4147 #------------------------------------------------------------------------------------ |
|
4148 # ReadCase |
|
4149 # |
|
4150 # Parameters: |
|
4151 # $lines |
|
4152 # $startIndex |
|
4153 # $file |
|
4154 #------------------------------------------------------------------------------------ |
|
4155 sub ReadCase |
|
4156 { |
|
4157 my ($lines, $startIndex, $file) = @_; |
|
4158 my $lineCount = @{$lines}; |
|
4159 |
|
4160 my $readLines = 0; |
|
4161 my $i = 0; |
|
4162 |
|
4163 my $caseName = ""; |
|
4164 my $casePurpose = ""; |
|
4165 my $caseMeans = ""; |
|
4166 my $caseRequiredSettings = ""; |
|
4167 my $caseRelatedRequirements = ""; |
|
4168 my $caseVerification = ""; |
|
4169 my $caseNote = ""; |
|
4170 |
|
4171 #this is where text is appended if it's on a line which has no description tag |
|
4172 # -> multiline descriptions can be specified |
|
4173 my $refAppend = 0; |
|
4174 |
|
4175 for($i=$startIndex; $i<$lineCount; $i++) |
|
4176 { |
|
4177 my $line = @{$lines}[$i]; |
|
4178 |
|
4179 #print($line . "\n"); |
|
4180 |
|
4181 RemoveWhiteSpaces(\$line); |
|
4182 #$line =~ s/\s+$//; #whitespaces in the end |
|
4183 #$line =~ s/^\s+//; #whitespaces at the start |
|
4184 |
|
4185 if($line =~ m/^\#\[EndIptvETDescription\]/) |
|
4186 { |
|
4187 #print(" ***** End case\n"); |
|
4188 |
|
4189 my @case; |
|
4190 |
|
4191 $case[$CASE_NAME] = $caseName; |
|
4192 $case[$CASE_ID] = GetCaseIdFromName($caseName); |
|
4193 |
|
4194 $case[$CASE_RUN_TIMES] = 0; |
|
4195 $case[$CASE_CRASHED] = 0; |
|
4196 $case[$CASE_FAILED] = 0; |
|
4197 $case[$CASE_PASSED] = 0; |
|
4198 $case[$CASE_STATUS] = "$caseDefaultStatus"; |
|
4199 $case[$CASE_PURPOSE] = $casePurpose; |
|
4200 $case[$CASE_MEANS] = $caseMeans; |
|
4201 $case[$CASE_REQUIRED_SETTINGS] = $caseRequiredSettings; |
|
4202 $case[$CASE_RELATED_REQUIREMENTS] = $caseRelatedRequirements; |
|
4203 $case[$CASE_VERIFICATION] = $caseVerification; |
|
4204 $case[$CASE_NOTE] = $caseNote; |
|
4205 $case[$CASE_REASON] = ""; |
|
4206 $case[$CASE_RESULT] = ""; |
|
4207 $case[$CASE_LOG_FILE] = ""; |
|
4208 $case[$CASE_LOG_FILE_SCRIPTER] = ""; |
|
4209 $case[$CASE_CHECK_RESULT_LOG_FILE] = 0; |
|
4210 $case[$CASE_CFG_FILE] = $file; |
|
4211 $case[$CASE_RUN_TIME_SECONDS] = 0; |
|
4212 |
|
4213 if( IsCaseInCaseList( $case[$CASE_ID] ) ) |
|
4214 { |
|
4215 push @cases, [ @case ]; |
|
4216 } |
|
4217 |
|
4218 return $readLines; |
|
4219 } |
|
4220 |
|
4221 elsif($line =~ m/^\# Testname:/) |
|
4222 { |
|
4223 $caseName = substr($line, length("# Testname:")); |
|
4224 RemoveWhiteSpaces(\$caseName); |
|
4225 #SpecialChars(\$caseName); |
|
4226 $refAppend = \$caseName; |
|
4227 } |
|
4228 |
|
4229 elsif($line =~ m/^\# Purpose:/) |
|
4230 { |
|
4231 $casePurpose = substr($line, length("# Purpose:")); |
|
4232 RemoveWhiteSpaces(\$casePurpose); |
|
4233 #SpecialChars(\$casePurpose); |
|
4234 $refAppend = \$casePurpose; |
|
4235 } |
|
4236 |
|
4237 elsif($line =~ m/^\# Means:/) |
|
4238 { |
|
4239 $caseMeans = substr($line, length("# Means:")); |
|
4240 RemoveWhiteSpaces(\$caseMeans); |
|
4241 #SpecialChars(\$caseMeans); |
|
4242 $refAppend = \$caseMeans; |
|
4243 } |
|
4244 |
|
4245 elsif($line =~ m/^\# Required environment settings:/) |
|
4246 { |
|
4247 $caseRequiredSettings = substr($line, length("# Required environment settings:")); |
|
4248 RemoveWhiteSpaces(\$caseRequiredSettings); |
|
4249 #SpecialChars(\$caseRequiredSettings); |
|
4250 $refAppend = \$caseRequiredSettings; |
|
4251 } |
|
4252 |
|
4253 elsif($line =~ m/^\# Related requirements:/) |
|
4254 { |
|
4255 $caseRelatedRequirements = substr($line, length("# Related requirements:")); |
|
4256 RemoveWhiteSpaces(\$caseRelatedRequirements); |
|
4257 $refAppend = \$caseRelatedRequirements; |
|
4258 } |
|
4259 |
|
4260 elsif($line =~ m/^\# Verification:/) |
|
4261 { |
|
4262 $caseVerification = substr($line, length("# Verification:")); |
|
4263 RemoveWhiteSpaces(\$caseVerification); |
|
4264 $refAppend = \$caseVerification; |
|
4265 } |
|
4266 |
|
4267 elsif($line =~ m/^\# Note:/) |
|
4268 { |
|
4269 $caseNote = substr($line, length("# Note:")); |
|
4270 RemoveWhiteSpaces(\$caseNote); |
|
4271 $refAppend = \$caseNote; |
|
4272 } |
|
4273 |
|
4274 elsif($line =~ m/^\#/) |
|
4275 { |
|
4276 my $text = substr($line, length("#")); |
|
4277 RemoveWhiteSpaces(\$text); |
|
4278 #print(" ***** JOTTAI MUuTA: " . $text. "\n"); |
|
4279 ${$refAppend} .= " " . $text; |
|
4280 |
|
4281 RemoveWhiteSpaces($refAppend); |
|
4282 |
|
4283 } |
|
4284 |
|
4285 $readLines++; |
|
4286 } |
|
4287 |
|
4288 return $readLines; |
|
4289 } |
|
4290 |
|
4291 #------------------------------------------------------------------------------------ |
|
4292 # GetCaseIdFromName |
|
4293 # |
|
4294 # Parameters: |
|
4295 # $caseName |
|
4296 #------------------------------------------------------------------------------------ |
|
4297 sub GetCaseIdFromName |
|
4298 { |
|
4299 my ($caseName) = @_; |
|
4300 |
|
4301 return "NOID" if(!defined($caseName) || $caseName eq ""); |
|
4302 |
|
4303 RemoveWhiteSpaces(\$caseName); |
|
4304 #SpecialChars(\$caseName); |
|
4305 |
|
4306 if($caseName =~ m/(ET[0-9]+)[ ]+/) |
|
4307 { |
|
4308 return $1; |
|
4309 } |
|
4310 |
|
4311 return $caseName; |
|
4312 } |
|
4313 |
|
4314 #------------------------------------------------------------------------------------ |
|
4315 # GetCaseField |
|
4316 # |
|
4317 # Parameters: |
|
4318 # $caseName |
|
4319 # $caseField |
|
4320 #------------------------------------------------------------------------------------ |
|
4321 sub GetCaseField |
|
4322 { |
|
4323 my ($caseNameOrId, $caseField) = @_; |
|
4324 |
|
4325 my $ret = ""; |
|
4326 |
|
4327 foreach my $case(@cases) |
|
4328 { |
|
4329 if(@{$case}[$CASE_NAME] eq $caseNameOrId or @{$case}[$CASE_ID] eq $caseNameOrId) |
|
4330 { |
|
4331 if( defined(@{$case}[$caseField]) ) |
|
4332 { |
|
4333 $ret = @{$case}[$caseField]; |
|
4334 } |
|
4335 } |
|
4336 } |
|
4337 |
|
4338 return $ret; |
|
4339 } |
|
4340 |
|
4341 #------------------------------------------------------------------------------------ |
|
4342 # GetCaseByNameOnly |
|
4343 # |
|
4344 # Parameters: |
|
4345 # $caseName |
|
4346 # |
|
4347 # Removes the case IDs from case names and tries to find case from @cases array |
|
4348 #------------------------------------------------------------------------------------ |
|
4349 sub GetCaseByNameOnly |
|
4350 { |
|
4351 my ($caseName) = @_; |
|
4352 |
|
4353 my $startPos = index($caseName, " "); |
|
4354 $caseName = substr($caseName, $startPos) if($startPos != -1); |
|
4355 |
|
4356 RemoveWhiteSpaces(\$caseName); |
|
4357 |
|
4358 for(my $i = 0; $i<scalar(@cases); $i++) |
|
4359 { |
|
4360 my $name = $cases[$i][$CASE_NAME]; |
|
4361 $startPos = index($name, " "); |
|
4362 return if($startPos == -1); |
|
4363 $name = substr($name, $startPos); |
|
4364 RemoveWhiteSpaces(\$name); |
|
4365 |
|
4366 return $cases[$i] if($name eq $caseName); |
|
4367 } |
|
4368 return; |
|
4369 } |
|
4370 |
|
4371 #------------------------------------------------------------------------------------ |
|
4372 # GetCase |
|
4373 # |
|
4374 # Parameters: |
|
4375 # $caseNameOrID |
|
4376 # |
|
4377 # Returns reference to case |
|
4378 #------------------------------------------------------------------------------------ |
|
4379 sub GetCase |
|
4380 { |
|
4381 my ($caseNameOrID, $refCases) = @_; |
|
4382 |
|
4383 for(my $i = 0; $i<scalar(@$refCases); $i++) |
|
4384 { |
|
4385 $case = @$refCases[$i]; |
|
4386 if(@$case[$CASE_NAME] eq $caseNameOrID or @$case[$CASE_ID] eq $caseNameOrID) |
|
4387 { |
|
4388 return $case; |
|
4389 } |
|
4390 } |
|
4391 return; |
|
4392 } |
|
4393 |
|
4394 #------------------------------------------------------------------------------------ |
|
4395 # GetCaseDesc |
|
4396 # |
|
4397 # Parameters: |
|
4398 # $caseNameOrID |
|
4399 # |
|
4400 # Returns reference to casedesc |
|
4401 #------------------------------------------------------------------------------------ |
|
4402 sub GetCaseDesc |
|
4403 { |
|
4404 my ($caseNameOrID) = @_; |
|
4405 |
|
4406 for(my $i=0; $i<scalar(@caseDescs); $i++) |
|
4407 { |
|
4408 if($caseDescs[$i][0] eq $caseNameOrID || $caseDescs[$i][0] eq $caseNameOrID) |
|
4409 { |
|
4410 return $caseDescs[$i]; |
|
4411 } |
|
4412 } |
|
4413 return; |
|
4414 } |
|
4415 |
|
4416 #------------------------------------------------------------------------------------ |
|
4417 # RemoveWhiteSpaces |
|
4418 # |
|
4419 # Parameters: |
|
4420 # $text |
|
4421 #------------------------------------------------------------------------------------ |
|
4422 sub RemoveWhiteSpaces() |
|
4423 { |
|
4424 my ($text) = @_; |
|
4425 ${$text} =~ s/\s+$//; #whitespaces in the end |
|
4426 ${$text} =~ s/^\s+//; #whitespaces at the start |
|
4427 } |
|
4428 |
|
4429 #------------------------------------------------------------------------------------ |
|
4430 # XmlReadyText |
|
4431 # |
|
4432 # Parameters: |
|
4433 # $text |
|
4434 #------------------------------------------------------------------------------------ |
|
4435 sub XmlReadyText |
|
4436 { |
|
4437 my ($text) = @_; |
|
4438 |
|
4439 $txtlt = "<"; |
|
4440 $txtgt = ">"; |
|
4441 ${$text} =~ s/</$txtlt/g; |
|
4442 ${$text} =~ s/>/$txtgt/g; |
|
4443 |
|
4444 ${$text} =~ s/Ä/Ä/g; |
|
4445 ${$text} =~ s/ä/ä/g; |
|
4446 ${$text} =~ s/Ö/Ö/g; |
|
4447 ${$text} =~ s/ö/ö/g; |
|
4448 |
|
4449 #ä ä |
|
4450 |
|
4451 # Ö Ö |
|
4452 |
|
4453 # ö ö |
|
4454 |
|
4455 } |
|
4456 |
|
4457 #------------------------------------------------------------------------------------ |
|
4458 # SpecialChars |
|
4459 # |
|
4460 # Parameters: |
|
4461 # $text |
|
4462 #------------------------------------------------------------------------------------ |
|
4463 sub SpecialChars |
|
4464 { |
|
4465 my ($text) = @_; |
|
4466 |
|
4467 |
|
4468 ReplaceChar($text, "etmerkki#39;", "'" ); |
|
4469 ReplaceChar($text, "etmerkkiamp;", "&" ); |
|
4470 ReplaceChar($text, "etmerkkiacute;", "´" ); |
|
4471 |
|
4472 ReplaceChar($text, "etmerkkilsquo;", "‘" ); |
|
4473 ReplaceChar($text, "etmerkkirsquo;", "’" ); |
|
4474 ReplaceChar($text, "etmerkkisbquo;", "‚" ); |
|
4475 ReplaceChar($text, "etmerkkildquo;", "“" ); |
|
4476 ReplaceChar($text, "etmerkkirdquo;", "”" ); |
|
4477 ReplaceChar($text, "etmerkkibdquo;", "„" ); |
|
4478 ReplaceChar($text, "etmerkki#34;", "\"" ); |
|
4479 |
|
4480 ReplaceChar($text, "etmerkki#40;", "(" ); |
|
4481 ReplaceChar($text, "etmerkki#41;", ")" ); |
|
4482 |
|
4483 ReplaceChar($text, "etmerkkifrasl;", "/" ); |
|
4484 ReplaceChar($text, "etmerkkilt;", "<" ); |
|
4485 ReplaceChar($text, "etmerkkigt;", ">" ); |
|
4486 ReplaceChar($text, "etmerkki#166;" , "¦" ); |
|
4487 |
|
4488 ReplaceChar($text, "etmerkkipara;", "¶" ); |
|
4489 ReplaceChar($text, "etmerkkimiddot;", "·" ); |
|
4490 ReplaceChar($text, "etmerkkifrac14;", "¼" ); |
|
4491 ReplaceChar($text, "etmerkkifrac12;", "½" ); |
|
4492 ReplaceChar($text, "etmerkkifrac34;" , "¾" ); |
|
4493 |
|
4494 |
|
4495 ${$text} =~ s/etmerkki/&/g; |
|
4496 |
|
4497 # print("TEXT: " . ${$text} . "\n"); |
|
4498 } |
|
4499 |
|
4500 #------------------------------------------------------------------------------------ |
|
4501 # ReplaceChar |
|
4502 # |
|
4503 # Parameters: |
|
4504 # $text |
|
4505 # $replacement |
|
4506 # $char |
|
4507 #------------------------------------------------------------------------------------ |
|
4508 sub ReplaceChar |
|
4509 { |
|
4510 my ($text, $replacement, $char) = @_; |
|
4511 |
|
4512 # print("txt: " . ${$text} . "char: " . $char . ", repl: " . $replacement . "\n"); |
|
4513 |
|
4514 while(index(${$text}, $char) != -1) |
|
4515 { |
|
4516 my $pos = index(${$text}, $char); |
|
4517 if($pos < 0) { $pos = 0 }; |
|
4518 |
|
4519 $str1 = substr(${$text}, 0, $pos); |
|
4520 $str2 = substr(${$text}, $pos+1); |
|
4521 |
|
4522 # print "STR: '" . $str1 . "' - '" . $str2 . "'\n"; |
|
4523 |
|
4524 # print "XXX: " . $str1 . $replacement . $str2 . "\n"; |
|
4525 |
|
4526 ${$text} = $str1 . $replacement . $str2;; |
|
4527 } |
|
4528 } |
|
4529 |
|
4530 #------------------------------------------------------------------------------------ |
|
4531 # PrintCases |
|
4532 #------------------------------------------------------------------------------------ |
|
4533 sub PrintCases |
|
4534 { |
|
4535 |
|
4536 my ($fileName) = @_; |
|
4537 |
|
4538 my @buff; |
|
4539 |
|
4540 push @buff, ("Name, Status, LogFile\n"); |
|
4541 |
|
4542 my $i; |
|
4543 |
|
4544 push @buff, ("----------------------------------------\nCASES\n--------------------------------------\n"); |
|
4545 foreach $case(@cases) |
|
4546 { |
|
4547 |
|
4548 # my $case = $cases[$i]; |
|
4549 if(0 or @{$case}[$CASE_STATUS] ne "$caseDefaultStatus") |
|
4550 { |
|
4551 |
|
4552 push @buff, (@{$case}[$CASE_NAME] . " "); |
|
4553 #@{$case}[$CASE_RUN_TIMES] |
|
4554 #@{$case}[$CASE_CRASHED] |
|
4555 #@{$case}[$CASE_FAILED] |
|
4556 #@{$case}[$CASE_PASSED] |
|
4557 push @buff, (@{$case}[$CASE_STATUS] . " "); |
|
4558 #@{$case}[$CASE_PURPOSE] |
|
4559 #@{$case}[$CASE_MEANS] |
|
4560 #@{$case}[$CASE_REQUIRED_SETTINGS] |
|
4561 #@{$case}[$CASE_RELATED_REQUIREMENTS] |
|
4562 #@{$case}[$CASE_VERIFICATION] |
|
4563 #@{$case}[$CASE_NOTE] |
|
4564 #@{$case}[$CASE_REASON] |
|
4565 #@{$case}[$CASE_RESULT] |
|
4566 push @buff, ("file: " . @{$case}[$CASE_LOG_FILE] . " "); |
|
4567 |
|
4568 push @buff, ("check log: " . @{$case}[$CASE_CHECK_RESULT_LOG_FILE] . " "); |
|
4569 |
|
4570 push @buff, ("\n"); |
|
4571 |
|
4572 } |
|
4573 } |
|
4574 |
|
4575 open(XXX, ">" . $fileName); |
|
4576 print XXX ( @buff ); |
|
4577 close(XXX); |
|
4578 |
|
4579 } |
|
4580 |
|
4581 #------------------------------------------------------------------------------------ |
|
4582 # FindFiles |
|
4583 # Parameters: |
|
4584 # $goDir, where to start finding |
|
4585 # $fileSearch, filename search |
|
4586 # $searchType, 0 = fullname search, 1 = filetype search |
|
4587 # $refIncfiles, reference to array which will hold found files |
|
4588 #------------------------------------------------------------------------------------ |
|
4589 sub FindFiles |
|
4590 { |
|
4591 my ($godir, $fileSearch, $searchType, $refIncfiles) = @_; |
|
4592 |
|
4593 my $startDir = cwd; |
|
4594 |
|
4595 chdir($godir) or die("Could not change dir to $godir"); |
|
4596 |
|
4597 #print("Now in: " . cwd . "\n"); |
|
4598 |
|
4599 opendir(DIR, "."); |
|
4600 my @filelist = sort(readdir(DIR)); |
|
4601 closedir(DIR); |
|
4602 |
|
4603 foreach my $file(@filelist) |
|
4604 { |
|
4605 if($file eq "." or $file eq "..") {next}; |
|
4606 |
|
4607 if (-d $file) |
|
4608 { |
|
4609 FindFiles( $file, $fileSearch, $searchType, $refIncfiles); |
|
4610 } else |
|
4611 { |
|
4612 if( ($file =~ m/$fileSearch/i and $searchType == 0 ) or ($file =~ m/$fileSearch$/i and $searchType == 1 ) ) |
|
4613 { |
|
4614 $file = cwd . "/" . $file; |
|
4615 push @$refIncfiles, $file; |
|
4616 #print("$file\n"); |
|
4617 } |
|
4618 } |
|
4619 } |
|
4620 |
|
4621 chdir ($startDir) or die("Could not change dir to $startDir"); |
|
4622 } |
|
4623 |
|
4624 |
|
4625 #------------------------------------------------------------------------------------ |
|
4626 # GetAllFiles |
|
4627 # Parameters: |
|
4628 # $goDir, where to start finding |
|
4629 # $refIncfiles, reference to array which will hold found files |
|
4630 # $subDirLevel, how deep in the directories we go to search files. < 0 is no limit. |
|
4631 #------------------------------------------------------------------------------------ |
|
4632 sub GetAllFiles |
|
4633 { |
|
4634 my ($godir, $refIncfiles, $subDirLevel) = @_; |
|
4635 |
|
4636 my $startDir = cwd; |
|
4637 |
|
4638 chdir($godir) or die("Could not change dir to $godir"); |
|
4639 |
|
4640 #print("Now in: " . cwd . "\n"); |
|
4641 |
|
4642 opendir(DIR, "."); |
|
4643 my @filelist = sort(readdir(DIR)); |
|
4644 closedir(DIR); |
|
4645 |
|
4646 foreach my $file(@filelist) |
|
4647 { |
|
4648 if($file eq "." or $file eq "..") {next}; |
|
4649 |
|
4650 if (! (-d $file) ) |
|
4651 { |
|
4652 my $path = $startDir . "/" . $file; |
|
4653 push @$refIncfiles, $path; |
|
4654 } elsif( $subDirLevel > 0 || $subDirLevel < 0 ) |
|
4655 { |
|
4656 my $backupDir = cwd; |
|
4657 chdir( $file ) or die("Could not change dir to $file"); |
|
4658 GetAllFiles( $godir, $refIncfiles, $subDirLevel-1 ); |
|
4659 chdir( $backupDir ) or die("Could not change dir to $backupDir"); |
|
4660 } |
|
4661 } |
|
4662 |
|
4663 chdir ($startDir) or die("Could not change dir to $startDir"); |
|
4664 } |
|
4665 |
|
4666 #------------------------------------------------------------------------------------ |
|
4667 # FindDirs |
|
4668 # Parameters: |
|
4669 # $goDir, where to start finding |
|
4670 # $fileSearch, filename search |
|
4671 # $refIncfiles, reference to array which will hold found files |
|
4672 #------------------------------------------------------------------------------------ |
|
4673 sub FindDirs |
|
4674 { |
|
4675 my ($godir, $fileSearch, $refIncfiles) = @_; |
|
4676 |
|
4677 my $startDir = cwd; |
|
4678 |
|
4679 chdir($godir) or die("Could not change dir to $godir"); |
|
4680 |
|
4681 #print("Now in: " . cwd . "\n"); |
|
4682 |
|
4683 opendir(DIR, "."); |
|
4684 my @filelist = sort(readdir(DIR)); |
|
4685 closedir(DIR); |
|
4686 |
|
4687 foreach my $file(@filelist) |
|
4688 { |
|
4689 if($file eq "." or $file eq "..") {next}; |
|
4690 |
|
4691 if (-d $file) |
|
4692 { |
|
4693 if( $file =~ m/$fileSearch/i ) |
|
4694 { |
|
4695 push @$refIncfiles, (cwd . "/" . $file); |
|
4696 } |
|
4697 FindDirs( $file, $fileSearch, $refIncfiles ); |
|
4698 } |
|
4699 } |
|
4700 |
|
4701 chdir ($startDir) or die("Could not change dir to $startDir"); |
|
4702 } |
|
4703 |
|
4704 #------------------------------------------------------------------------------------ |
|
4705 # GetPathFileName |
|
4706 # |
|
4707 # Parameters: |
|
4708 # $str |
|
4709 #------------------------------------------------------------------------------------ |
|
4710 sub GetPathFileName |
|
4711 { |
|
4712 my ($str) = @_; |
|
4713 |
|
4714 my $startPos = rindex($str, "\\"); |
|
4715 if($startPos == -1) |
|
4716 { |
|
4717 $startPos = rindex($str, "/"); |
|
4718 return $str if($startPos == -1); |
|
4719 } |
|
4720 |
|
4721 my $filename = substr($str, $startPos+1); |
|
4722 |
|
4723 return $filename; |
|
4724 } |
|
4725 |
|
4726 #------------------------------------------------------------------------------------ |
|
4727 # GetPathDir |
|
4728 # |
|
4729 # Parameters: |
|
4730 # $str |
|
4731 #------------------------------------------------------------------------------------ |
|
4732 sub GetPathDir |
|
4733 { |
|
4734 my ($str) = @_; |
|
4735 |
|
4736 my $startPos = rindex($str, "\\"); |
|
4737 if($startPos == -1) |
|
4738 { |
|
4739 $startPos = rindex($str, "/"); |
|
4740 return $str if($startPos == -1); |
|
4741 } |
|
4742 |
|
4743 my $filename = substr($str, 0, $startPos); |
|
4744 |
|
4745 return $filename; |
|
4746 } |
|
4747 |
|
4748 sub InitXmlData |
|
4749 { |
|
4750 |
|
4751 $xmlHeader = |
|
4752 "<?xml version='1.0'?>" . |
|
4753 "<?mso-application progid='Excel.Sheet'?>" . |
|
4754 "<Workbook xmlns='urn:schemas-microsoft-com:office:spreadsheet'" . |
|
4755 " xmlns:o='urn:schemas-microsoft-com:office:office'" . |
|
4756 " xmlns:x='urn:schemas-microsoft-com:office:excel'" . |
|
4757 " xmlns:ss='urn:schemas-microsoft-com:office:spreadsheet'" . |
|
4758 " xmlns:html='http://www.w3.org/TR/REC-html40'>" . |
|
4759 " <DocumentProperties xmlns='urn:schemas-microsoft-com:office:office'>" . |
|
4760 " <Author>Senbom Petri</Author>" . |
|
4761 " <LastAuthor>Senbom Petri</LastAuthor>" . |
|
4762 " <Created>2006-06-09T11:08:05Z</Created>" . |
|
4763 " <Company>Nokia Oyj</Company>" . |
|
4764 " <Version>11.6568</Version>" . |
|
4765 " </DocumentProperties>" . |
|
4766 " <ExcelWorkbook xmlns='urn:schemas-microsoft-com:office:excel'>" . |
|
4767 " <WindowHeight>12210</WindowHeight>" . |
|
4768 " <WindowWidth>18780</WindowWidth>" . |
|
4769 " <WindowTopX>360</WindowTopX>" . |
|
4770 " <WindowTopY>255</WindowTopY>" . |
|
4771 " <ProtectStructure>False</ProtectStructure>" . |
|
4772 " <ProtectWindows>False</ProtectWindows>" . |
|
4773 " </ExcelWorkbook>" . |
|
4774 " <Styles>" . |
|
4775 " <Style ss:ID='Default' ss:Name='Normal'>" . |
|
4776 " <Alignment ss:Vertical='Bottom'/>" . |
|
4777 " <Borders/>" . |
|
4778 " <Font/>" . |
|
4779 " <Interior/>" . |
|
4780 " <NumberFormat/>" . |
|
4781 " <Protection/>" . |
|
4782 " </Style>" . |
|
4783 " <Style ss:ID='m155260432'>" . |
|
4784 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4785 " <Borders>" . |
|
4786 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4787 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4788 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4789 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4790 " </Borders>" . |
|
4791 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
4792 " </Style>" . |
|
4793 " <Style ss:ID='m155260442'>" . |
|
4794 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4795 " <Borders>" . |
|
4796 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4797 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4798 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4799 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4800 " </Borders>" . |
|
4801 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
4802 " </Style>" . |
|
4803 " <Style ss:ID='m155266416'>" . |
|
4804 " <Alignment ss:Vertical='Bottom'/>" . |
|
4805 " <Borders>" . |
|
4806 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4807 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4808 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4809 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4810 " </Borders>" . |
|
4811 " <Font x:Family='Swiss' ss:Bold='1'/>" . |
|
4812 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
4813 " </Style>" . |
|
4814 " <Style ss:ID='m155266426'>" . |
|
4815 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4816 " <Borders>" . |
|
4817 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4818 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4819 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4820 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4821 " </Borders>" . |
|
4822 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
4823 " </Style>" . |
|
4824 " <Style ss:ID='m155266436'>" . |
|
4825 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4826 " <Borders>" . |
|
4827 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4828 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4829 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4830 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4831 " </Borders>" . |
|
4832 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
4833 " </Style>" . |
|
4834 " <Style ss:ID='m155266446'>" . |
|
4835 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4836 " <Borders>" . |
|
4837 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4838 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4839 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4840 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4841 " </Borders>" . |
|
4842 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
4843 " </Style>" . |
|
4844 " <Style ss:ID='s21'>" . |
|
4845 " <Alignment ss:Horizontal='Right' ss:Vertical='Bottom'/>" . |
|
4846 " <Borders>" . |
|
4847 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4848 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4849 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4850 " </Borders>" . |
|
4851 " <Interior ss:Color='#99CCFF' ss:Pattern='Solid'/>" . |
|
4852 " </Style>" . |
|
4853 " <Style ss:ID='s25'>" . |
|
4854 " <Alignment ss:Horizontal='Right' ss:Vertical='Bottom'/>" . |
|
4855 " <Borders>" . |
|
4856 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4857 " </Borders>" . |
|
4858 " <Interior ss:Color='#99CCFF' ss:Pattern='Solid'/>" . |
|
4859 " </Style>" . |
|
4860 " <Style ss:ID='s26'>" . |
|
4861 " <Borders>" . |
|
4862 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4863 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4864 " </Borders>" . |
|
4865 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
4866 " </Style>" . |
|
4867 " <Style ss:ID='s27'>" . |
|
4868 " <Alignment ss:Horizontal='Center' ss:Vertical='Bottom'/>" . |
|
4869 " <Borders>" . |
|
4870 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4871 " </Borders>" . |
|
4872 " <Interior ss:Color='#99CCFF' ss:Pattern='Solid'/>" . |
|
4873 " </Style>" . |
|
4874 " <Style ss:ID='s28'>" . |
|
4875 " <Borders>" . |
|
4876 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4877 " </Borders>" . |
|
4878 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
4879 " </Style>" . |
|
4880 " <Style ss:ID='s29'>" . |
|
4881 " <Borders>" . |
|
4882 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4883 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4884 " </Borders>" . |
|
4885 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
4886 " </Style>" . |
|
4887 " <Style ss:ID='s30'>" . |
|
4888 " <Alignment ss:Horizontal='Right' ss:Vertical='Top'/>" . |
|
4889 " <Borders>" . |
|
4890 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4891 " </Borders>" . |
|
4892 " <Interior ss:Color='#99CCFF' ss:Pattern='Solid'/>" . |
|
4893 " </Style>" . |
|
4894 " <Style ss:ID='s34'>" . |
|
4895 " <Alignment ss:Horizontal='Right' ss:Vertical='Top'/>" . |
|
4896 " <Borders>" . |
|
4897 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4898 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4899 " </Borders>" . |
|
4900 " <Interior ss:Color='#99CCFF' ss:Pattern='Solid'/>" . |
|
4901 " </Style>" . |
|
4902 " <Style ss:ID='s35'>" . |
|
4903 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
4904 " </Style>" . |
|
4905 |
|
4906 #failed |
|
4907 |
|
4908 " <Style ss:ID='s36'>" . |
|
4909 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4910 " <Borders>" . |
|
4911 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4912 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4913 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4914 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4915 " </Borders>" . |
|
4916 " <Interior ss:Color='#FFFF00' ss:Pattern='Solid'/>" . |
|
4917 " </Style>" . |
|
4918 |
|
4919 #passed style |
|
4920 |
|
4921 " <Style ss:ID='s37'>" . |
|
4922 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4923 " <Borders>" . |
|
4924 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4925 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4926 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4927 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4928 " </Borders>" . |
|
4929 " <Interior ss:Color='#CCFFCC' ss:Pattern='Solid'/>" . |
|
4930 " </Style>" . |
|
4931 |
|
4932 #crashed style |
|
4933 |
|
4934 " <Style ss:ID='s38'>" . |
|
4935 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4936 " <Borders>" . |
|
4937 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4938 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4939 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4940 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4941 " </Borders>" . |
|
4942 " <Interior ss:Color='#FF6600' ss:Pattern='Solid'/>" . |
|
4943 " </Style>" . |
|
4944 |
|
4945 # UNKNOWN style |
|
4946 |
|
4947 " <Style ss:ID='s401'>" . |
|
4948 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4949 " <Borders>" . |
|
4950 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4951 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4952 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4953 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4954 " </Borders>" . |
|
4955 " <Interior ss:Color='#FF6600' ss:Pattern='Solid'/>" . |
|
4956 " </Style>" . |
|
4957 |
|
4958 |
|
4959 #NA style |
|
4960 " <Style ss:ID='s39'>" . |
|
4961 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4962 " <Borders>" . |
|
4963 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4964 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4965 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4966 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4967 " </Borders>" . |
|
4968 " </Style>" . |
|
4969 |
|
4970 |
|
4971 #failed centered |
|
4972 |
|
4973 " <Style ss:ID='s36centered'>" . |
|
4974 " <Alignment ss:Horizontal=\"Center\" ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4975 " <Borders>" . |
|
4976 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4977 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4978 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4979 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4980 " </Borders>" . |
|
4981 " <Interior ss:Color='#FFFF00' ss:Pattern='Solid'/>" . |
|
4982 " </Style>" . |
|
4983 |
|
4984 #passed style centered |
|
4985 |
|
4986 " <Style ss:ID='s37centered'>" . |
|
4987 " <Alignment ss:Horizontal=\"Center\" ss:Vertical='Top' ss:WrapText='1'/>" . |
|
4988 " <Borders>" . |
|
4989 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4990 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4991 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4992 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
4993 " </Borders>" . |
|
4994 " <Interior ss:Color='#CCFFCC' ss:Pattern='Solid'/>" . |
|
4995 " </Style>" . |
|
4996 |
|
4997 #crashed style centered |
|
4998 |
|
4999 " <Style ss:ID='s38centered'>" . |
|
5000 " <Alignment ss:Horizontal=\"Center\" ss:Vertical='Top' ss:WrapText='1'/>" . |
|
5001 " <Borders>" . |
|
5002 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5003 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5004 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5005 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5006 " </Borders>" . |
|
5007 " <Interior ss:Color='#FF6600' ss:Pattern='Solid'/>" . |
|
5008 " </Style>" . |
|
5009 |
|
5010 # UNKNOWN style centered |
|
5011 |
|
5012 " <Style ss:ID='s401centered'>" . |
|
5013 " <Alignment ss:Horizontal=\"Center\" ss:Vertical='Top' ss:WrapText='1'/>" . |
|
5014 " <Borders>" . |
|
5015 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5016 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5017 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5018 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5019 " </Borders>" . |
|
5020 " <Interior ss:Color='#FF6600' ss:Pattern='Solid'/>" . |
|
5021 " </Style>" . |
|
5022 |
|
5023 |
|
5024 #NA style centered |
|
5025 " <Style ss:ID='s39centered'>" . |
|
5026 " <Alignment ss:Horizontal=\"Center\" ss:Vertical='Top' ss:WrapText='1'/>" . |
|
5027 " <Borders>" . |
|
5028 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5029 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5030 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5031 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5032 " </Borders>" . |
|
5033 " </Style>" . |
|
5034 |
|
5035 #summary style |
|
5036 " <Style ss:ID='summary'>" . |
|
5037 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
5038 " <Borders>" . |
|
5039 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5040 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5041 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5042 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5043 " </Borders>" . |
|
5044 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
5045 " </Style>" . |
|
5046 |
|
5047 #summary real number style |
|
5048 " <Style ss:ID='summaryreal'>" . |
|
5049 " <NumberFormat ss:Format='Fixed'/> ". |
|
5050 " <Alignment ss:Vertical='Top' ss:WrapText='1'/>" . |
|
5051 " <Borders>" . |
|
5052 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5053 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5054 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5055 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5056 " </Borders>" . |
|
5057 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
5058 " </Style>" . |
|
5059 |
|
5060 #summary header |
|
5061 " <Style ss:ID='summary_header'>" . |
|
5062 " <Alignment ss:Horizontal='Left' ss:Vertical='Bottom'/>" . |
|
5063 " <Borders>" . |
|
5064 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5065 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5066 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5067 " </Borders>" . |
|
5068 " <Font x:Family='Swiss' ss:Bold='1'/>" . |
|
5069 " </Style>" . |
|
5070 |
|
5071 #brief header |
|
5072 " <Style ss:ID='brief_header'>" . |
|
5073 " <Alignment ss:Horizontal='Center' ss:Vertical='Bottom'/>" . |
|
5074 " <Borders>" . |
|
5075 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5076 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5077 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5078 " </Borders>" . |
|
5079 " <Interior ss:Color='#99CCFF' ss:Pattern='Solid'/>" . |
|
5080 " </Style>" . |
|
5081 |
|
5082 " <Style ss:ID='brief_heading_cfgfilename'>" . |
|
5083 " <Alignment ss:Vertical='Bottom'/>" . |
|
5084 " <Borders>" . |
|
5085 " <Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5086 " <Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5087 " <Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5088 " <Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>" . |
|
5089 " </Borders>" . |
|
5090 " <Font x:Family='Swiss' ss:Bold='1'/>" . |
|
5091 " <Interior ss:Color='#CCFFCC' ss:Pattern='Solid'/>" . |
|
5092 " </Style>" . |
|
5093 |
|
5094 #link |
|
5095 " <Style ss:ID='urlparent' ss:Name='Hyperlink'>" . |
|
5096 " <Font ss:Color='#0000FF' ss:Underline='Single'/>" . |
|
5097 " </Style>" . |
|
5098 |
|
5099 " <Style ss:ID='url' ss:Parent='urlparent'>" . |
|
5100 " <Interior ss:Color='#FFFFFF' ss:Pattern='Solid'/>" . |
|
5101 " </Style>" . |
|
5102 |
|
5103 " </Styles>" . |
|
5104 " <Worksheet ss:Name='Sheet1'>"; |
|
5105 |
|
5106 $xmlHeaderTableColumns = |
|
5107 " <Table ss:ExpandedColumnCount='18' ss:ExpandedRowCount='CASE_COUNT_MUL8' x:FullColumns='1'" . |
|
5108 " x:FullRows='1'>" . |
|
5109 " <Column ss:AutoFitWidth='0' ss:Width='138.75'/>" . |
|
5110 " <Column ss:Index='3' ss:AutoFitWidth='0' ss:Width='39'/>" . |
|
5111 " <Column ss:Index='5' ss:AutoFitWidth='0' ss:Width='39'/>" . |
|
5112 " <Column ss:Index='7' ss:AutoFitWidth='0' ss:Width='39'/>" . |
|
5113 " <Column ss:Index='16' ss:AutoFitWidth='0' ss:Width='26.25'/>" . |
|
5114 " <Column ss:AutoFitWidth='0' ss:Width='15'/>" . |
|
5115 " <Column ss:AutoFitWidth='0' ss:Width='525.75'/>\n\n"; |
|
5116 |
|
5117 $xmlHeaderTableColumnsBrief = |
|
5118 " <Table ss:ExpandedColumnCount='25' ss:ExpandedRowCount='CASE_COUNT_MUL8' x:FullColumns='1'" . |
|
5119 " x:FullRows='1'>" . |
|
5120 " <Column ss:AutoFitWidth='0' ss:Width='138.75'/>" . |
|
5121 " <Column ss:Index='2' ss:AutoFitWidth='0' ss:Width='39'/>" . |
|
5122 " <Column ss:Index='3' ss:AutoFitWidth='0' ss:Width='39'/>" . |
|
5123 " <Column ss:Index='4' ss:AutoFitWidth='0' ss:Width='39'/>" . |
|
5124 " <Column ss:Index='5' ss:AutoFitWidth='0' ss:Width='39'/>" . |
|
5125 " <Column ss:Index='6' ss:AutoFitWidth='0' ss:Width='39'/>" . |
|
5126 " <Column ss:Index='7' ss:AutoFitWidth='0' ss:Width='65'/>" . #status |
|
5127 " <Column ss:Index='8' ss:AutoFitWidth='0' ss:Width='39'/>" . |
|
5128 " <Column ss:Index='9' ss:AutoFitWidth='0' ss:Width='39'/>" . |
|
5129 " <Column ss:Index='12' ss:AutoFitWidth='0' ss:Width='260'/>" . # info |
|
5130 " <Column ss:Index='13' ss:AutoFitWidth='0' ss:Width='26.25'/>" . # link1 |
|
5131 " <Column ss:Index='14' ss:AutoFitWidth='0' ss:Width='26.25'/>" . # link2 |
|
5132 " <Column ss:Index='16' ss:AutoFitWidth='0' ss:Width='26.25'/>" . |
|
5133 " <Column ss:AutoFitWidth='0' ss:Width='15'/>" . |
|
5134 " <Column ss:AutoFitWidth='0' ss:Width='525.75'/>\n\n"; |
|
5135 |
|
5136 $xmlHeaderTableColumnsAlt = |
|
5137 " <Table ss:ExpandedColumnCount='25' ss:ExpandedRowCount='CASE_COUNT_MUL8' x:FullColumns='1'" . |
|
5138 " x:FullRows='1'>" . |
|
5139 " <Column ss:AutoFitWidth=\"0\" ss:Width=\"138.75\"/>" . |
|
5140 " <Column ss:AutoFitWidth=\"0\" ss:Width=\"30\" ss:Span=\"4\"/>" . |
|
5141 " <Column ss:Index=\"7\" ss:AutoFitWidth=\"0\" ss:Width=\"60.00\" ss:Span=\"9\"/>" . |
|
5142 " <Column ss:Index=\"17\" ss:AutoFitWidth=\"0\" ss:Width=\"15\"/>" . |
|
5143 " <Column ss:AutoFitWidth=\"0\" ss:Width=\"525.75\"/>"; |
|
5144 |
|
5145 $xmlFooter = |
|
5146 |
|
5147 " </Table>" . |
|
5148 " <WorksheetOptions xmlns='urn:schemas-microsoft-com:office:excel'>" . |
|
5149 |
|
5150 #splitted panes |
|
5151 #" <Selected/>" . |
|
5152 #" <SplitHorizontal>3060</SplitHorizontal>" . |
|
5153 #" <TopRowBottomPane>11</TopRowBottomPane>" . |
|
5154 #" <ActivePane>2</ActivePane>" . |
|
5155 #" <Panes>" . |
|
5156 #" <Pane>" . |
|
5157 #" <Number>3</Number>" . |
|
5158 #" </Pane>" . |
|
5159 #" <Pane>" . |
|
5160 #" <Number>2</Number>" . |
|
5161 #" <RangeSelection>R12C1:R12C8</RangeSelection>" . |
|
5162 #" </Pane>" . |
|
5163 #" </Panes>" . |
|
5164 |
|
5165 #not splitted |
|
5166 " <Selected/>" . |
|
5167 " <Panes>" . |
|
5168 " <Pane>" . |
|
5169 " <Number>3</Number>" . |
|
5170 " <ActiveRow>7</ActiveRow>" . |
|
5171 " <ActiveCol>2</ActiveCol>" . |
|
5172 " </Pane>" . |
|
5173 " </Panes>" . |
|
5174 |
|
5175 " <ProtectObjects>False</ProtectObjects>" . |
|
5176 " <ProtectScenarios>False</ProtectScenarios>" . |
|
5177 " </WorksheetOptions>" . |
|
5178 " </Worksheet>" . |
|
5179 " <Worksheet ss:Name='Sheet2'>" . |
|
5180 " <WorksheetOptions xmlns='urn:schemas-microsoft-com:office:excel'>" . |
|
5181 " <ProtectObjects>False</ProtectObjects>" . |
|
5182 " <ProtectScenarios>False</ProtectScenarios>" . |
|
5183 " </WorksheetOptions>" . |
|
5184 " </Worksheet>" . |
|
5185 " <Worksheet ss:Name='Sheet3'>" . |
|
5186 " <WorksheetOptions xmlns='urn:schemas-microsoft-com:office:excel'>" . |
|
5187 " <ProtectObjects>False</ProtectObjects>" . |
|
5188 " <ProtectScenarios>False</ProtectScenarios>" . |
|
5189 " </WorksheetOptions>" . |
|
5190 " </Worksheet>" . |
|
5191 "</Workbook>\n\n"; |
|
5192 |
|
5193 $xmlDataEmptyRow = |
|
5194 " <Row>" . |
|
5195 " <Cell ss:StyleID='s35'><Data ss:Type='String'></Data></Cell>" . |
|
5196 " <Cell ss:StyleID='s35'/>" . |
|
5197 " <Cell ss:StyleID='s35'/>" . |
|
5198 " <Cell ss:StyleID='s35'/>" . |
|
5199 " <Cell ss:StyleID='s35'/>" . |
|
5200 " <Cell ss:StyleID='s35'/>" . |
|
5201 " <Cell ss:StyleID='s35'/>" . |
|
5202 " <Cell ss:StyleID='s35'/>" . |
|
5203 " <Cell ss:StyleID='s35'/>" . |
|
5204 " <Cell ss:StyleID='s35'/>" . |
|
5205 " <Cell ss:StyleID='s35'/>" . |
|
5206 " <Cell ss:StyleID='s35'/>" . |
|
5207 " <Cell ss:StyleID='s35'/>" . |
|
5208 " <Cell ss:StyleID='s35'/>" . |
|
5209 " <Cell ss:StyleID='s35'/>" . |
|
5210 " <Cell ss:StyleID='s35'/>" . |
|
5211 " <Cell ss:StyleID='s35'/>" . |
|
5212 " <Cell ss:StyleID='s35'/>" . |
|
5213 " </Row>\n\n"; |
|
5214 |
|
5215 $xmlSummaryData = |
|
5216 |
|
5217 $xmlDataEmptyRow . |
|
5218 |
|
5219 " <Row>" . |
|
5220 " <Cell ss:StyleID='s35' ss:MergeAcross='20'>" . "<Data ss:Type='String'>INSERT TEST SOFTWARE HERE</Data></Cell>" . |
|
5221 " </Row>\n\n" . |
|
5222 |
|
5223 " <Row>" . |
|
5224 " <Cell ss:StyleID='s35' ss:MergeAcross='20'>" . "<Data ss:Type='String'>INSERT TEST DEVICE HERE</Data></Cell>" . |
|
5225 " </Row>\n\n" . |
|
5226 |
|
5227 $xmlDataEmptyRow . |
|
5228 |
|
5229 " <Row>\n" . |
|
5230 " <Cell ss:MergeAcross='4' ss:StyleID='summary_header'><Data ss:Type='String'>Test Execution Metrics</Data></Cell>" . |
|
5231 " <Cell ss:MergeAcross='12' ss:StyleID='s35'/>\n" . |
|
5232 " </Row>\n" . |
|
5233 " <Row>\n" . |
|
5234 " <Cell ss:StyleID='s25'><Data ss:Type='String'>Total cases:</Data></Cell>" . |
|
5235 " <Cell ss:MergeAcross='3' ss:StyleID='summary'><Data ss:Type='Number'>$xmlDataSummaryCaseCount</Data></Cell>" . |
|
5236 " <Cell ss:MergeAcross='12' ss:StyleID='s35'/>\n" . |
|
5237 " </Row>\n" . |
|
5238 " <Row>\n" . |
|
5239 " <Cell ss:StyleID='s25'><Data ss:Type='String'>Passed:</Data></Cell>" . |
|
5240 " <Cell ss:MergeAcross='3' ss:StyleID='summary'><Data ss:Type='Number'>$xmlDataSummaryPassed</Data></Cell>" . |
|
5241 " <Cell ss:MergeAcross='12' ss:StyleID='s35'/>\n" . |
|
5242 " </Row>\n" . |
|
5243 " <Row>\n" . |
|
5244 " <Cell ss:StyleID='s25'><Data ss:Type='String'>Failed:</Data></Cell>" . |
|
5245 " <Cell ss:MergeAcross='3' ss:StyleID='summary'><Data ss:Type='Number'>$xmlDataSummaryFailed</Data></Cell>" . |
|
5246 " <Cell ss:MergeAcross='12' ss:StyleID='s35'/>\n" . |
|
5247 " </Row>\n" . |
|
5248 " <Row>\n" . |
|
5249 " <Cell ss:StyleID='s25'><Data ss:Type='String'>Crashed:</Data></Cell>" . |
|
5250 " <Cell ss:MergeAcross='3' ss:StyleID='summary'><Data ss:Type='Number'>$xmlDataSummaryCrashed</Data></Cell>" . |
|
5251 " <Cell ss:MergeAcross='12' ss:StyleID='s35'/>\n" . |
|
5252 " </Row>\n" . |
|
5253 " <Row>\n" . |
|
5254 " <Cell ss:StyleID='s25'><Data ss:Type='String'>Timeout:</Data></Cell>" . |
|
5255 " <Cell ss:MergeAcross='3' ss:StyleID='summary'><Data ss:Type='Number'>$xmlDataSummaryTimeout</Data></Cell>" . |
|
5256 " <Cell ss:MergeAcross='12' ss:StyleID='s35'/>\n" . |
|
5257 " </Row>\n" . |
|
5258 " <Row>\n" . |
|
5259 " <Cell ss:StyleID='s25'><Data ss:Type='String'>Pass rate % (total cases):</Data></Cell>" . |
|
5260 " <Cell ss:MergeAcross='3' ss:StyleID='summaryreal'><Data ss:Type='Number'>$xmlDataSummaryPassRateTotal</Data></Cell>" . |
|
5261 " <Cell ss:MergeAcross='12' ss:StyleID='s35'/>\n" . |
|
5262 " </Row>\n" . |
|
5263 " <Row>\n" . |
|
5264 " <Cell ss:StyleID='s25'><Data ss:Type='String'>Pass rate % (run cases):</Data></Cell>" . |
|
5265 " <Cell ss:MergeAcross='3' ss:StyleID='summaryreal'><Data ss:Type='Number'>$xmlDataSummaryPassRateRun</Data></Cell>" . |
|
5266 " <Cell ss:MergeAcross='12' ss:StyleID='s35'/>\n" . |
|
5267 " </Row>\n" . |
|
5268 " <Row>\n" . |
|
5269 " <Cell ss:StyleID='s25'><Data ss:Type='String'>Run rate %:</Data></Cell>" . |
|
5270 " <Cell ss:MergeAcross='3' ss:StyleID='summaryreal'><Data ss:Type='Number'>$xmlDataSummaryRunRate</Data></Cell>" . |
|
5271 " <Cell ss:MergeAcross='12' ss:StyleID='s35'/>\n" . |
|
5272 " </Row>\n" . |
|
5273 $xmlDataEmptyRow; |
|
5274 |
|
5275 $xmlData = |
|
5276 " <Row>" . |
|
5277 " <Cell ss:StyleID='s21'><Data ss:Type='String'>Name:</Data></Cell>" . |
|
5278 " <Cell ss:MergeAcross='15' ss:StyleID='m155266416'><Data ss:Type='String'>XML_DATA_CASE_NAME</Data></Cell>" . |
|
5279 " <Cell ss:StyleID='s35'/>" . |
|
5280 " </Row>"; |
|
5281 |
|
5282 # not included in the case documentation report |
|
5283 $xmlDataCaseStatusDisabled = |
|
5284 " <Row>" . |
|
5285 " <Cell ss:StyleID='s25'><Data ss:Type='String'>Run times:</Data></Cell>" . |
|
5286 " <Cell ss:StyleID='s26'><Data ss:Type='Number'>XML_DATA_CASE_RUN_TIMES</Data></Cell>" . |
|
5287 # |
|
5288 " <Cell ss:StyleID='s27'><Data ss:Type='String'>Crashed</Data></Cell>" . |
|
5289 " <Cell ss:StyleID='s28'><Data ss:Type='Number'>XML_DATA_CASE_CRASHED</Data></Cell>" . |
|
5290 |
|
5291 " <Cell ss:StyleID='s27'><Data ss:Type='String'>Failed</Data></Cell>" . |
|
5292 " <Cell ss:StyleID='s28'><Data ss:Type='Number'>XML_DATA_CASE_FAILED</Data></Cell>" . |
|
5293 " <Cell ss:StyleID='s27'><Data ss:Type='String'>Passed</Data></Cell>" . |
|
5294 " <Cell ss:StyleID='s28'><Data ss:Type='Number'>XML_DATA_CASE_PASSED</Data></Cell>" . |
|
5295 " <Cell ss:StyleID='s27'><Data ss:Type='String'>Status</Data></Cell>" . |
|
5296 #orig status style id s28 |
|
5297 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='String'>XML_DATA_CASE_STATUS</Data></Cell>" . |
|
5298 " <Cell ss:StyleID='s28'/>" . |
|
5299 " <Cell ss:StyleID='s28'/>" . |
|
5300 " <Cell ss:StyleID='s28'/>" . |
|
5301 " <Cell ss:StyleID='s28'/>" . |
|
5302 " <Cell ss:StyleID='s28'/>" . |
|
5303 " <Cell ss:StyleID='s28'/>" . |
|
5304 " <Cell ss:StyleID='s28'/>" . |
|
5305 #" <Cell ss:StyleID='s28'/>" . |
|
5306 #" <Cell ss:StyleID='s29'/>" . |
|
5307 " <Cell ss:StyleID='s35'/>" . |
|
5308 " </Row>\n\n"; |
|
5309 $xmlDataCaseStatusDisabled .= ""; |
|
5310 |
|
5311 $xmlData2 = |
|
5312 " <Row ss:AutoFitHeight='0' ss:Height='30'>" . |
|
5313 " <Cell ss:StyleID='s30'><Data ss:Type='String'>Purpose:</Data></Cell>" . |
|
5314 " <Cell ss:MergeAcross='15' ss:StyleID='m155266426'><Data ss:Type='String'>XML_DATA_CASE_PURPOSE</Data></Cell>" . |
|
5315 " <Cell ss:StyleID='s35'/>" . |
|
5316 " </Row>" . |
|
5317 " <Row ss:AutoFitHeight='0' ss:Height='30'>" . |
|
5318 " <Cell ss:StyleID='s30'><Data ss:Type='String'>Means:</Data></Cell>" . |
|
5319 " <Cell ss:MergeAcross='15' ss:StyleID='m155266436'><Data ss:Type='String'>XML_DATA_CASE_MEANS</Data></Cell>" . |
|
5320 " <Cell ss:StyleID='s35'/>" . |
|
5321 " </Row>" . |
|
5322 " <Row ss:AutoFitHeight='0' ss:Height='30'>" . |
|
5323 " <Cell ss:StyleID='s30'><Data ss:Type='String'>Required environment settings:</Data></Cell>" . |
|
5324 " <Cell ss:MergeAcross='15' ss:StyleID='m155266446'><Data ss:Type='String'>XML_DATA_CASE_REQUIRED_SETTINGS</Data></Cell>" . |
|
5325 " <Cell ss:StyleID='s35'/>" . |
|
5326 " </Row>" . |
|
5327 " <Row ss:AutoFitHeight='0' ss:Height='30'>" . |
|
5328 " <Cell ss:StyleID='s30'><Data ss:Type='String'>Related requirements:</Data></Cell>" . |
|
5329 " <Cell ss:MergeAcross='15' ss:StyleID='m155266446'><Data ss:Type='String'>XML_DATA_CASE_RELATED_REQUIREMENTS</Data></Cell>" . |
|
5330 " <Cell ss:StyleID='s35'/>" . |
|
5331 " </Row>" . |
|
5332 |
|
5333 " <Row ss:AutoFitHeight='0' ss:Height='30'>" . |
|
5334 " <Cell ss:StyleID='s30'><Data ss:Type='String'>Verification:</Data></Cell>" . |
|
5335 " <Cell ss:MergeAcross='15' ss:StyleID='m155260432'><Data ss:Type='String'>XML_DATA_CASE_VERIFICATION</Data></Cell>" . |
|
5336 " <Cell ss:StyleID='s35'/>" . |
|
5337 " </Row>" . |
|
5338 " <Row ss:AutoFitHeight='0' ss:Height='30'>" . |
|
5339 " <Cell ss:StyleID='s34'><Data ss:Type='String'>Note:</Data></Cell>" . |
|
5340 " <Cell ss:MergeAcross='15' ss:StyleID='m155260442'><Data ss:Type='String'>XML_DATA_CASE_NOTE</Data></Cell>" . |
|
5341 " <Cell ss:StyleID='s35'/>" . |
|
5342 " </Row>\n\n"; |
|
5343 |
|
5344 |
|
5345 $xmlDataBriefHeader = |
|
5346 " <Row>" . |
|
5347 " <Cell ss:MergeAcross='5' ss:StyleID='brief_header'><Data ss:Type='String'>Name</Data></Cell>" . |
|
5348 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>Status</Data></Cell>" . |
|
5349 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>Passes</Data></Cell>" . |
|
5350 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>Fails</Data></Cell>" . |
|
5351 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>Crashes</Data></Cell>" . |
|
5352 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>Result</Data></Cell>" . |
|
5353 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>Info</Data></Cell>" . |
|
5354 " <Cell ss:MergeAcross='6' ss:StyleID='s35'/>" . |
|
5355 " </Row>\n\n"; |
|
5356 |
|
5357 $xmlDataBriefNoLinks = |
|
5358 " <Row>\n" . |
|
5359 " <Cell ss:MergeAcross='5' ss:StyleID='m155266416'><Data ss:Type='String'>XML_DATA_CASE_NAME</Data></Cell>\n" . |
|
5360 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='String'>XML_DATA_CASE_STATUS</Data></Cell>\n" . |
|
5361 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_PASSED</Data></Cell>\n" . |
|
5362 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_FAILED</Data></Cell>\n" . |
|
5363 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_CRASHED</Data></Cell>\n" . |
|
5364 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_RESULT</Data></Cell>\n" . |
|
5365 " <Cell ss:StyleID='s39'><Data ss:Type='String'>XML_DATA_CASE_REASON</Data></Cell>\n" . |
|
5366 " <Cell ss:MergeAcross='7' ss:StyleID='s35'/>\n" . |
|
5367 " </Row>\n\n"; |
|
5368 |
|
5369 $xmlDataBrief1Link = |
|
5370 " <Row>\n" . |
|
5371 " <Cell ss:MergeAcross='5' ss:StyleID='m155266416'><Data ss:Type='String'>XML_DATA_CASE_NAME</Data></Cell>\n" . |
|
5372 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='String'>XML_DATA_CASE_STATUS</Data></Cell>\n" . |
|
5373 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_PASSED</Data></Cell>\n" . |
|
5374 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_FAILED</Data></Cell>\n" . |
|
5375 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_CRASHED</Data></Cell>\n" . |
|
5376 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_RESULT</Data></Cell>\n" . |
|
5377 " <Cell ss:StyleID='s39'><Data ss:Type='String'>XML_DATA_CASE_REASON</Data></Cell>\n" . |
|
5378 " <Cell ss:StyleID='url' ss:HRef='XML_DATA_CASE_LINK1'><Data ss:Type='String'>Link</Data></Cell>\n" . |
|
5379 " <Cell ss:MergeAcross='6' ss:StyleID='s35'/>\n" . |
|
5380 " </Row>\n\n"; |
|
5381 |
|
5382 $xmlDataBrief2Links = |
|
5383 " <Row>\n" . |
|
5384 " <Cell ss:MergeAcross='5' ss:StyleID='m155266416'><Data ss:Type='String'>XML_DATA_CASE_NAME</Data></Cell>\n" . |
|
5385 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='String'>XML_DATA_CASE_STATUS</Data></Cell>\n" . |
|
5386 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_PASSED</Data></Cell>\n" . |
|
5387 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_FAILED</Data></Cell>\n" . |
|
5388 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_CRASHED</Data></Cell>\n" . |
|
5389 " <Cell ss:StyleID='s39'><Data ss:Type='Number'>XML_DATA_CASE_RESULT</Data></Cell>\n" . |
|
5390 " <Cell ss:StyleID='s39'><Data ss:Type='String'>XML_DATA_CASE_REASON</Data></Cell>\n" . |
|
5391 " <Cell ss:StyleID='url' ss:HRef='XML_DATA_CASE_LINK1'><Data ss:Type='String'>Link</Data></Cell>\n" . |
|
5392 " <Cell ss:StyleID='url' ss:HRef='XML_DATA_CASE_LINK2'><Data ss:Type='String'>Link</Data></Cell>\n" . |
|
5393 " <Cell ss:MergeAcross='5' ss:StyleID='s35'/>\n" . |
|
5394 " </Row>\n\n"; |
|
5395 |
|
5396 $xmlCfgFileBrief = |
|
5397 " <Row>" . |
|
5398 " <Cell ss:MergeAcross='11' ss:StyleID='brief_heading_cfgfilename'><Data ss:Type='String'>XML_DATA_CFG_FILE</Data></Cell>" . |
|
5399 " <Cell ss:MergeAcross='6' ss:StyleID='s35'/>" . |
|
5400 " </Row>\n\n"; |
|
5401 |
|
5402 |
|
5403 $xmlCfgFileAltHeader = |
|
5404 " <Row>" . |
|
5405 " <Cell ss:MergeAcross='5' ss:StyleID='brief_header'><Data ss:Type='String'>Name</Data></Cell>" . |
|
5406 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>XML_DATA_ALTDATE1</Data></Cell>" . |
|
5407 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>XML_DATA_ALTDATE2</Data></Cell>" . |
|
5408 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>XML_DATA_ALTDATE3</Data></Cell>" . |
|
5409 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>XML_DATA_ALTDATE4</Data></Cell>" . |
|
5410 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>XML_DATA_ALTDATE5</Data></Cell>" . |
|
5411 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>XML_DATA_ALTDATE6</Data></Cell>" . |
|
5412 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>XML_DATA_ALTDATE7</Data></Cell>" . |
|
5413 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>XML_DATA_ALTDATE8</Data></Cell>" . |
|
5414 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>XML_DATA_ALTDATE9</Data></Cell>" . |
|
5415 " <Cell ss:StyleID='brief_header'><Data ss:Type='String'>XML_DATA_ALTDATE10</Data></Cell>" . |
|
5416 " <Cell ss:MergeAcross='6' ss:StyleID='s35'/>" . |
|
5417 " </Row>\n\n"; |
|
5418 |
|
5419 |
|
5420 $xmlCfgFileAltData = |
|
5421 " <Row>" . |
|
5422 " <Cell ss:MergeAcross='5' ss:StyleID='m155266416'><Data ss:Type='String'>XML_DATA_CASE_NAME</Data></Cell>\n" . |
|
5423 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='Number'>XML_DATA_ALTRESULT1</Data></Cell>" . |
|
5424 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='Number'>XML_DATA_ALTRESULT2</Data></Cell>" . |
|
5425 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='Number'>XML_DATA_ALTRESULT3</Data></Cell>" . |
|
5426 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='Number'>XML_DATA_ALTRESULT4</Data></Cell>" . |
|
5427 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='Number'>XML_DATA_ALTRESULT5</Data></Cell>" . |
|
5428 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='Number'>XML_DATA_ALTRESULT6</Data></Cell>" . |
|
5429 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='Number'>XML_DATA_ALTRESULT7</Data></Cell>" . |
|
5430 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='Number'>XML_DATA_ALTRESULT8</Data></Cell>" . |
|
5431 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='Number'>XML_DATA_ALTRESULT9</Data></Cell>" . |
|
5432 " <Cell ss:StyleID='STYLE_ID_STATUS'><Data ss:Type='Number'>XML_DATA_ALTRESULT10</Data></Cell>" . |
|
5433 " <Cell ss:MergeAcross='6' ss:StyleID='s35'/>" . |
|
5434 " </Row>\n\n"; |
|
5435 |
|
5436 } # sub InitXml |
|
5437 |