Megatest

Check-in [fcb61c8998]
Login
Overview
Comment:Tweaked test steps reporting in dashboard
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fcb61c8998575b2fefb6ecc7bc7450b81b376cd7
User & Date: matt on 2011-08-24 12:33:41
Other Links: manifest | tags
Context
2011-08-24
12:50
Merged rollup-runs branch into trunk check-in: ebea00e4bb user: mrwellan tags: trunk
12:33
Tweaked test steps reporting in dashboard check-in: fcb61c8998 user: matt tags: trunk
2011-08-11
01:45
Merged in rollup runs to trunk. Actual rollup of runs not completed yet check-in: d7ffcddcac user: matt tags: trunk, v1.20
Changes

Modified dashboard-tests.scm from [8ad286d847] to [46082f722f].

327
328
329
330
331
332
333
334






















335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
		#:title "Test Steps"
		(let ((stepsdat (iup:label "Test steps ........................................." 
					   #:expand "YES" 
					   #:size "200x150"
					   #:alignment "ALEFT:ATOP")))
		  (hash-table-set! widgets "Test Steps" (lambda (testdat)
							  (let* ((currval (iup:attribute stepsdat "TITLE"))
								 (fmtstr  "~15a~8a~8a~20a")






















								 (newval  (string-intersperse 
									   (append
									    (list 
									     (format #f fmtstr "Stepname" "State" "Status" "Event Time")
									     (format #f fmtstr "========" "=====" "======" "=========="))
									    (map (lambda (x)
										   ;; take advantage of the \n on time->string
										   (format #f fmtstr
											   (db:step-get-stepname x)
											   (db:step-get-state    x)
											   (db:step-get-status   x)
											   (time->string 
											    (seconds->local-time 
											     (db:step-get-event_time x)))))
										 (db:get-steps-for-test db test-id)))
									   "\n")))
							  (if (not (equal? currval newval))
								(iup:attribute-set! stepsdat "TITLE" newval)))))
		  stepsdat)))))
      (iup:show self)
      (iup:callback-set! *tim* "ACTION_CB"
			 (lambda (x)
			   ;; Now start keeping the gui updated from the db
			   (refreshdat) ;; update from the db here







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



|
|



|
|
|
|
|
|
|

|







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
		#:title "Test Steps"
		(let ((stepsdat (iup:label "Test steps ........................................." 
					   #:expand "YES" 
					   #:size "200x150"
					   #:alignment "ALEFT:ATOP")))
		  (hash-table-set! widgets "Test Steps" (lambda (testdat)
							  (let* ((currval (iup:attribute stepsdat "TITLE"))
								 (fmtstr  "~15a~8a~8a~8a~20a")
								 (steps   (db:get-steps-for-test db test-id))
								 ;; organise the steps for better readability
								 (comprsteps (let ((res (make-hash-table)))
									       (for-each 
										(lambda (step)
										  (let ((record (hash-table-ref/default 
												 res 
												 (db:step-get-stepname step) 
												 ;;        stepname                 start end status
												 (vector (db:step-get-stepname step) "" "" "" ""))))
										    (case (string->symbol (db:step-get-state step))
										      ((start)(vector-set! record 1 (db:step-get-event_time step))
										              (vector-set! record 3 (db:step-get-status step)))
										      ((end)  (vector-set! record 2 (db:step-get-event_time step))
										              (vector-set! record 3 (db:step-get-status step)))
										      (else   (vector-set! record 1 (db:step-get-event_time step)))
											      (vector-set! record 2 (db:step-get-state step))
											      (vector-set! record 3 (db:step-get-status step))
											      (vector-set! record 4 (db:step-get-event_time step)))
										    (hash-table-set! res (db:step-get-stepname step) record)))
										steps)
									       res))
								 (newval  (string-intersperse 
									   (append
									    (list 
									     (format #f fmtstr "Stepname" "Start" "End"    "Status" "Time")
									     (format #f fmtstr "========" "=====" "======" "======" "=========="))
									    (map (lambda (x)
										   ;; take advantage of the \n on time->string
										   (format #f fmtstr
											   (vector-ref x 0)
											   (seconds->time-string (vector-ref x 1))
											   (vector-ref x 2)
											   (vector-ref x 3)
											   (vector-ref x 4)))
										 (sort (hash-table-values comprsteps)
										       (lambda (a b)(< (vector-ref 1 a)(vector-ref 1 b))))))
									   "\n")))
							    (if (not (equal? currval newval))
								(iup:attribute-set! stepsdat "TITLE" newval)))))
		  stepsdat)))))
      (iup:show self)
      (iup:callback-set! *tim* "ACTION_CB"
			 (lambda (x)
			   ;; Now start keeping the gui updated from the db
			   (refreshdat) ;; update from the db here

Modified db.scm from [062b6c7a79] to [04b9f6fc1e].

411
412
413
414
415
416
417







418
419
420
421
422
423
424
(define-inline (db:step-get-event_time      vec)    (vector-ref  vec 5))
(define-inline (db:step-set-id!             vec val)(vector-set! vec 0 val))
(define-inline (db:step-set-test_id!        vec val)(vector-set! vec 1 val))
(define-inline (db:step-set-stepname!       vec val)(vector-set! vec 2 val))
(define-inline (db:step-set-state!          vec val)(vector-set! vec 3 val))
(define-inline (db:step-set-status!         vec val)(vector-set! vec 4 val))
(define-inline (db:step-set-event_time!     vec val)(vector-set! vec 5 val))








;; db-get-test-steps-for-run
(define (db:get-steps-for-test db test-id)
  (let ((res '()))
    (sqlite3:for-each-row 
     (lambda (id test-id stepname state status event-time)
       (set! res (cons (vector id test-id stepname state status event-time) res)))







>
>
>
>
>
>
>







411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
(define-inline (db:step-get-event_time      vec)    (vector-ref  vec 5))
(define-inline (db:step-set-id!             vec val)(vector-set! vec 0 val))
(define-inline (db:step-set-test_id!        vec val)(vector-set! vec 1 val))
(define-inline (db:step-set-stepname!       vec val)(vector-set! vec 2 val))
(define-inline (db:step-set-state!          vec val)(vector-set! vec 3 val))
(define-inline (db:step-set-status!         vec val)(vector-set! vec 4 val))
(define-inline (db:step-set-event_time!     vec val)(vector-set! vec 5 val))

(define (db:step-get-time-as-string vec)
    (seconds->time-string (db:step-get-event_time vec)))

(define (seconds->time-string sec)
  (time->string 
   (seconds->local-time sec)))

;; db-get-test-steps-for-run
(define (db:get-steps-for-test db test-id)
  (let ((res '()))
    (sqlite3:for-each-row 
     (lambda (id test-id stepname state status event-time)
       (set! res (cons (vector id test-id stepname state status event-time) res)))