index — testreport @ master

html testreport generator out of text input

template.html (view raw)

  1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2<html>
  3  <head>
  4    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5    <title>TestCaseManager</title>
  6    <style type="text/css">
  7      
  8       
  9      
 10      @media screen
 11      {
 12        body
 13        {
 14          background-color: rgb(255, 255, 255);
 15          font-family:      arial, verdana, trebuchet, officina, sans-serif;
 16        }
 17      }
 18  
 19      
 20      @media print
 21      {
 22        
 23        body
 24        {
 25          background-color: rgb(255, 255, 255);
 26          font-family:      arial, verdana, trebuchet, officina, sans-serif;
 27        }
 28        
 29        
 30        a
 31        {
 32          text-decoration: none;
 33        }
 34        
 35        
 36        .HeadingTable, .SubHeadingTable, .GroupHeadingTable , .GroupEndTable
 37        {
 38          border-width: 2px;
 39          border-style: solid;
 40          border-color: rgb(150,150,150);
 41        }
 42        
 43        .ResultBlockHeading
 44        {
 45          border-width: 1px;
 46          border-style: solid;
 47          border-color: rgb(150,150,150);
 48        }
 49        
 50        table.ResultTable, table.OverviewTable, table.CheckStatisticsTable
 51        {
 52          border-collapse: collapse;
 53        }
 54        
 55        td.DefaultCell, td.DefineCell, td.NumberCell, td.NumberCellPositiveResult, td.NumberCellNegativeResult, 
 56        td.NumberCellErrorResult, td.NumberCellInconclusiveResult, td.NumberCellNoneResult, td.NumberCellNoColor,
 57        td.PositiveResultCell, td.NegativeResultCell, td.WarningCell, td.NoneResultCell, td.InconclusiveResultCell,
 58        td.ErrorResultCell, th.TableHeadingCell
 59        {
 60          border-width: 1px;
 61          border-style: solid;
 62          border-color: rgb(150,150,150);
 63        }
 64        
 65        .PatternSeparator
 66        {
 67          
 68          border-style: none;
 69        }
 70        
 71        .PositiveResult
 72        {
 73          
 74          border-bottom: 2px solid;
 75        }
 76        
 77        .NegativeResult
 78        {
 79          
 80          border-bottom: 2px solid;
 81        }
 82        
 83        .NoneResult
 84        {
 85          
 86          border-bottom: 2px solid;
 87        }
 88        
 89        .InconclusiveResult
 90        {
 91          
 92          border-bottom: 2px solid;
 93        }
 94        
 95        .ErrorResult
 96        {
 97          
 98          border-bottom: 2px solid;
 99        }
100
101        
102        .TestcaseHeadingDefaultResult
103        {
104          
105          border-bottom: 2px solid;
106        }
107        
108        .TestcaseHeadingPositiveResult
109        {
110          
111          border-bottom: 2px solid;
112        }
113        
114        .TestcaseHeadingNegativeResult
115        {
116          
117          border-bottom: 2px solid;
118        }
119        
120        table.ScreenOnly, a.Undecorated, .LinkCell
121        {
122          display: none;
123        }
124      }
125      
126      a.Undecorated:hover 
127      {
128        color:red;
129      }
130      a.Undecorated
131      { 
132        text-decoration: none; 
133      }
134      
135      .NavStyle
136      {
137        background-color: rgb(220, 221, 222);
138      }
139      
140      td.LinkCell, td.UpCell
141      {
142        
143        width:              1px;
144        white-space:        nowrap;
145      }
146
147      
148      table
149      {
150        margin-bottom:    10px;
151        vertical-align:   top; 
152        border:           0;
153        border-spacing:   1px;
154        padding:          2px;
155      }
156      table.ScreenOnly
157      {
158        vertical-align: top; 
159        margin-bottom:  10px;
160      }
161      .NoMarginBottom
162      {
163        margin-bottom:    0px;
164      }
165      .HeadingTable
166      {
167        width:            100%;
168        text-align:       center;
169        margin-top:       15px;
170        margin-bottom:    30px;
171        margin-left:      auto;
172        margin-right:     auto;
173        background-color: rgb(220, 221, 222);
174      }
175      
176      .SubHeadingTable
177      {
178        width:            100%;
179        text-align:       center;
180        margin-top:       15px;
181        margin-bottom:    25px;
182        background-color: rgb(220, 221, 222);
183      }
184      
185      .GroupHeadingTable, .GroupEndTable
186      {
187        width:            100%;
188        text-align:       center;
189        margin-top:       15px;
190        padding-right:    20px;
191        background-color: rgb(220, 221, 222);
192      }
193      
194      .DefaultTable
195      {
196        padding:        0px;
197        border-spacing: 0px;
198      }
199      
200      .CheckStatisticsTable
201      {
202        margin-bottom: 8px;
203        padding-right:  20px;
204      }
205  
206      .OverviewTable
207      {
208        text-align:     left;
209      }
210      
211      .OverviewResultTable
212      {
213        width:          100%;
214        margin-bottom:  0px;
215        border-spacing: 0px;
216        padding:        0px;
217        text-align:     center;
218      }
219      
220      .ResultTable
221      {
222        width:          100%;
223        text-align:     left;
224        padding-right:  20px;
225      }
226      
227      .ResultTableInner
228      {
229        width:          100%;
230        text-align:     left;
231        padding-right:  0px;
232      }
233  
234      table.ResultTable td, table.ChildLinkTable td
235      {
236        vertical-align: top;
237      }
238      .ChildLinkTable
239      {
240        width:          1px;
241        text-align:     left;
242      }
243      .InfoTable
244      {
245        text-align:     left;
246        padding-right:  0px;
247        margin-bottom:  0px;
248        border-spacing: 0px;
249      }
250      .InfoTableExpand
251      {
252        width:          100%;
253        text-align:     left;
254        padding-right:  0px;
255        margin-bottom:  0px;
256        border-spacing: 0px;
257      }
258      .OverallResultTable
259      {
260        width:         50%;
261        text-align:    center;
262        margin-bottom: 20px;
263        margin-left:   auto;
264        margin-right:  auto;
265        font-weight:   bold;
266      }
267      
268      .TableHeadingCell
269      {
270        background-color: rgb(179, 179, 179);
271        height:           30px;
272        font-family:      arial, verdana, trebuchet, officina, sans-serif;
273        font-weight:      bold;
274        text-align:       center;
275        padding:          5px;
276      }
277  
278      .CellNoColor
279      {
280        text-align:     left;
281        vertical-align: top;
282      }   
283      
284      .DefineCell
285      {
286        background-color: rgb(179, 179, 179);
287        text-align:       left;
288      }
289      
290      .DefaultCell, .DefaultCellBold
291      {
292        background-color: rgb(229, 229, 229);
293        text-align:       left;
294      }
295      
296      .DefaultCellBold
297      {
298        font-weight:      bold;
299      }
300        
301      .NumberCell
302      {
303        background-color: rgb(229, 229, 229);
304        text-align:       center;
305        min-width:        50px;
306      }
307      
308      .NumberCellNegativeResult
309      {
310        background-color: rgb(240, 0, 0);
311        text-align:       center;
312        min-width:        50px;
313      }
314      
315      .NumberCellPositiveResult
316      {
317        background-color: rgb(25, 165, 88);
318        text-align:       center;
319        min-width:        50px;
320      }
321      
322      .NumberCellNoneResult
323      {
324        background-color: rgb(105, 105, 105);
325        text-align:       center;
326        min-width:        50px;
327      }
328      
329      .NumberCellInconclusiveResult
330      {
331        background-color: rgb(255, 165, 0);
332        text-align:       center;
333        min-width:        50px;
334      }
335      
336      .NumberCellErrorResult
337      {
338        background-color: rgb(205, 0, 0);
339        text-align:       center;
340        min-width:        50px;
341      }
342      
343      .NumberCellNoColor
344      {        
345        text-align: center;
346      }
347      
348      .PositiveResultCell
349      {
350        background-color: rgb(25, 165, 88);
351      }
352    
353      .NegativeResultCell
354      {
355        background-color: rgb(240, 0, 0);
356      }
357      
358      .NoneResultCell
359      {
360        background-color: rgb(105, 105, 105);
361      }
362      
363      .InconclusiveResultCell
364      {
365        background-color: rgb(255, 165, 0);
366      }
367      
368      .ErrorResultCell
369      {
370        background-color: rgb(205, 0, 0);
371        white-space:        nowrap;
372      }
373
374      .WarningCell
375      {
376        background-color: rgb(255, 255, 0);
377      }
378
379      .TestcaseHeadingDefaultResult
380      {
381        background-color: rgb(179, 179, 179);
382      }
383      .TestcaseHeadingPositiveResult
384      {
385        background-color: rgb(25, 165, 88);
386      }      
387      .TestcaseHeadingNegativeResult
388      {
389        background-color: rgb(240, 0, 0);
390      }      
391      .TestcaseHeadingNoneResult
392      {
393        background-color: rgb(105, 105, 105);
394      }
395      .TestcaseHeadingInconclusiveResult
396      {
397        background-color: rgb(255, 165, 0);
398      }
399      .TestcaseHeadingErrorResult
400      {
401        background-color: rgb(205, 0, 0);
402      }
403      
404      .PatternSeparator
405      {
406        height: 0.2em;
407      }
408      
409      .NegativeResult
410      {
411        background-color: rgb(240, 0, 0);
412        text-align:       center;
413        font-weight:      bold;
414      }
415      .PositiveResult
416      {
417        background-color: rgb(25, 165, 88);
418        text-align:       center;
419        font-weight:      bold;
420      }
421      .NoneResult
422      {
423        background-color: rgb(105, 105, 105);
424        text-align:       center;
425        font-weight:      bold;
426      }
427      .InconclusiveResult
428      {
429        background-color: rgb(255, 165, 0);
430        text-align:       center;
431        font-weight:      bold;
432      }
433      .ErrorResult
434      {
435        background-color: rgb(205, 0, 0);
436        text-align:       center;
437        font-weight:      bold;
438      }
439      
440      
441      
442      .Heading1
443      {
444        font-family: arial, sans-serif;
445        font-weight: bold;
446        font-size:   26px;
447      }
448      
449      .Heading2
450      {
451        font-family: arial, sans-serif;
452        font-weight: bold;
453        font-size:   20px;
454      }
455      
456      .Heading3
457      {
458        font-family:   arial, sans-serif;
459        font-weight:   bold;
460        font-size:     18px;
461        margin-bottom: 20px;
462        margin-top:    20px;
463      }
464      
465      .Heading4
466      {
467        font-family:   arial, sans-serif;
468        font-weight:   bold;
469        font-size:     16px;
470        margin-top:    10px;
471        margin-bottom: 10px;
472      }
473      
474      
475      img
476      {
477        Margin-bottom: 10px;
478        Margin-right:  10px;
479      }
480      
481      
482      p
483      {
484        Margin-bottom: 20px;
485      }
486      
487      
488      .DefaultTableBackground
489      {
490        background-color: rgb(229, 229, 229);
491        border-spacing:   0px;
492        padding:          0px;
493      }
494      
495      .NegativeResultBackground
496      {
497        background-color: rgb(240, 0, 0);
498        border-spacing:   0px;
499        padding:          0px;
500      }
501      
502      .PositiveResultBackground
503      {
504        background-color: rgb(25, 165, 88);
505        border-spacing:   0px;
506        padding:          0px;
507      }
508      
509      .WarningResultBackground
510      {
511        background-color: rgb(255, 255, 0);
512        border-spacing:   0px;
513        padding:          0px;
514      }
515      
516      .NoneResultBackground
517      {
518        background-color: rgb(105, 105, 105);
519        border-spacing:   0px;
520        padding:          0px;
521      }
522      
523      .InconclusiveResultBackground
524      {
525        background-color: rgb(255, 165, 0);
526        border-spacing:   0px;
527        padding:          0px;
528      }
529      
530      .ErrorResultBackground
531      {
532        background-color: rgb(205, 0, 0);
533        border-spacing:   0px;
534        padding:          0px;
535      }
536      
537      .TestGroupHeadingBackground
538      {
539        background-color: rgb(179, 179, 179);
540      }
541    
542      
543      .Indentation
544      {
545        margin-left:  20px;
546      }
547    </style>
548    <script type="text/javascript">
549      var EXPANDED = '[−]';
550      var COLLAPSED = '[+]';
551      var VISIBLE = 'Visible';
552      var HIDDEN = 'Hidden';
553      var NONE = 'none';
554      var BLOCK = '';
555      function getDivId(id) { return 'div_' + id; }
556      function getLinkId(id) { return 'lnk_' + id; }
557      function getTableId(id) { return 'tbl_' + id; }
558      function getTbl2Id(id) { return 'tbl_t' + id; }
559      
560      
561      function switchText(oldText) { return oldText == COLLAPSED ? EXPANDED : COLLAPSED ; }
562      function getStyleFromText(linkText) { return linkText == COLLAPSED ? HIDDEN : VISIBLE; }
563      
564      function getElements(tagName, elementId)
565      {
566        this.elements = [];
567        var index = 0;
568        var elm = document.getElementsByTagName(tagName);
569        var len = elm.length;
570        for (var i = 0; i < len; i++) 
571        {
572          var id = elm[i].id;
573          if (id && id.indexOf(elementId) == 0)
574          {
575            this.elements[index] = elm[i];
576            index++;
577          }
578        }
579        return this.elements;
580      }
581      function matchElements(tagName, matchId)
582      {
583        this.elements = [];
584        var index = 0;
585        var elm = document.getElementsByTagName(tagName);
586        for (var i = 0; i < elm.length; i++) 
587        {
588          var id = elm[i].id;
589          var tc = id.replace(/s[0-9]+\./, "");
590          if (tc && tc == matchId)
591          {
592            this.elements[index] = elm[i];
593            index++;
594          }
595        }
596        return this.elements;  
597      }
598      function onoff(elm, style)
599      {
600        if(elm.style.display == NONE)
601        {
602          if(style == null || style == VISIBLE)
603            elm.style.display = BLOCK;
604        }
605        else
606        {
607          if(style == null || style == HIDDEN)
608            elm.style.display = NONE;
609        }
610      }
611      function switchTagStyle(tag, id, style)
612      {
613        var divs = getElements(tag, id);
614        for(var i = 0; i < divs.length; i++)
615          onoff(divs[i], style);
616      }
617      function switchRowStyle(tbl, style)
618      {
619        var rows = tbl.rows.length;
620        for(var rowIndex=0; rowIndex < rows; rowIndex++)
621        {
622          var row = tbl.rows[rowIndex];
623          if (row.id != "on")
624            onoff(row, style);
625        }
626      }
627      function switchTableRowStyle(tableId, style)
628      {
629        var tables = getElements('table', tableId);
630        for(var i = 0; i < tables.length; i++)
631          switchRowStyle(tables[i], style);
632      }
633      function switchLinkText(linkId, newText)
634      {
635        var link = getElements('a', linkId);
636        var len = link.length;
637        for(var i = 0; i < len; i++)
638        {
639          var lnk = link[i];
640          if(newText == null)
641          {
642            var oldText = lnk.text;
643            newText = switchText(oldText)
644          }
645          lnk.text = newText;
646        }
647      }
648      function switchTag(tag, id, text)
649      {
650        var style = getStyleFromText(text);
651        switchTagStyle(tag, id, style);
652      }
653      function switchTable(id)
654      {
655        switchLinkText(getTableId(id));
656        switchTableRowStyle(getTableId(id));
657      }
658      function switchDiv(id, linkText)
659      {
660        var text = switchText(linkText);
661        switchLinkText(getLinkId(id), text);
662        switchTag('div', getDivId(id), text);
663      }      
664      function switchAll(id, linkText)
665      {
666        var text = switchText(linkText);
667        switchLinkText(getLinkId(id), text);
668        switchTag('div', getDivId(id), text);
669        var style = getStyleFromText(text);
670        switchTableRowStyle(getTbl2Id(id), style);
671      }
672      function showTable(id)
673      {
674        var tableId = getTableId(id);
675        switchLinkText(tableId, EXPANDED);
676        switchTableRowStyle(tableId, VISIBLE);
677      }
678      function hideTable(id)
679      {
680        var tableId = getTableId(id);
681        switchTableRowStyle(tableId, HIDDEN);
682        switchLinkText(tableId, COLLAPSED);
683      }
684      function showDiv(id)
685      {
686        switchLinkText(getLinkId(id), EXPANDED);
687        switchTag('div', getDivId(id), EXPANDED);
688      }
689      function showTC(id)
690      {
691        var divId = getDivId(id);
692        var elms = matchElements('div', divId); 
693        if(elms != null && elms.length > 0)
694        {
695          id = elms[0].id.replace(getDivId(''), '');
696          showDiv(id);
697        }
698      }
699      
700    </script>
701  </head>
702  <body>
703    <a name="TOP"></a>
704    <table class="HeadingTable">
705      <tr>
706        <td>
707          <big class="Heading1">Report: TestCaseManager</big>
708        </td>
709      </tr>
710    </table>
711    <center>
712      <table class="OverallResultTable">
713        <tr>
714          {% if stats.failed %}
715            <td class="NegativeResult">Test failed</td>
716          {% else %}
717            <td class="PositiveResult">Test passed</td>
718          {% endif %}
719        </tr>
720      </table>
721    </center>
722    <a name="TestOverview"></a>
723    <table class="SubHeadingTable">
724      <tr>
725        <td>
726          <div class="Heading2">Test Overview</div>
727        </td>
728      </tr>
729    </table>
730    <div class="Indentation">
731      <div class="Heading4">Statistics</div>
732      <div class="Indentation">
733        <table class="OverviewTable">
734          <tr>
735            <td class="DefineCell">Overall number of test cases </td>
736            <td class="NumberCell" width="60">{{stats.number_tests}}</td>
737            <td class="DefaultCell"></td>
738          </tr>
739          <tr>
740            <td class="DefineCell">Test cases passed </td>
741            {% if stats.failed %}
742              <td class="NumberCell">{{stats.number_passed}}</td>
743              <td class="NumberCell">{{stats.percentage_passed}}% of executed test cases</td>
744            {% else %}
745              <td class="NumberCellPositiveResult">{{stats.number_passed}}</td>
746              <td class="NumberCellPositiveResult">{{stats.percentage_passed|round(1)}}% of executed test cases</td>
747            {% endif %}
748          </tr>
749          <tr>
750            <td class="DefineCell">Test cases failed </td>
751            {% if stats.failed %}
752              <td class="NumberCellNegativeResult">{{stats.number_failed}}</td>
753              <td class="NumberCellNegativeResult">{{stats.percentage_failed|round(1)}}% of executed test cases</td>
754            {% else %}
755              <td class="NumberCell">{{stats.number_failed}}</td>
756              <td class="NumberCell">{{stats.percentage_failed}}% of executed test cases</td>
757            {% endif %}
758          </tr>
759        </table>
760      </div>
761      <div class="Heading4">Test Case Results</div>
762      <div class="Indentation">
763        <table class="OverviewTable">
764          {% for category in data %}
765          <tr>
766            <td class="DefineCell">{{loop.index}}</td>
767            <td class="DefaultCell"></td>
768            <td class="DefaultCell">
769              <a href="#i__{{loop.index}}">{{category.name}}</a>
770            </td>
771            
772            {% if category.failed %}
773              <td class="NegativeResultCell">fail</td>
774            {% else %}
775              <td class="PositiveResultCell">pass</td>
776            {% endif %}
777
778          </tr>
779          {% endfor %}
780        </table>
781      </div>
782    </div>
783    <table class="SubHeadingTable">
784      <tr>
785        <td>
786          <big class="Heading2">Test Case Details</big>
787        </td>
788      </tr>
789    </table>
790    
791    {% for category in data %}
792    
793    <table>
794      <tr>
795        <td class="LinkCell">
796          <a class="Undecorated" id="lnk_{{loop.index}}" href="javascript:switchAll('{{loop.index}}',document.all['lnk_{{loop.index}}'].text)">[−]</a>
797        </td>
798        {% if category.failed %}
799          <td class="TestcaseHeadingNegativeResult">
800            <big class="Heading3">{{loop.index}} <a name="i__{{loop.index}}">{{category.name}}</a>: Failed</big>
801          </td>
802        {% else %}
803          <td class="TestcaseHeadingPositiveResult">
804            <big class="Heading3">{{loop.index}} <a name="i__{{loop.index}}">{{category.name}}</a>: Passed</big>
805          </td>
806        {% endif %}
807      </tr>
808    </table>
809    <div class="Indentation" id="div_{{loop.index}}">
810      <div class="Indentation">
811        <table class="ResultTable">
812          <tr>
813            <th class="TableHeadingCell" width="1px">Timestamp</th>
814            <th class="TableHeadingCell" width="1px">Result</th>
815            <th class="TableHeadingCell" width="auto">Description</th>
816          </tr>
817          <tr>
818            <td class="PatternSeparator" colspan="3"></td>
819          </tr>
820          
821          {% for test in category.tests %}
822          
823            {% if test.failed %}
824              <tr class="NegativeResultBackground">
825                <td style="text-indent: 20px;" class="ResultBlockHeading" colspan="3">
826                  <big class="Heading4">Test {{loop.index}} - {{test.description}}: Failed</big>
827            {% else %}
828              <tr class="PositiveResultBackground">
829                <td style="text-indent: 20px;" class="ResultBlockHeading" colspan="3">
830                  <big class="Heading4">Test {{loop.index}} - {{test.description}}: Passed</big>
831            {% endif %}
832              </td>
833            </tr>
834            
835            {% for log in test.logs %}
836              <tr>
837                <td style="text-indent: 20px;" class="DefineCell"> {{log.timestamp}}</td>
838                {% if log.log_type == "FAIL" %}
839                  <td class="NegativeResultCell">fail</td>
840                {% elif log.log_type == "SUCCESS" %}
841                  <td class="PositiveResultCell">pass</td>
842                {% else %}
843                  <td class="DefaultCell">info</td>
844                {% endif %}
845                <td class="DefaultCell">{{log.fail_message}}</td>
846              </tr>
847            {% endfor %}
848            
849            <tr>
850              <td class="PatternSeparator" colspan="3"></td>
851            </tr>
852          
853          {% endfor %}
854
855          
856          <tr>
857            <td class="PatternSeparator" colspan="3"></td>
858          </tr>
859        </table>
860      </div>
861    </div>
862    
863    {% endfor %}
864
865    <table class="SubHeadingTable">
866      <tr>
867        <td>
868          <div class="Heading2">End of Report</div>
869        </td>
870      </tr>
871    </table>
872  </body>
873</html>
874