File tree 3 files changed +69
-1
lines changed
testcases/static/testcases/js
3 files changed +69
-1
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,22 @@ def test_case_health(query=None):
226
226
return data
227
227
228
228
229
+ @http_basic_auth_login_required
230
+ @rpc_method (name = "Testing.individual_test_case_health" )
231
+ def individual_test_case_health_simple (query = None ):
232
+
233
+ if query is None :
234
+ query = {}
235
+
236
+ res = (
237
+ TestExecution .objects .filter (** query )
238
+ .values ("run__plan" , "case_id" , "status__name" , "status__weight" )
239
+ .order_by ("case" , "run__plan" , "status__weight" )
240
+ )
241
+
242
+ return list (res )
243
+
244
+
229
245
def _remove_all_excellent_executions (data ):
230
246
for key in dict .fromkeys (data ):
231
247
if data [key ]["count" ]["fail" ] == 0 :
Original file line number Diff line number Diff line change @@ -23,10 +23,24 @@ <h2 class="card-pf-title">
23
23
</ div >
24
24
25
25
< div class ="list-view-pf-body ">
26
- < div class ="list-view-pf-description ">
26
+ < div class ="list-view-pf-description " style =" display: flex; justify-content: space-between; " >
27
27
< div class ="list-group-item-text ">
28
28
< a href ="{% url 'test_plan_url_short' execution.run.plan.pk %} "> TP-{{ execution.run.plan.pk }}: {{ execution.run.plan.name }}</ a >
29
29
</ div >
30
+ < div class ="list-group-item-text ">
31
+ < div class ="completion-rate-container "> {% trans 'Completion rate' %}: < span class ="completion-rate "> </ span >
32
+ < div class ="progress ">
33
+ < div class ="progress-bar progress-bar-danger " role ="progressbar "> </ div >
34
+ < div class ="progress-bar progress-bar-success " role ="progressbar "> </ div >
35
+ </ div >
36
+ </ div >
37
+ < div class ="failure-rate-container "> {% trans 'Failure rate' %}:< span class ="failure-rate "> </ span >
38
+ < div class ="progress ">
39
+ < div class ="progress-bar progress-bar-danger " role ="progressbar "> </ div >
40
+ < div class ="progress-bar progress-bar-success " role ="progressbar "> </ div >
41
+ </ div >
42
+ </ div >
43
+ </ div >
30
44
</ div >
31
45
</ div >
32
46
</ div > <!-- /main info -->
Original file line number Diff line number Diff line change @@ -210,6 +210,44 @@ $(document).ready(function () {
210
210
} )
211
211
} )
212
212
213
+ jsonRPC ( 'Testing.individual_test_case_health' , { case_id : case_id } , ress => {
214
+ const res = { }
215
+ let planId = 0
216
+ ress . forEach ( r => {
217
+ let positive = 0
218
+ let negative = 0
219
+ let allCount = 0
220
+ if ( r . status__weight > 0 ) {
221
+ positive ++
222
+ } else if ( r . status__weight < 0 ) {
223
+ negative ++
224
+ }
225
+ allCount ++
226
+
227
+ if ( r . run__plan !== planId ) {
228
+ planId = r . run__plan
229
+ res [ planId ] = {
230
+ completion_rate : allCount > 0 ? ( ( positive + negative ) / allCount ) : 0 ,
231
+ failure_rate : allCount > 0 ? ( negative / allCount ) : 0
232
+ }
233
+ positive = 0
234
+ negative = 0
235
+ allCount = 0
236
+ }
237
+ } )
238
+
239
+ Object . entries ( res ) . forEach ( ( [ runId , data ] ) => {
240
+ const executionRow = $ ( `#execution-for-plan-${ runId } ` )
241
+ executionRow . find ( '.completion-rate' ) . html ( data . completion_rate )
242
+ executionRow . find ( '.completion-rate-container .progress-bar-danger' ) . css ( 'width' , `${ ( 1 - data . completion_rate ) * 100 } %` )
243
+ executionRow . find ( '.completion-rate-container .progress-bar-success' ) . css ( 'width' , `${ ( data . completion_rate ) * 100 } %` )
244
+
245
+ executionRow . find ( '.failure-rate' ) . html ( data . failure_rate )
246
+ executionRow . find ( '.failure-rate-container .progress-bar-danger' ) . css ( 'width' , `${ ( data . failure_rate ) * 100 } %` )
247
+ executionRow . find ( '.failure-rate-container .progress-bar-success' ) . css ( 'width' , `${ ( 1 - data . failure_rate ) * 100 } %` )
248
+ } )
249
+ } )
250
+
213
251
// bind add TP to TC widget
214
252
initAddPlan ( case_id , plans_table )
215
253
You can’t perform that action at this time.
0 commit comments