-
Notifications
You must be signed in to change notification settings - Fork 171
/
report_template.html
162 lines (161 loc) · 9.32 KB
/
report_template.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2 class="text-capitalize">{{ title }}</h2>
<p class='attribute'><strong>Start Time: </strong>{{ header_info.start_time.strftime("%Y-%m-%d %H:%M:%S") }}</p>
<p class='attribute'><strong>Duration: </strong>{{ header_info.status.duration }}</p>
<p class='attribute'><strong>Summary: </strong>Total: {{ header_info.status.total }}, Pass: {{ header_info.status.success }}{% if header_info.status.failure %}, Fail: {{ header_info.status.failure }}{% endif %}{% if header_info.status.error %}, Error: {{ header_info.status.error }}{% endif %}{% if header_info.status.skip %}, Skip: {{ header_info.status.skip }}{% endif %}</p>
</div>
</div>
{%- for test_case_name, tests_results in all_results.items() %}
{%- if tests_results %}
<div class="row">
<div class="col-xs-12 col-sm-10 col-md-10">
<table class='table table-hover table-responsive'>
<thead>
<tr>
<th>{{ test_case_name }}</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
{%- for test_case in tests_results %}
{%- if not test_case.subtests is defined %}
<tr class='{{ status_tags[test_case.outcome] }}'>
<td class="col-xs-10">{{ test_case.test_id.split(".")[-1] }}</td>
<td class="col-xs-1">
<span class="label label-{{ status_tags[test_case.outcome] }}" style="display:block;width:40px;">
{%- if test_case.outcome == test_case.SUCCESS -%}
Pass
{%- elif test_case.outcome == test_case.SKIP -%}
Skip
{%- elif test_case.outcome == test_case.FAILURE -%}
Fail
{%- else -%}
Error
{%- endif -%}
</span>
</td>
<td class="col-xs-1">
{%- if (test_case.stdout or test_case.err) %}
<button class="btn btn-default btn-xs">View</button>
{%- endif %}
</td>
</tr>
{%- if (test_case.stdout or test_case.err or test_case.err) and test_case.outcome != test_case.SKIP %}
<tr style="display:none;">
<td class="col-xs-9" colspan="3">
{%- if test_case.stdout %}<p>{{ test_case.stdout }}</p>{% endif %}
{%- if test_case.err %}<p style="color:maroon;">{{ test_case.err[0].__name__ }}: {{ test_case.err[1] }}</p>{% endif %}
{%- if test_case.err %}<p style="color:maroon;">{{ test_case.test_exception_info }}</p>{% endif %}
</td>
</tr>
{%- endif %}
{%- if (test_case.stdout or test_case.err or test_case.err) and test_case.outcome == test_case.SKIP %}
<tr style="display:none;">
<td class="col-xs-9" colspan="3">
{%- if test_case.stdout %}<p>{{ test_case.stdout }}</p>{% endif %}
{%- if test_case.err %}<p style="color:maroon;">{{ test_case.err }}</p>{% endif %}
</td>
</tr>
{%- endif %}
{%- else %}
<tr class='{{ status_tags[test_case.outcome] }}'>
<td class="col-xs-10">{{ test_case.test_id.split(".")[-1] }}</td>
<td class="col-xs-1">
<span class="label label-{{ status_tags[test_case.outcome] }}" style="display:block;width:40px;">
{%- if test_case.outcome == test_case.SUCCESS -%}
Pass
{%- else -%}
Fail
{%- endif -%}
</span>
</td>
<td class="col-xs-1">
{%- if test_case.subtests %}
<button class="btn btn-default btn-xs">View</button>
{%- endif %}
</td>
</tr>
{%- if test_case.subtests %}
<tr style="display:none;">
<td colspan="3">
<table class='table table-hover table-responsive'>
<tbody>
{%- for subtest in test_case.subtests %}
<tr class='{{ status_tags[subtest.outcome] }}'>
<td class="col-xs-10">{{ subtest.test_id.split(".")[-1] }}</td>
<td class="col-xs-1">
<span class="label label-{{ status_tags[subtest.outcome] }}" style="display:block;width:40px;">
{%- if subtest.outcome == subtest.SUCCESS -%}
Pass
{%- else -%}
Fail
{%- endif -%}
</span>
</td>
<td class="col-xs-1">
{%- if subtest.err %}
<button class="btn btn-default btn-xs">View</button>
{%- endif %}
</td>
</tr>
{%- if subtest.err or subtest.err %}
<tr style="display:none;">
<td class="col-xs-9" colspan="3">
{%- if subtest.err %}<p style="color:maroon;">{{ subtest.err[0].__name__ }}: {{ subtest.err[1] }}</p>{% endif %}
{%- if subtest.err %}<p style="color:maroon;">{{ subtest.test_exception_info }}</p>{% endif %}
</td>
</tr>
{%- endif %}
{% endfor %}
</tbody>
</table>
</td>
</tr>
{%- endif %}
{%- endif %}
{%- endfor %}
<tr>
<td colspan="3">
Total: {{ summaries[test_case_name].total }}, Pass: {{ summaries[test_case_name].success }}{% if summaries[test_case_name].failure %}, Fail: {{ summaries[test_case_name].failure }}{% endif %}{% if summaries[test_case_name].error %}, Error: {{ summaries[test_case_name].error }}{% endif %}{% if summaries[test_case_name].skip %}, Skip: {{ summaries[test_case_name].skip }}{% endif %} -- Duration: {{ summaries[test_case_name].duration }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
{%- endif %}
{%- endfor %}
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('td').on('click', '.btn', function(e){
e.preventDefault();
e.stopImmediatePropagation();
var $this = $(this);
var $nextRow = $this.closest('tr').next('tr');
$nextRow.slideToggle("fast");
$this.text(function(i, text){
if (text === 'View') {
return 'Hide';
} else {
return 'View';
};
});
});
});
</script>
</body>
</html