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
@@ -571,7 +571,8 @@ module MobyBehaviour
|
|
571
571
|
rescue MobyBase::TestObjectNotFoundError, MobyBase::TestObjectNotVisibleError
|
572
572
|
|
573
573
|
rules_hash_clone = rules_hash.clone
|
574
|
-
|
574
|
+
|
575
|
+
# remove type attribute from hash
|
575
576
|
rules_hash_clone.delete(:type)
|
576
577
|
|
577
578
|
# string representation of used rule hash, remove curly braces
|
@@ -589,10 +590,19 @@ module MobyBehaviour
|
|
589
590
|
|
590
591
|
end
|
591
592
|
|
593
|
+
# raise slightly different exception message when receiver test object is type of application
|
594
|
+
if application?
|
595
|
+
|
596
|
+
message = "The application (id: #{ @id }, name: #{ @name.inspect }) has no child object with type or behaviour method with name #{ method_id.to_s.inspect }#{ attributes_string } on #{ @sut.id.inspect }"
|
597
|
+
|
598
|
+
else
|
599
|
+
|
600
|
+
message = "The test object (id: #{ @id }, type: #{ @type.inspect }, name: #{ @name.inspect }) has no child object with type or behaviour method with name #{ method_id.to_s.inspect }#{ attributes_string } on #{ @sut.id.inspect }"
|
601
|
+
|
602
|
+
end
|
603
|
+
|
592
604
|
# raise exception
|
593
|
-
|
594
|
-
"The test object (id: #{ @id }, type: #{ @type.inspect }, name: #{ @name.inspect }) has no child object with type or behaviour method with name #{ method_id.to_s.inspect }#{ attributes_string } on #{ @sut.id.inspect }"
|
595
|
-
)
|
605
|
+
raise MobyBase::TestObjectNotFoundError, message
|
596
606
|
|
597
607
|
end
|
598
608
|
|
data/lib/tdriver/loader.rb
CHANGED
@@ -39,9 +39,7 @@ require File.expand_path( File.join( File.dirname( __FILE__ ), 'util/loader.rb'
|
|
39
39
|
# base modules
|
40
40
|
require File.expand_path( File.join( File.dirname( __FILE__ ), 'base/loader.rb' ) )
|
41
41
|
|
42
|
-
# reporting modules
|
43
|
-
require File.expand_path( File.join( File.dirname( __FILE__ ), 'report/report.rb' ) )
|
44
|
-
|
45
42
|
# verify module
|
46
43
|
require File.expand_path( File.join( File.dirname( __FILE__ ), 'verify/verify.rb' ) )
|
47
44
|
|
45
|
+
|
@@ -33,6 +33,7 @@ module TDriverErrorRecovery
|
|
33
33
|
dlload "callbackif"
|
34
34
|
extern "void restartDatagateway(const char*)"
|
35
35
|
extern "int error()"
|
36
|
+
extern "int getBootTimeout(const char*)"
|
36
37
|
end')
|
37
38
|
end
|
38
39
|
|
@@ -73,7 +74,8 @@ module TDriverErrorRecovery
|
|
73
74
|
if @recovery_settings.get_ats4_error_recovery_enabled=='true'
|
74
75
|
MobyUtil::Logger.instance.log "behaviour" , "WARNING;Restarting ATS4 DataGateway"
|
75
76
|
TDriver_Error_Recovery_ATS4.restartDatagateway(current_sut.id.to_s);
|
76
|
-
|
77
|
+
ats_timeout=TDriver_Error_Recovery_ATS4.getBootTimeout(current_sut.id.to_s);
|
78
|
+
sleep ats_timeout.to_i
|
77
79
|
MobyUtil::Logger.instance.log "behaviour" , "WARNING;ATS4 DataGateway restarted"
|
78
80
|
else
|
79
81
|
MobyUtil::Logger.instance.log "behaviour" , "WARNING;Resetting sut: #{current_sut.id.to_s}"
|
@@ -88,7 +90,7 @@ module TDriverErrorRecovery
|
|
88
90
|
current_reconnect_attempt+=1
|
89
91
|
end
|
90
92
|
end
|
91
|
-
Kernel::raise BehaviourError.new("Error Recovery", "Error recovery failed after #{attempt_reconnects} recovery attempts") if b_error_recovery_succesful==false
|
93
|
+
Kernel::raise MobyBase::BehaviourError.new("Error Recovery", "Error recovery failed after #{attempt_reconnects} recovery attempts") if b_error_recovery_succesful==false
|
92
94
|
end
|
93
95
|
|
94
96
|
# Reconnects the devices without ping
|
@@ -116,9 +118,8 @@ module TDriverErrorRecovery
|
|
116
118
|
# false for failed ping
|
117
119
|
# === raises
|
118
120
|
def ping_device(current_sut)
|
119
|
-
begin
|
120
|
-
|
121
|
-
if xml_state.to_s.include?("tasMessage")==false
|
121
|
+
begin
|
122
|
+
if current_sut.refresh()==false
|
122
123
|
MobyUtil::Logger.instance.log "behaviour" , "WARNING;Device ping failed"
|
123
124
|
false
|
124
125
|
else
|
@@ -91,7 +91,15 @@ class TDriverErrorRecoverySettings
|
|
91
91
|
end
|
92
92
|
def get_monitored_sut
|
93
93
|
str_parameter=MobyUtil::Parameter[ :error_recovery_monitored_sut_ids ]
|
94
|
-
|
94
|
+
|
95
|
+
if str_parameter.include?('|')
|
96
|
+
@monitored_suts=str_parameter.split('|')
|
97
|
+
elsif str_parameter.include?(',')
|
98
|
+
@monitored_suts=str_parameter.split(',')
|
99
|
+
else
|
100
|
+
@monitored_suts=str_parameter
|
101
|
+
end
|
102
|
+
|
95
103
|
@monitored_suts
|
96
104
|
end
|
97
105
|
|
@@ -17,6 +17,7 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
+
|
20
21
|
require 'fileutils'
|
21
22
|
require 'date'
|
22
23
|
require File.expand_path( File.join( File.dirname( __FILE__ ), 'error_recovery/tdriver_error_recovery_settings' ) )
|
@@ -56,6 +57,8 @@ if MobyUtil::Parameter[ :custom_error_recovery_module, nil ]!=nil
|
|
56
57
|
require MobyUtil::Parameter[ :custom_error_recovery_module ]
|
57
58
|
|
58
59
|
end
|
60
|
+
include TDriverReportAPI
|
61
|
+
|
59
62
|
|
60
63
|
|
61
64
|
|
@@ -1,20 +1,20 @@
|
|
1
1
|
############################################################################
|
2
|
-
##
|
3
|
-
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
4
|
-
## All rights reserved.
|
5
|
-
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
6
|
-
##
|
7
|
-
## This file is part of Testability Driver.
|
8
|
-
##
|
9
|
-
## If you have questions regarding the use of this file, please contact
|
10
|
-
## Nokia at testabilitydriver@nokia.com .
|
11
|
-
##
|
12
|
-
## This library is free software; you can redistribute it and/or
|
13
|
-
## modify it under the terms of the GNU Lesser General Public
|
14
|
-
## License version 2.1 as published by the Free Software Foundation
|
15
|
-
## and appearing in the file LICENSE.LGPL included in the packaging
|
16
|
-
## of this file.
|
17
|
-
##
|
2
|
+
##
|
3
|
+
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
4
|
+
## All rights reserved.
|
5
|
+
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
6
|
+
##
|
7
|
+
## This file is part of Testability Driver.
|
8
|
+
##
|
9
|
+
## If you have questions regarding the use of this file, please contact
|
10
|
+
## Nokia at testabilitydriver@nokia.com .
|
11
|
+
##
|
12
|
+
## This library is free software; you can redistribute it and/or
|
13
|
+
## modify it under the terms of the GNU Lesser General Public
|
14
|
+
## License version 2.1 as published by the Free Software Foundation
|
15
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
16
|
+
## of this file.
|
17
|
+
##
|
18
18
|
############################################################################
|
19
19
|
|
20
20
|
|
@@ -37,7 +37,7 @@ module TDriverReportAPI
|
|
37
37
|
end
|
38
38
|
return ret
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
def tdriver_log_data(data)
|
42
42
|
Kernel::raise TypeError.new("Argument to method cannot be nil.") if data.nil?
|
43
43
|
if $tdriver_reporter!=nil
|
@@ -45,19 +45,25 @@ module TDriverReportAPI
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
def tdriver_capture_state(capture_screen_shot=true)
|
48
|
+
def tdriver_capture_state(capture_screen_shot=true)
|
49
49
|
if $tdriver_reporter
|
50
50
|
$new_test_case.capture_dump(capture_screen_shot) if $new_test_case
|
51
51
|
end
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
|
+
def tdriver_capture_screen(arguments=Hash.new)
|
55
|
+
if $tdriver_reporter
|
56
|
+
$new_test_case.capture_dump(true,arguments) if $new_test_case
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
54
60
|
def tdriver_log_data_in_total_run_table(column_name,value)
|
55
61
|
Kernel::raise TypeError.new("Argument to method cannot be nil.") if column_name.nil? || value.nil?
|
56
62
|
if $tdriver_reporter!=nil
|
57
63
|
$tdriver_reporter.set_user_table_data(column_name,value)
|
58
64
|
end
|
59
65
|
end
|
60
|
-
|
66
|
+
|
61
67
|
def tdriver_report_log(message)
|
62
68
|
Kernel::raise TypeError.new("Argument message was not a String.") unless message.nil? or message.kind_of?(String)
|
63
69
|
if $tdriver_reporter
|
@@ -212,8 +218,8 @@ module TDriverReportAPI
|
|
212
218
|
$stderr.puts "%s:%s warning: method deprecated" % [ file, line]
|
213
219
|
tdriver_report_combine_reports(reports)
|
214
220
|
end
|
215
|
-
|
216
|
-
|
221
|
+
|
222
|
+
|
217
223
|
end #TDriverReportAPI
|
218
224
|
|
219
225
|
module MattiReportAPI
|
@@ -222,4 +228,4 @@ module MattiReportAPI
|
|
222
228
|
|
223
229
|
end
|
224
230
|
|
225
|
-
|
231
|
+
|
@@ -140,7 +140,9 @@ class TDriverReportCrashFileCapture
|
|
140
140
|
sut_crash_files=list_sut_crash_files(sut_attributes[:sut])
|
141
141
|
sut_crash_files.each do |crash_file|
|
142
142
|
download_crash_file(sut_attributes[:sut],crash_file[0],download_folder.gsub("/",'\\')+'\\',crash_file[1])
|
143
|
+
delete_crash_file(sut_attributes[:sut],crash_file[0])
|
143
144
|
end
|
145
|
+
sut_attributes[:sut].clear_crash_notes(5)
|
144
146
|
end
|
145
147
|
end
|
146
148
|
end
|
@@ -35,6 +35,7 @@ module TDriverReportCreator
|
|
35
35
|
|
36
36
|
@_video_file_name = "failed_test.avi"
|
37
37
|
@_previous_video_file_name = "previous_test.avi"
|
38
|
+
@_stored_details=[]
|
38
39
|
clean_video_files
|
39
40
|
|
40
41
|
if $tdriver_reporter == nil
|
@@ -147,7 +148,12 @@ module TDriverReportCreator
|
|
147
148
|
$tdriver_reporter.set_total_not_run(1)
|
148
149
|
end
|
149
150
|
|
150
|
-
$tdriver_reporter.write_to_result_storage(
|
151
|
+
$tdriver_reporter.write_to_result_storage(
|
152
|
+
current_status,
|
153
|
+
test_case_name,
|
154
|
+
group,
|
155
|
+
reboots,
|
156
|
+
crashes,
|
151
157
|
$new_test_case.test_case_start_time,
|
152
158
|
$new_test_case.test_case_chronological_view_data,
|
153
159
|
$new_test_case.test_case_run_time,
|
@@ -158,10 +164,12 @@ module TDriverReportCreator
|
|
158
164
|
'',
|
159
165
|
$new_test_case.test_case_total_dump_count,
|
160
166
|
$new_test_case.test_case_total_data_sent,
|
161
|
-
$new_test_case.test_case_total_data_received
|
167
|
+
$new_test_case.test_case_total_data_received,
|
168
|
+
$new_test_case.test_case_user_data,
|
169
|
+
$new_test_case.test_case_user_data_columns
|
162
170
|
)
|
163
|
-
|
164
|
-
|
171
|
+
|
172
|
+
|
165
173
|
$tdriver_reporter.set_end_time(Time.now)
|
166
174
|
$tdriver_reporter.set_total_run(1)
|
167
175
|
$tdriver_reporter.update_summary_page('inprogress')
|
@@ -171,7 +179,7 @@ module TDriverReportCreator
|
|
171
179
|
$run_status_thread_active=true
|
172
180
|
Thread.new do
|
173
181
|
begin
|
174
|
-
#Update test case summary pages
|
182
|
+
#Update test case summary pages
|
175
183
|
$tdriver_reporter.update_test_case_summary_pages('all')
|
176
184
|
$tdriver_reporter.update_test_case_summary_pages('passed')
|
177
185
|
$tdriver_reporter.update_test_case_summary_pages('failed')
|
@@ -246,10 +254,14 @@ module TDriverReportCreator
|
|
246
254
|
exit(1)
|
247
255
|
end
|
248
256
|
$new_test_case.read_crash_monitor_settings()
|
257
|
+
|
249
258
|
$new_test_case.read_file_monitor_settings()
|
259
|
+
|
260
|
+
$new_test_case.clean_crash_files_from_sut() if $test_case_run_index==1 && MobyUtil::Parameter[ :report_crash_file_monitor_crash_file_cleanup, false ]=='true'
|
250
261
|
|
251
262
|
amount_of_crash_files=$new_test_case.check_if_crash_files_exist()
|
252
|
-
|
263
|
+
|
264
|
+
if amount_of_crash_files.to_i > 0
|
253
265
|
$new_test_case.capture_crash_files()
|
254
266
|
$new_test_case.clean_crash_files_from_sut()
|
255
267
|
$tdriver_reporter.set_total_crash_files(amount_of_crash_files.to_i)
|
@@ -257,7 +269,7 @@ module TDriverReportCreator
|
|
257
269
|
end
|
258
270
|
|
259
271
|
amount_of_files=$new_test_case.check_if_files_exist()
|
260
|
-
if amount_of_files.to_i > 0
|
272
|
+
if amount_of_files.to_i > 0
|
261
273
|
$new_test_case.capture_files()
|
262
274
|
$new_test_case.clean_files_from_sut()
|
263
275
|
$tdriver_reporter.set_total_crash_files(amount_of_files.to_i)
|
@@ -311,19 +323,31 @@ module TDriverReportCreator
|
|
311
323
|
# nil
|
312
324
|
# === raises
|
313
325
|
def update_test_case(details)
|
314
|
-
$new_test_case
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
326
|
+
if $new_test_case==nil
|
327
|
+
@_stored_details<<details
|
328
|
+
else
|
329
|
+
if @_stored_details!=[]
|
330
|
+
@_stored_details.each do |detail|
|
331
|
+
$new_test_case.set_test_case_execution_log(detail)
|
332
|
+
end
|
333
|
+
$new_test_case.set_test_case_execution_log(details)
|
334
|
+
@_stored_details=[]
|
335
|
+
else
|
336
|
+
$new_test_case.set_test_case_execution_log(details)
|
337
|
+
end
|
338
|
+
updating_test_case_details(details) if MobyUtil::Parameter[ :custom_error_recovery_module, nil ]!=nil
|
339
|
+
if MobyUtil::Parameter[ :report_monitor_memory, 'false']=='true'
|
340
|
+
begin
|
341
|
+
start_memory=$new_test_case.tc_memory_amount_start()
|
342
|
+
if start_memory=='-'
|
343
|
+
MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
|
344
|
+
memory=$tdriver_reporter.get_sut_used_memory(sut_id,sut_attributes)
|
345
|
+
$new_test_case.set_tc_memory_amount_start(memory)
|
346
|
+
end
|
323
347
|
end
|
348
|
+
rescue
|
349
|
+
$new_test_case.set_tc_memory_amount_start(0)
|
324
350
|
end
|
325
|
-
rescue
|
326
|
-
$new_test_case.set_tc_memory_amount_start(0)
|
327
351
|
end
|
328
352
|
end
|
329
353
|
end
|
@@ -354,20 +378,25 @@ module TDriverReportCreator
|
|
354
378
|
# nil
|
355
379
|
# === raises
|
356
380
|
def capture_screen_test_case()
|
357
|
-
create_test_case_folder($tdriver_reporter.fail_statuses.first)
|
358
|
-
$new_test_case.capture_dump()
|
359
|
-
if $new_test_case.video_recording?
|
360
|
-
$new_test_case.copy_video_capture()
|
361
|
-
end
|
362
|
-
error_in_test_case(MobyBase::SUTFactory.instance.connected_suts) if MobyUtil::Parameter[ :custom_error_recovery_module, nil ]!=nil
|
363
381
|
begin
|
364
|
-
|
365
|
-
|
382
|
+
create_test_case_folder($tdriver_reporter.fail_statuses.first)
|
383
|
+
$new_test_case.capture_dump()
|
384
|
+
if $new_test_case.video_recording?
|
385
|
+
$new_test_case.copy_video_capture()
|
366
386
|
end
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
387
|
+
error_in_test_case(MobyBase::SUTFactory.instance.connected_suts) if MobyUtil::Parameter[ :custom_error_recovery_module, nil ]!=nil
|
388
|
+
begin
|
389
|
+
if start_error_recovery()==true
|
390
|
+
error_in_connection_detected
|
391
|
+
end
|
392
|
+
rescue Exception => e
|
393
|
+
update_test_case("Error recovery failed Exception: #{e.message} Backtrace: #{e.backtrace}")
|
394
|
+
end_test_case($new_test_case.test_case_name,'failed')
|
395
|
+
exit(1)
|
396
|
+
end
|
397
|
+
rescue => ex
|
398
|
+
puts ex.message
|
399
|
+
puts ex.backtrace
|
371
400
|
end
|
372
401
|
end
|
373
402
|
#This updates the test case behaviour log
|
@@ -479,9 +508,9 @@ module TDriverReportCreator
|
|
479
508
|
status='failed' if MobyUtil::Parameter[:report_fail_test_if_files_found]=='true'
|
480
509
|
end
|
481
510
|
end
|
482
|
-
|
511
|
+
|
483
512
|
temp_rec = $new_test_case.video_recording?
|
484
|
-
|
513
|
+
|
485
514
|
if temp_rec
|
486
515
|
$new_test_case.stop_video_recording
|
487
516
|
end
|
@@ -497,31 +526,31 @@ module TDriverReportCreator
|
|
497
526
|
end
|
498
527
|
end
|
499
528
|
if(status=='passed')
|
500
|
-
|
529
|
+
|
501
530
|
no_activity_videos = ""
|
502
|
-
if MobyUtil::Parameter[:report_check_device_active, 'false']=='true'
|
503
|
-
if temp_rec
|
504
|
-
no_activity_videos = $new_test_case.target_video_alive
|
505
|
-
end
|
506
|
-
end
|
507
|
-
|
508
|
-
if no_activity_videos == ""
|
531
|
+
if MobyUtil::Parameter[:report_check_device_active, 'false']=='true'
|
532
|
+
if temp_rec
|
533
|
+
no_activity_videos = $new_test_case.target_video_alive
|
534
|
+
end
|
535
|
+
end
|
536
|
+
|
537
|
+
if no_activity_videos == ""
|
509
538
|
$new_test_case.set_test_case_status($tdriver_reporter.pass_statuses.first)
|
510
539
|
create_test_case_folder($tdriver_reporter.pass_statuses.first)
|
511
540
|
else
|
512
541
|
# switch case to failed status
|
513
|
-
status='failed'
|
542
|
+
status='failed'
|
514
543
|
$new_test_case.copy_video_capture
|
515
544
|
$new_test_case.update_test_case "The case failed due to video analysis (#{no_activity_videos}) indicating that the target is no longer responding."
|
516
|
-
|
545
|
+
|
517
546
|
$new_test_case.set_test_case_status($tdriver_reporter.fail_statuses.first)
|
518
547
|
create_test_case_folder($tdriver_reporter.fail_statuses.first)
|
519
548
|
if found_crash_files.to_i > 0
|
520
549
|
$new_test_case.capture_crash_files()
|
521
550
|
end
|
522
|
-
|
551
|
+
|
523
552
|
end
|
524
|
-
|
553
|
+
|
525
554
|
end
|
526
555
|
if(status!='passed' && status!='failed')
|
527
556
|
$new_test_case.set_test_case_status($tdriver_reporter.not_run_statuses.first)
|
@@ -542,7 +571,6 @@ module TDriverReportCreator
|
|
542
571
|
$new_test_case.capture_files()
|
543
572
|
end
|
544
573
|
$new_test_case.update_test_case_page()
|
545
|
-
$new_test_case.clean_crash_files_from_sut()
|
546
574
|
$new_test_case.clean_files_from_sut()
|
547
575
|
|
548
576
|
update_run($new_test_case.test_case_name.to_s,status,$new_test_case.test_case_reboots,$new_test_case.test_case_crash_files,execution_log)
|
@@ -598,4 +626,4 @@ end #TDriverReportCreator
|
|
598
626
|
|
599
627
|
|
600
628
|
|
601
|
-
|
629
|
+
|
@@ -1,20 +1,20 @@
|
|
1
1
|
############################################################################
|
2
|
-
##
|
3
|
-
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
4
|
-
## All rights reserved.
|
5
|
-
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
6
|
-
##
|
7
|
-
## This file is part of Testability Driver.
|
8
|
-
##
|
9
|
-
## If you have questions regarding the use of this file, please contact
|
10
|
-
## Nokia at testabilitydriver@nokia.com .
|
11
|
-
##
|
12
|
-
## This library is free software; you can redistribute it and/or
|
13
|
-
## modify it under the terms of the GNU Lesser General Public
|
14
|
-
## License version 2.1 as published by the Free Software Foundation
|
15
|
-
## and appearing in the file LICENSE.LGPL included in the packaging
|
16
|
-
## of this file.
|
17
|
-
##
|
2
|
+
##
|
3
|
+
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
4
|
+
## All rights reserved.
|
5
|
+
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
6
|
+
##
|
7
|
+
## This file is part of Testability Driver.
|
8
|
+
##
|
9
|
+
## If you have questions regarding the use of this file, please contact
|
10
|
+
## Nokia at testabilitydriver@nokia.com .
|
11
|
+
##
|
12
|
+
## This library is free software; you can redistribute it and/or
|
13
|
+
## modify it under the terms of the GNU Lesser General Public
|
14
|
+
## License version 2.1 as published by the Free Software Foundation
|
15
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
16
|
+
## of this file.
|
17
|
+
##
|
18
18
|
############################################################################
|
19
19
|
|
20
20
|
|
@@ -61,7 +61,7 @@ module TDriverReportCreator
|
|
61
61
|
:tc_video_recorders,
|
62
62
|
:tc_memory_amount_start,
|
63
63
|
:tc_memory_amount_end,
|
64
|
-
:tc_memory_amount_start,
|
64
|
+
:tc_memory_amount_start,
|
65
65
|
:tc_memory_amount_total,
|
66
66
|
:pass_statuses,
|
67
67
|
:fail_statuses,
|
@@ -112,6 +112,7 @@ module TDriverReportCreator
|
|
112
112
|
@not_run_statuses=MobyUtil::Parameter[ :report_not_run_statuses, "not run" ].split('|')
|
113
113
|
@test_case_logging_level = MobyUtil::Parameter[ :logging_level, nil ]
|
114
114
|
@trace_directory=MobyUtil::Parameter[ :report_trace_folder, nil]
|
115
|
+
@report_short_folders=MobyUtil::Parameter[ :report_short_folders, 'false']
|
115
116
|
$tdriver_report_log_output = StringIO.new ""
|
116
117
|
begin
|
117
118
|
if MobyUtil::Parameter[:behaviour_logging] == 'true'
|
@@ -208,11 +209,11 @@ module TDriverReportCreator
|
|
208
209
|
def set_test_case_name(value)
|
209
210
|
@test_case_name_full=value
|
210
211
|
#Clean the test case name for unwanted chars
|
211
|
-
stripped=value.gsub(/[<\/?*>!)(}{
|
212
|
+
stripped=value.gsub(/[<\/?*>!)(}{\\\#{@%"'.,:;~-]/,'').squeeze(" ")
|
212
213
|
if stripped==nil then
|
213
214
|
stripped=value.squeeze(" ")
|
214
215
|
end
|
215
|
-
stripped1 = stripped.to_s.gsub(' ','_')
|
216
|
+
stripped1 = stripped.to_s.gsub(' ','_')
|
216
217
|
if stripped1==nil
|
217
218
|
stripped1=stripped
|
218
219
|
end
|
@@ -280,7 +281,7 @@ module TDriverReportCreator
|
|
280
281
|
# === returns
|
281
282
|
# nil
|
282
283
|
# === raises
|
283
|
-
def set_test_case_execution_log(value)
|
284
|
+
def set_test_case_execution_log(value)
|
284
285
|
@test_case_execution_log=@test_case_execution_log.to_s + '<br />' + value.to_s.gsub(/\n/,'<br />')
|
285
286
|
end
|
286
287
|
#This method sets the test case user data
|
@@ -292,7 +293,7 @@ module TDriverReportCreator
|
|
292
293
|
# === raises
|
293
294
|
def set_test_case_user_data(data,columns)
|
294
295
|
@test_case_user_data=data
|
295
|
-
@test_case_user_data_columns=columns
|
296
|
+
@test_case_user_data_columns=columns
|
296
297
|
end
|
297
298
|
#This method sets the users data to display in chronological table
|
298
299
|
#
|
@@ -303,7 +304,7 @@ module TDriverReportCreator
|
|
303
304
|
# === raises
|
304
305
|
def set_test_case_chronological_view_data(data)
|
305
306
|
@test_case_chronological_view_data=data
|
306
|
-
end
|
307
|
+
end
|
307
308
|
#This method sets the test case behaviour log
|
308
309
|
#
|
309
310
|
# === params
|
@@ -318,17 +319,17 @@ module TDriverReportCreator
|
|
318
319
|
#
|
319
320
|
# === params
|
320
321
|
# rec_name: String, name of video file to create
|
321
|
-
# previous_name: String, name of video file of previous test case
|
322
|
+
# previous_name: String, name of video file of previous test case
|
322
323
|
# === returns
|
323
324
|
# nil
|
324
325
|
def start_video_recording( rec_name, previous_name )
|
325
|
-
|
326
|
+
|
326
327
|
@tc_video_filename = rec_name
|
327
328
|
@tc_previous_video_filename = previous_name
|
328
329
|
tc_video_width = 640
|
329
330
|
tc_video_height = 480
|
330
331
|
tc_video_fps = 30
|
331
|
-
|
332
|
+
|
332
333
|
begin
|
333
334
|
tc_video_width = MobyUtil::Parameter[ :report_video_width ].to_i
|
334
335
|
rescue
|
@@ -344,20 +345,20 @@ module TDriverReportCreator
|
|
344
345
|
rescue
|
345
346
|
# parameter not loaded, do nothing
|
346
347
|
end
|
347
|
-
|
348
|
+
|
348
349
|
|
349
350
|
@tc_video_recorders = []
|
350
|
-
|
351
|
+
|
351
352
|
begin
|
352
353
|
each_video_device do | video_device, device_index |
|
353
|
-
|
354
|
+
|
354
355
|
rec_options = { :width => tc_video_width, :height => tc_video_height, :fps => tc_video_fps }
|
355
356
|
rec_options[ :device ] = video_device unless video_device == "true" # use default device if "true"
|
356
357
|
video_recorder = MobyUtil::TDriverCam.new_cam( "cam_" + device_index + "_" + @tc_video_filename, rec_options )
|
357
358
|
video_recorder.start_recording
|
358
359
|
@tc_video_recorders << video_recorder
|
359
360
|
@tc_video_recording = true
|
360
|
-
|
361
|
+
|
361
362
|
end
|
362
363
|
rescue Exception => e
|
363
364
|
# make sure to stop any started cams if startup fails
|
@@ -365,42 +366,42 @@ module TDriverReportCreator
|
|
365
366
|
raise e
|
366
367
|
|
367
368
|
end
|
368
|
-
|
369
|
+
|
369
370
|
nil
|
370
|
-
|
371
|
+
|
371
372
|
end
|
372
|
-
|
373
|
+
|
373
374
|
def target_video_alive
|
374
|
-
|
375
|
+
|
375
376
|
ret = ""
|
376
377
|
each_video_device do | video_device, device_index |
|
377
|
-
|
378
|
+
|
378
379
|
check_fps = MobyUtil::Parameter[:report_activity_fps, '3']
|
379
380
|
check_frame_min = MobyUtil::Parameter[:report_activity_frame_treshold, '8']
|
380
381
|
check_video_min = MobyUtil::Parameter[:report_activity_video_treshold, '29']
|
381
|
-
|
382
|
+
|
382
383
|
ret_n = MobyUtil.video_alive? "cam_" + device_index + "_" + @tc_video_filename, check_fps.to_f, check_frame_min.to_f, check_video_min.to_f, false
|
383
|
-
|
384
|
+
|
384
385
|
if !ret_n
|
385
386
|
ret += ", " if !ret.empty?
|
386
387
|
ret += "cam_" + device_index + "_" + @tc_video_filename
|
387
388
|
end
|
388
|
-
|
389
|
-
end
|
390
|
-
|
389
|
+
|
390
|
+
end
|
391
|
+
|
391
392
|
return ret
|
392
|
-
|
393
|
+
|
393
394
|
end
|
394
|
-
|
395
|
+
|
395
396
|
def stop_video_recording()
|
396
|
-
|
397
|
+
|
397
398
|
|
398
399
|
@tc_video_recorders.each do | video_recorder |
|
399
400
|
video_recorder.stop_recording
|
400
401
|
end
|
401
402
|
|
402
403
|
@tc_video_recording = false
|
403
|
-
|
404
|
+
|
404
405
|
end
|
405
406
|
#This method sets the tdriver test case memory at start
|
406
407
|
#
|
@@ -432,7 +433,7 @@ module TDriverReportCreator
|
|
432
433
|
def set_tc_memory_amount_total(value)
|
433
434
|
@tc_memory_amount_total=value
|
434
435
|
end
|
435
|
-
|
436
|
+
|
436
437
|
#This method updates the tdrivertest case details page
|
437
438
|
#
|
438
439
|
# === params
|
@@ -467,50 +468,50 @@ module TDriverReportCreator
|
|
467
468
|
@test_case_total_data_received
|
468
469
|
)
|
469
470
|
write_page_end(@test_case_folder+'/index.html')
|
470
|
-
|
471
|
+
|
471
472
|
rescue Exception => e
|
472
473
|
Kernel::raise e
|
473
474
|
end
|
474
475
|
return nil
|
475
476
|
end
|
476
|
-
|
477
|
+
|
477
478
|
#This method makes a copy of the video recording of this test case
|
478
479
|
def copy_video_capture()
|
479
|
-
|
480
|
+
|
480
481
|
stop_video_recording
|
481
|
-
|
482
|
+
|
482
483
|
logging_enabled = MobyUtil::Logger.instance.enabled
|
483
484
|
MobyUtil::Logger.instance.enabled=false
|
484
485
|
begin
|
485
|
-
|
486
|
+
|
486
487
|
video_folder=@test_case_folder+'/video'
|
487
488
|
if File::directory?(video_folder)==false
|
488
489
|
FileUtils.mkdir_p video_folder
|
489
|
-
end
|
490
|
-
|
490
|
+
end
|
491
|
+
|
491
492
|
|
492
493
|
each_video_device do | video_device, device_index |
|
493
|
-
|
494
|
-
begin
|
494
|
+
|
495
|
+
begin
|
495
496
|
FileUtils.copy("cam_" + device_index + "_" + @tc_video_filename, video_folder)
|
496
497
|
rescue
|
497
498
|
# Copy failed, do nothing
|
498
499
|
end
|
499
|
-
|
500
|
+
|
500
501
|
begin
|
501
502
|
FileUtils.copy("cam_" + device_index + "_" + @tc_previous_video_filename, video_folder)
|
502
503
|
rescue
|
503
504
|
# Copy failed, do nothing
|
504
505
|
end
|
505
|
-
|
506
|
+
|
506
507
|
end
|
507
508
|
|
508
|
-
|
509
|
-
|
509
|
+
|
510
|
+
|
510
511
|
rescue Exception => e
|
511
512
|
@test_case_execution_log=@test_case_execution_log.to_s + '<br />' + "Unable to store video file: " + e.message
|
512
513
|
end
|
513
|
-
|
514
|
+
|
514
515
|
MobyUtil::Logger.instance.enabled=logging_enabled
|
515
516
|
return nil
|
516
517
|
end
|
@@ -521,7 +522,7 @@ module TDriverReportCreator
|
|
521
522
|
# === returns
|
522
523
|
# nil
|
523
524
|
# === raises
|
524
|
-
def capture_dump(take_screenshot=true)
|
525
|
+
def capture_dump(take_screenshot=true,arguments=Hash.new)
|
525
526
|
MobyUtil::Logger.instance.enabled=false
|
526
527
|
image_html=Array.new
|
527
528
|
state_html=Array.new
|
@@ -532,24 +533,31 @@ module TDriverReportCreator
|
|
532
533
|
FileUtils.mkdir_p dump_folder
|
533
534
|
end
|
534
535
|
MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
|
535
|
-
|
536
|
+
|
536
537
|
t = Time.now
|
537
538
|
time_stamp=t.strftime( "%Y%m%d%H%M%S" )
|
538
539
|
if take_screenshot==true
|
539
540
|
begin
|
540
541
|
sut_attributes[:sut].capture_screen( :Filename => dump_folder+'/'+time_stamp+'_'+sut_id.to_s+'_state.png', :Redraw => true ) if sut_attributes[:is_connected]
|
541
|
-
|
542
|
+
if arguments[:file]
|
543
|
+
sut_attributes[:sut].capture_screen( :Filename => arguments[:file], :Redraw => true ) if sut_attributes[:is_connected]
|
544
|
+
end
|
545
|
+
image_html='<div class="img"><a href="state_xml/'<<
|
542
546
|
time_stamp+'_'+sut_id.to_s+'_state.png'<<
|
543
|
-
'"><img alt="" src="state_xml/'<<
|
547
|
+
'" target="_blank"><img alt="" src="state_xml/'<<
|
544
548
|
time_stamp+'_'+sut_id.to_s+'_state.png'<<
|
545
|
-
'" width=
|
549
|
+
'" width="10%" height="10%" /></a>'
|
550
|
+
if arguments[:text]
|
551
|
+
image_html << "<div class=\"desc\">#{arguments[:text]}</div>"
|
552
|
+
end
|
553
|
+
image_html << '</div>'
|
546
554
|
self.set_test_case_execution_log(image_html.to_s)
|
547
|
-
rescue Exception=>e
|
555
|
+
rescue Exception=>e
|
548
556
|
@capture_screen_error="Unable to capture sceen image #{sut_id}: " + e.message
|
549
557
|
self.set_test_case_execution_log(@capture_screen_error.to_s)
|
550
558
|
end
|
551
559
|
end
|
552
|
-
|
560
|
+
|
553
561
|
begin
|
554
562
|
failed_xml_state=sut_attributes[:sut].xml_data() if sut_attributes[:is_connected]
|
555
563
|
File.open(dump_folder+'/'+time_stamp+'_'+sut_id.to_s+'_state.xml', 'w') { |file| file.write(failed_xml_state) }
|
@@ -557,7 +565,7 @@ module TDriverReportCreator
|
|
557
565
|
time_stamp+'_'+sut_id.to_s+'_state.xml'<<
|
558
566
|
'">'+time_stamp+'_'+sut_id.to_s+'_state.xml'+'</a>'
|
559
567
|
self.set_test_case_execution_log(state_html.to_s)
|
560
|
-
rescue Exception=>e
|
568
|
+
rescue Exception=>e
|
561
569
|
@failed_dump_error="Unable to capture state xml #{sut_id}: " + e.message
|
562
570
|
self.set_test_case_execution_log(@failed_dump_error.to_s)
|
563
571
|
end
|
@@ -605,7 +613,12 @@ module TDriverReportCreator
|
|
605
613
|
def create_test_case_folder(status)
|
606
614
|
begin
|
607
615
|
#check if report directory exists
|
608
|
-
@
|
616
|
+
if @report_short_folders == 'true'
|
617
|
+
@test_case_folder=@test_cases_folder+'/'+status+'_'+@test_case_index.to_s
|
618
|
+
else
|
619
|
+
@test_case_folder=@test_cases_folder+'/'+status+'_'+@test_case_index.to_s+'_'+@test_case_name
|
620
|
+
end
|
621
|
+
|
609
622
|
if File::directory?(@test_case_folder)==false
|
610
623
|
FileUtils.mkdir_p @test_case_folder
|
611
624
|
end
|
@@ -626,7 +639,12 @@ module TDriverReportCreator
|
|
626
639
|
begin
|
627
640
|
#check if report directory exists
|
628
641
|
old_test_case_folder=@test_case_folder
|
629
|
-
|
642
|
+
if @report_short_folders == 'true'
|
643
|
+
new_test_case_folder=@test_case_folder.sub('result'+'_'+@test_case_index.to_s,status+'_'+@test_case_index.to_s)
|
644
|
+
else
|
645
|
+
new_test_case_folder=@test_case_folder.sub('result'+'_'+@test_case_index.to_s+'_'+@test_case_name,status+'_'+@test_case_index.to_s+'_'+@test_case_name)
|
646
|
+
end
|
647
|
+
|
630
648
|
if File::directory?(new_test_case_folder)==false
|
631
649
|
FileUtils.mv old_test_case_folder, new_test_case_folder , :force => true # no error
|
632
650
|
@test_case_folder=new_test_case_folder
|