awetestlib 0.1.22-x86-mingw32 → 0.1.23-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/.yardopts ADDED
@@ -0,0 +1,7 @@
1
+ --hide-void-return
2
+ --verbose
3
+ --exclude version.rb
4
+ --exclude html_report.rb
5
+ --no-private
6
+ --title "Awetest DSL"
7
+ lib/**/*.rb
@@ -1,6 +1,9 @@
1
1
  module Awetestlib
2
+ # Report generator for Awetestlib.
2
3
  class HtmlReport
4
+
3
5
  # Initialize the report class
6
+ # @private
4
7
  def initialize(report_name)
5
8
  @reportname = report_name
6
9
  @reportContent1 = ''
@@ -8,53 +11,15 @@ module Awetestlib
8
11
  end
9
12
 
10
13
  # Create a report
14
+ # @private
11
15
  def create_report(reportName)
12
16
  # Get current time
13
17
  t = Time.now
14
- # Format the day
15
- if(t.day.to_s.length == 1)
16
- strDay = '0' + t.day.to_s
17
- else
18
- strDay = t.day.to_s
19
- end
20
-
21
- # Format the month
22
- if(t.month.to_s.length == 1)
23
- strMonth = '0' + t.month.to_s
24
- else
25
- strMonth = t.month.to_s
26
- end
27
-
28
- # Format the year
29
- strYear = t.year.to_s
30
-
31
- # Format the hour
32
- if(t.hour.to_s.length == 1)
33
- strHour = '0' + t.hour.to_s
34
- else
35
- strHour = t.hour.to_s
36
- end
37
-
38
- # Format the minutes
39
- if(t.min.to_s.length == 1)
40
- strMinutes = '0' + t.min.to_s
41
- else
42
- strMinutes = t.min.to_s
43
- end
44
-
45
- # Format the seconds
46
- if(t.sec.to_s.length == 1)
47
- strSeconds = '0' + t.sec.to_s
48
- elsif (t.sec.to_s.length == 0)
49
- strSeconds = '00'
50
- else
51
- strSeconds = t.sec.to_s
52
- end
53
18
 
54
19
  # Create the report name
55
- strTime = '_' + strMonth + strDay + strYear + '_' + strHour + strMinutes + strSeconds + '.html'
56
- strNiceTime = strDay + '-' + strMonth + '-' + strYear + ' @ ' + strHour + ':' + strMinutes + ':' + strSeconds
57
- strTotalReport = reportName + strTime
20
+ strTime = "#{t.strftime("%Y%m%d_%H%M%S")}"
21
+ strNiceTime = "#{t.strftime("%m/%d/%Y @ %H:%M:%S")}"
22
+ strTotalReport = "#{reportName}_#{strTime}.html"
58
23
 
59
24
  # Create the HTML report
60
25
  strFile = File.open(strTotalReport, 'w')
@@ -135,7 +100,9 @@ module Awetestlib
135
100
  return strTotalReport
136
101
  end
137
102
 
138
- def add_to_report(step, result)
103
+ # Add a row to the report
104
+ # @private
105
+ def add_to_report(step, result, level = 1)
139
106
  # Format the body of the HTML report
140
107
  if (result == 'PASSED')
141
108
  @reportContent2 = @reportContent2 + '<tr><td class=border_left width=80%><p class=normal_text>' + step + '</p></td>'
@@ -143,13 +110,17 @@ module Awetestlib
143
110
  elsif (result == 'FAILED')
144
111
  @reportContent2 = @reportContent2 + '<tr><td class=border_left width=80%><p class=normal_text>' + step + '</p></td>'
145
112
  @reportContent2 = @reportContent2 + '<td class=border_right width=20%><p class=result_nok>' + result + '</p></td>'
113
+ elsif level < 1
114
+ @reportContent2 = @reportContent2 + '<tr><td class=border_left width=80%><p class=normal_text>' + step + '</p></td>'
115
+ @reportContent2 = @reportContent2 + '<td class=border_right width=20%><p class=result_nok>' + result + '</p></td>'
146
116
  else
147
117
  @reportContent2 = @reportContent2 + '<tr><td class=mark_testlevel_left width=80%><p class=bold_large_text>' + step + '</p></td>'
148
118
  @reportContent2 = @reportContent2 + '<td class=mark_testlevel_right width=20%><p class=result_nok>' + result + '</p></td>'
149
119
  end
150
-
151
120
  end
152
121
 
122
+ # Close the report HTML
123
+ # @private
153
124
  def finish_report(reportName)
154
125
  # Open the HTML report
155
126
  strFile = File.open(reportName, 'a')