forked from ecukes/ecukes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecukes-stats.el
74 lines (56 loc) · 1.98 KB
/
ecukes-stats.el
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
;;; ecukes-stats.el --- Statistics about the passed and failed scenarios and steps
(require 'ansi)
(require 's)
(defvar ecukes-stats-steps 0
"Number of steps that have be runned.")
(defvar ecukes-stats-steps-passed 0
"Number of steps that have passed.")
(defvar ecukes-stats-steps-failed 0
"Number of steps that have failed.")
(defvar ecukes-stats-steps-skipped 0
"Number of steps that were skipped.")
(defvar ecukes-stats-scenarios 0
"Number of scenarios that have been runned.")
(defvar ecukes-stats-scenarios-passed 0
"Number of scenarios that have passed.")
(defvar ecukes-stats-scenarios-failed 0
"Number of scenarios that have failed.")
(defun ecukes-stats-reset ()
"Reset stats."
(setq ecukes-stats-steps 0)
(setq ecukes-stats-steps-passed 0)
(setq ecukes-stats-steps-failed 0)
(setq ecukes-stats-steps-skipped 0)
(setq ecukes-stats-scenarios 0)
(setq ecukes-stats-scenarios-passed 0)
(setq ecukes-stats-scenarios-failed 0))
(defmacro ecukes-stats-step (&rest body)
`(progn
(setq ecukes-stats-steps (1+ ecukes-stats-steps))
,@body))
(defmacro ecukes-stats-scenario (&rest body)
`(progn
(setq ecukes-stats-scenarios (1+ ecukes-stats-scenarios))
,@body))
(defun ecukes-stats-step-pass ()
"Step passed."
(ecukes-stats-step
(setq ecukes-stats-steps-passed (1+ ecukes-stats-steps-passed))))
(defun ecukes-stats-step-fail ()
"Step failed."
(ecukes-stats-step
(setq ecukes-stats-steps-failed (1+ ecukes-stats-steps-failed))))
(defun ecukes-stats-step-skip ()
"Step skipped."
(ecukes-stats-step
(setq ecukes-stats-steps-skipped (1+ ecukes-stats-steps-skipped))))
(defun ecukes-stats-scenario-pass ()
"Scenario passed."
(ecukes-stats-scenario
(setq ecukes-stats-scenarios-passed (1+ ecukes-stats-scenarios-passed))))
(defun ecukes-stats-scenario-fail ()
"Scenario failed."
(ecukes-stats-scenario
(setq ecukes-stats-scenarios-failed (1+ ecukes-stats-scenarios-failed))))
(provide 'ecukes-stats)
;;; ecukes-stats.el ends here