testability-driver 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/tdriver/base/behaviour/factory.rb +82 -51
- data/lib/tdriver/base/sut/controller.rb +33 -24
- data/lib/tdriver/base/sut/factory.rb +24 -21
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +103 -34
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +56 -2
- data/lib/tdriver/base/sut/generic/commands/application.rb +248 -4
- data/lib/tdriver/base/sut/generic/plugin.rb +1 -1
- data/lib/tdriver/base/test_object/adapter.rb +67 -16
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +14 -4
- data/lib/tdriver/loader.rb +1 -3
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +6 -5
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +9 -1
- data/lib/tdriver/report/report.rb +3 -0
- data/lib/tdriver/report/report_api.rb +29 -23
- data/lib/tdriver/report/report_crash_file_capture.rb +2 -0
- data/lib/tdriver/report/report_creator.rb +74 -46
- data/lib/tdriver/report/report_test_case_run.rb +86 -68
- data/lib/tdriver/report/report_test_run.rb +46 -2
- data/lib/tdriver/report/report_writer.rb +35 -13
- data/lib/tdriver/tdriver.rb +3 -0
- data/lib/tdriver/util/plugin/service.rb +168 -76
- data/lib/tdriver/util/recorder/scripter.rb +76 -40
- data/lib/tdriver/version.rb +1 -1
- data/xml/templates/generic.xml +6 -1
- metadata +2 -2
@@ -94,6 +94,7 @@ module TDriverReportCreator
|
|
94
94
|
@fail_statuses=MobyUtil::Parameter[ :report_failed_statuses, "failed" ].split('|')
|
95
95
|
@not_run_statuses=MobyUtil::Parameter[ :report_not_run_statuses, "not run" ].split('|')
|
96
96
|
@report_editable=MobyUtil::Parameter[ :report_editable, "false" ]
|
97
|
+
@report_short_folders=MobyUtil::Parameter[ :report_short_folders, 'false']
|
97
98
|
end
|
98
99
|
#This method sets the test case user defined status
|
99
100
|
#
|
@@ -806,14 +807,23 @@ module TDriverReportCreator
|
|
806
807
|
link='',
|
807
808
|
total_dump=0,
|
808
809
|
total_sent=0,
|
809
|
-
total_received=0
|
810
|
+
total_received=0,
|
811
|
+
user_data_rows=nil,
|
812
|
+
user_data_columns=nil)
|
810
813
|
while $result_storage_in_use==true
|
811
814
|
sleep 1
|
812
815
|
end
|
813
816
|
$result_storage_in_use=true
|
814
817
|
begin
|
815
818
|
storage_file=nil
|
816
|
-
|
819
|
+
|
820
|
+
if @report_short_folders=='true'
|
821
|
+
html_link=status+'_'+index.to_s+'/index.html' if link==''
|
822
|
+
else
|
823
|
+
html_link=status+'_'+index.to_s+'_'+testcase+'/index.html' if link==''
|
824
|
+
end
|
825
|
+
|
826
|
+
|
817
827
|
storage_file='all_cases.xml'
|
818
828
|
|
819
829
|
file=@report_folder+'/'+storage_file
|
@@ -881,6 +891,23 @@ module TDriverReportCreator
|
|
881
891
|
test<<test_data
|
882
892
|
end
|
883
893
|
|
894
|
+
|
895
|
+
if user_data_rows!=nil && !user_data_columns.empty?
|
896
|
+
|
897
|
+
test_data = Nokogiri::XML::Node.new("user_table_data",test)
|
898
|
+
#create the table rows
|
899
|
+
user_data_rows.each do |row_hash|
|
900
|
+
row_hash.sort{|a,b| a[0]<=>b[0]}.each do |value|
|
901
|
+
data_value=Nokogiri::XML::Node.new("column",test_data)
|
902
|
+
data_value.set_attribute("name",value[0].to_s)
|
903
|
+
data_value.content = value[1].to_s
|
904
|
+
test_data << data_value
|
905
|
+
end
|
906
|
+
end
|
907
|
+
test<<test_data
|
908
|
+
end
|
909
|
+
|
910
|
+
|
884
911
|
xml_data.root.add_child(test)
|
885
912
|
File.open(file, 'w') {|f| f.write(xml_data.to_xml) }
|
886
913
|
test=nil
|
@@ -893,6 +920,7 @@ module TDriverReportCreator
|
|
893
920
|
user_data_values = user_data.values
|
894
921
|
counter = user_data_values.size-1
|
895
922
|
end
|
923
|
+
|
896
924
|
builder = Nokogiri::XML::Builder.new do |xml|
|
897
925
|
xml.tests {
|
898
926
|
xml.test {
|
@@ -911,6 +939,7 @@ module TDriverReportCreator
|
|
911
939
|
xml.dump_count calculate_total_values_from_hash(total_dump)
|
912
940
|
xml.sent_bytes calculate_total_values_from_hash(total_sent)
|
913
941
|
xml.received_bytes calculate_total_values_from_hash(total_received)
|
942
|
+
|
914
943
|
if user_data!=nil && !user_data.empty?
|
915
944
|
xml.user_display_data {
|
916
945
|
(0..counter).each { |i|
|
@@ -921,6 +950,21 @@ module TDriverReportCreator
|
|
921
950
|
}
|
922
951
|
}
|
923
952
|
end
|
953
|
+
|
954
|
+
if user_data_rows!=nil && !user_data_columns.empty?
|
955
|
+
|
956
|
+
xml.user_table_data{
|
957
|
+
#create the table rows
|
958
|
+
user_data_rows.each do |row_hash|
|
959
|
+
row_hash.sort{|a,b| a[0]<=>b[0]}.each do |value|
|
960
|
+
xml.column("name"=>value[0].to_s){
|
961
|
+
xml.text value[1].to_s
|
962
|
+
}
|
963
|
+
end
|
964
|
+
end
|
965
|
+
}
|
966
|
+
|
967
|
+
end
|
924
968
|
}
|
925
969
|
}
|
926
970
|
end
|
@@ -379,12 +379,35 @@ background: black; /*background of tabs for hover state, plus tab with "selected
|
|
379
379
|
}
|
380
380
|
|
381
381
|
|
382
|
-
img
|
383
|
-
{
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
382
|
+
div.img
|
383
|
+
{
|
384
|
+
margin:2px;
|
385
|
+
border:0px;
|
386
|
+
height:auto;
|
387
|
+
width:auto;
|
388
|
+
text-align:left;
|
389
|
+
}
|
390
|
+
div.img img
|
391
|
+
{
|
392
|
+
display:inline;
|
393
|
+
margin:3px;
|
394
|
+
border:0px;
|
395
|
+
}
|
396
|
+
div.img a:hover img
|
397
|
+
{
|
398
|
+
border:1px solid #0000ff;
|
399
|
+
height:20%;
|
400
|
+
width:20%;
|
401
|
+
}
|
402
|
+
div.desc
|
403
|
+
{
|
404
|
+
text-align:left;
|
405
|
+
font-weight:normal;
|
406
|
+
width:120px;
|
407
|
+
margin:3px;
|
408
|
+
}
|
409
|
+
|
410
|
+
.togList
|
388
411
|
{
|
389
412
|
|
390
413
|
}
|
@@ -651,7 +674,7 @@ display: block;
|
|
651
674
|
else
|
652
675
|
stylesheet='<link rel="stylesheet" title="TDriverReportStyle" href="../../tdriver_report_style.css"/>'
|
653
676
|
end
|
654
|
-
|
677
|
+
|
655
678
|
end
|
656
679
|
html_start='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' <<
|
657
680
|
'<html xmlns="http://www.w3.org/1999/xhtml">'<<
|
@@ -872,8 +895,7 @@ display: block;
|
|
872
895
|
html_body=nil
|
873
896
|
@test_case_execution_log=nil
|
874
897
|
@test_case_behaviour_log=nil
|
875
|
-
|
876
|
-
@test_case_user_data_columns=nil
|
898
|
+
|
877
899
|
end
|
878
900
|
def tog_list_begin(name)
|
879
901
|
html_body='<dl class="togList">'<<
|
@@ -902,7 +924,7 @@ display: block;
|
|
902
924
|
end
|
903
925
|
tdriver_group = nil
|
904
926
|
html_body=nil
|
905
|
-
|
927
|
+
|
906
928
|
end
|
907
929
|
def write_test_case_summary_body(page,status,tc_arr,chronological_page=nil,report_page=nil,test_case_name=nil)
|
908
930
|
html_body=Array.new
|
@@ -920,7 +942,7 @@ display: block;
|
|
920
942
|
html_body << '<form action="save_results_to" ><input type="submit" name="save_results_to" value="Download report" /></form>' if @report_editable=='true'
|
921
943
|
tdriver_group=nil
|
922
944
|
html_result=nil
|
923
|
-
elsif @fail_statuses.include?(status) || status == "failed"
|
945
|
+
elsif @fail_statuses.include?(status) || status == "failed"
|
924
946
|
title='<div class="page_title"><center><h1>Failed</h1></center></div>'<<
|
925
947
|
'<div class="summary_failed">' <<
|
926
948
|
'<form action="save_total_run_results" >'
|
@@ -1026,13 +1048,13 @@ display: block;
|
|
1026
1048
|
chronological_html_body=nil
|
1027
1049
|
end # case
|
1028
1050
|
end # if
|
1029
|
-
|
1051
|
+
|
1030
1052
|
html_body << '</div>'
|
1031
1053
|
File.open(page, 'a') do |f2|
|
1032
1054
|
f2.puts html_body
|
1033
1055
|
end
|
1034
1056
|
html_body=nil
|
1035
|
-
|
1057
|
+
|
1036
1058
|
end
|
1037
1059
|
|
1038
1060
|
def write_summary_body(page,start_time,end_time,run_time,total_run,total_passed,total_failed,total_not_run,total_crash_files,total_device_resets,summary_arr=nil)
|
data/lib/tdriver/tdriver.rb
CHANGED
@@ -147,5 +147,8 @@ $parameters.init
|
|
147
147
|
# enable logging engine
|
148
148
|
$logger.enable_logging
|
149
149
|
|
150
|
+
# reporting modules
|
151
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'report/report.rb' ) ) if MobyUtil::Parameter[ :enable_reporter, 'true' ]=='true'
|
152
|
+
|
150
153
|
# initialization done, everything is ready
|
151
154
|
$TDRIVER_INITIALIZED = true
|
@@ -17,38 +17,83 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
-
module
|
20
|
+
module TDriver
|
21
21
|
|
22
|
-
# Plugin service implementation
|
23
22
|
class PluginService
|
24
23
|
|
25
|
-
|
24
|
+
# private methods and variables
|
25
|
+
class << self
|
26
26
|
|
27
|
-
|
28
|
-
def initialize
|
27
|
+
private
|
29
28
|
|
30
|
-
|
29
|
+
# TODO: document me
|
30
|
+
def initialize_class
|
31
31
|
|
32
|
-
|
32
|
+
reset_plugins_list
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
# TODO: document me
|
37
|
+
def reset_plugins_list
|
38
|
+
|
39
|
+
# list of registered plugins
|
40
|
+
@registered_plugins = {}
|
41
|
+
|
42
|
+
# list of enabled plugins
|
43
|
+
@enabled_plugins = []
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
# TODO: document me
|
48
|
+
def delete_plugin( plugin_name )
|
49
|
+
|
50
|
+
# remove from the plugins hash
|
51
|
+
@registered_plugins.delete( plugin_name )
|
33
52
|
|
34
|
-
|
35
|
-
|
53
|
+
# remove plugin from enabled plugins list
|
54
|
+
@enabled_plugins.delete( plugin_name )
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
# TODO: document me
|
59
|
+
def plugin_data_value( plugin_module, value_name, optional = false )
|
60
|
+
|
61
|
+
begin
|
62
|
+
|
63
|
+
plugin_module.send( value_name.to_sym )
|
64
|
+
|
65
|
+
rescue NoMethodError
|
66
|
+
|
67
|
+
raise RuntimeError, "Plugin must have #{ value_name.to_s } value defined" if !optional
|
68
|
+
|
69
|
+
rescue Exception
|
70
|
+
|
71
|
+
raise
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
end # self
|
78
|
+
|
79
|
+
# TODO: document me
|
80
|
+
def self.registered_plugins( type = nil )
|
36
81
|
|
37
82
|
# return all or plugins of given type
|
38
|
-
Hash[
|
83
|
+
Hash[ @registered_plugins.select{ | key, value | type.nil? || value[ :type ] == type } ]
|
39
84
|
|
40
85
|
end
|
41
86
|
|
42
87
|
# returns true if plugin is registered, plugin type can be given as optional parameter
|
43
|
-
def plugin_registered?( plugin_name, type = nil )
|
88
|
+
def self.plugin_registered?( plugin_name, type = nil )
|
44
89
|
|
45
90
|
# check if given plugin is registered
|
46
|
-
if
|
91
|
+
if @registered_plugins.has_key?( plugin_name )
|
47
92
|
|
48
93
|
unless type.nil?
|
49
94
|
|
50
95
|
# plugin registered, compare that given plugin type matches
|
51
|
-
|
96
|
+
@registered_plugins[ plugin_name ][ :type ] == type
|
52
97
|
|
53
98
|
else
|
54
99
|
|
@@ -59,142 +104,189 @@ module MobyUtil
|
|
59
104
|
|
60
105
|
else
|
61
106
|
|
62
|
-
# plugin not registered, not found from
|
107
|
+
# plugin not registered, not found from registered_plugins list
|
63
108
|
false
|
64
109
|
|
65
110
|
end
|
66
111
|
|
67
112
|
end
|
68
113
|
|
69
|
-
|
70
|
-
|
71
|
-
|
114
|
+
# TODO: document me
|
115
|
+
def self.enabled_plugins
|
116
|
+
|
117
|
+
@enabled_plugins
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
# TODO: document me
|
122
|
+
def self.enable_plugin( plugin_name )
|
72
123
|
|
124
|
+
begin
|
125
|
+
|
126
|
+
# enable plugin
|
127
|
+
@registered_plugins[ plugin_name ][ :enabled ] = true
|
128
|
+
|
129
|
+
# add name to enabled plugins list
|
130
|
+
@enabled_plugins << plugin_name unless @enabled_plugins.include?( plugin_name )
|
131
|
+
|
132
|
+
rescue
|
133
|
+
|
134
|
+
raise ArgumentError, "No such plugin registered #{ plugin_name }"
|
135
|
+
|
136
|
+
end
|
137
|
+
|
73
138
|
end
|
74
139
|
|
75
|
-
|
140
|
+
# TODO: document me
|
141
|
+
def self.disable_plugin( plugin_name )
|
142
|
+
|
143
|
+
begin
|
144
|
+
|
145
|
+
# disable plugin
|
146
|
+
@registered_plugins[ plugin_name ][ :enabled ] = false
|
147
|
+
|
148
|
+
# remove name from enabled plugins list
|
149
|
+
@enabled_plugins.delete( plugin_name )
|
76
150
|
|
77
|
-
|
151
|
+
rescue
|
152
|
+
|
153
|
+
raise ArgumentError, "No such plugin registered #{ plugin_name }"
|
154
|
+
|
155
|
+
end
|
78
156
|
|
79
157
|
end
|
80
158
|
|
81
|
-
|
159
|
+
# TODO: document me
|
160
|
+
def self.plugin_enabled?( plugin_name )
|
82
161
|
|
83
|
-
(
|
84
|
-
|
162
|
+
@enabled_plugins.include?( plugin_name )
|
163
|
+
|
85
164
|
end
|
86
165
|
|
87
|
-
|
166
|
+
# TODO: document me
|
167
|
+
def self.register_plugin( plugin_module )
|
88
168
|
|
89
|
-
# retrieve plugin name
|
169
|
+
# retrieve plugin name
|
90
170
|
plugin_name = plugin_data_value( plugin_module, :plugin_name )
|
91
171
|
|
92
172
|
# throw exception if plugin is already registered
|
93
|
-
|
173
|
+
raise ArgumentError, "Plugin #{ plugin_name } is already registered" if @registered_plugins.has_key?( plugin_name )
|
94
174
|
|
95
175
|
# plugin configuration
|
96
|
-
|
176
|
+
@registered_plugins[ plugin_name ] = {
|
177
|
+
|
178
|
+
# store plugin type
|
97
179
|
:type => plugin_data_value( plugin_module, :plugin_type ),
|
180
|
+
|
181
|
+
# store plugin implementation module name
|
98
182
|
:plugin_module => plugin_module,
|
183
|
+
|
184
|
+
# set plugin to enabled state
|
99
185
|
:enabled => true
|
186
|
+
|
100
187
|
}
|
101
188
|
|
102
189
|
# register plugin
|
103
190
|
plugin_module.register_plugin
|
104
191
|
|
105
|
-
|
106
|
-
|
107
|
-
def unregister_plugin( plugin_name )
|
108
|
-
|
109
|
-
# unregister plugin, raise exception if plugin is not registered
|
110
|
-
( @@registered_plugins[ plugin_name ][ :plugin_module ].unregister_plugin ) rescue Kernel::raise( ArgumentError.new( "Unregister failed due to plugin %s is not registered" % [ plugin_name ] ) )
|
111
|
-
|
112
|
-
# remove from the plugins hash
|
113
|
-
@@registered_plugins.delete( plugin_name )
|
192
|
+
# add name to enabled plugins list
|
193
|
+
@enabled_plugins << plugin_name unless @enabled_plugins.include?( plugin_name )
|
114
194
|
|
115
195
|
end
|
116
196
|
|
117
|
-
|
197
|
+
# TODO: document me
|
198
|
+
def self.unregister_plugin( plugin_name )
|
118
199
|
|
119
200
|
begin
|
120
201
|
|
121
|
-
#
|
122
|
-
|
202
|
+
# call plugin unregister mechanism
|
203
|
+
@registered_plugins[ plugin_name ][ :plugin_module ].unregister_plugin
|
123
204
|
|
124
|
-
|
205
|
+
# remove from the plugins hash
|
206
|
+
@registered_plugins.delete( plugin_name )
|
125
207
|
|
126
|
-
|
208
|
+
# remove from the plugins hash
|
209
|
+
@enabled_plugins.delete( plugin_name )
|
127
210
|
|
128
|
-
|
211
|
+
rescue
|
129
212
|
|
130
|
-
|
213
|
+
raise ArgumentError, "Failed to unregister plugin due to plugin #{ plugin_name.inspect } is not registered"
|
131
214
|
|
132
215
|
end
|
133
216
|
|
134
217
|
end
|
135
218
|
|
136
|
-
|
219
|
+
# TODO: document me
|
220
|
+
def self.load_plugin( plugin_name )
|
137
221
|
|
138
222
|
begin
|
139
223
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
224
|
+
# load plugin implementation
|
225
|
+
require plugin_name
|
226
|
+
|
227
|
+
rescue LoadError
|
228
|
+
|
229
|
+
raise RuntimeError, "Error while loading plugin #{ plugin_name.to_s }. Please verify that the plugin is installed properly (#{ $!.class }: #{ $!.message })"
|
145
230
|
|
146
231
|
end
|
147
232
|
|
233
|
+
end
|
234
|
+
|
235
|
+
# TODO: document me
|
236
|
+
def self.call_plugin_method( plugin_name, method_name, *args )
|
237
|
+
|
148
238
|
begin
|
149
239
|
|
150
|
-
|
240
|
+
@registered_plugins.fetch( plugin_name ){
|
151
241
|
|
152
|
-
|
242
|
+
# in case if plugin not found from registered plugins list
|
243
|
+
raise ArgumentError, "No such plugin registered #{ plugin_name }"
|
153
244
|
|
154
|
-
|
245
|
+
}[ :plugin_module ].send( method_name.to_sym, *args )
|
155
246
|
|
156
|
-
|
247
|
+
rescue ArgumentError
|
157
248
|
|
158
|
-
|
249
|
+
# raise argument errors as is
|
250
|
+
raise
|
159
251
|
|
160
|
-
|
252
|
+
rescue
|
161
253
|
|
162
|
-
|
254
|
+
# raise all other exceptions as PluginError
|
255
|
+
raise PluginError, "Error occured during calling #{ method_name } method for #{ plugin_name } (#{ $!.class }: #{ $!.message })"
|
163
256
|
|
164
|
-
|
257
|
+
end
|
165
258
|
|
166
259
|
end
|
167
260
|
|
168
|
-
|
169
|
-
|
170
|
-
# remove from the plugins hash
|
171
|
-
@@registered_plugins.delete( plugin_name )
|
261
|
+
# initialize plugin service
|
262
|
+
initialize_class
|
172
263
|
|
173
|
-
|
264
|
+
# enable hooking for performance measurement & debug logging
|
265
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
174
266
|
|
175
|
-
|
176
|
-
|
177
|
-
begin
|
267
|
+
end # PluginService
|
178
268
|
|
179
|
-
|
269
|
+
end
|
180
270
|
|
181
|
-
|
271
|
+
module MobyUtil
|
182
272
|
|
183
|
-
|
273
|
+
# deprecated plugin service implementation; please use TDriver::PluginService instead of this
|
274
|
+
class PluginService
|
184
275
|
|
185
|
-
|
276
|
+
# deprecated
|
277
|
+
def self.instance
|
186
278
|
|
187
|
-
|
279
|
+
# retrieve caller information
|
280
|
+
file, line = caller.first.split(":")
|
188
281
|
|
189
|
-
|
282
|
+
# show warning
|
283
|
+
warn "#{ file }:#{ line } warning: deprecated method MobyUtil::PluginService.instance#method; please use static class TDriver::PluginService#method instead"
|
190
284
|
|
191
|
-
|
285
|
+
# redirect to new implementation
|
286
|
+
TDriver::PluginService
|
192
287
|
|
193
288
|
end
|
194
289
|
|
195
|
-
|
196
|
-
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
197
|
-
|
198
|
-
end # PluginService
|
290
|
+
end
|
199
291
|
|
200
|
-
end
|
292
|
+
end
|