Class: TDriverReportCreator::TestCaseRun
- Inherits:
-
TDriverReportCrashFileCapture
- Object
- TDriverReportCrashFileCapture
- TDriverReportCreator::TestCaseRun
- Includes:
- TDriverReportWriter
- Defined in:
- lib/tdriver/report/report_test_case_run.rb
Overview
Test case class for new test case run
Instance Attribute Summary collapse
-
#capture_screen_error ⇒ Object
Returns the value of attribute capture_screen_error.
-
#connection_errors ⇒ Object
Returns the value of attribute connection_errors.
-
#fail_statuses ⇒ Object
Returns the value of attribute fail_statuses.
-
#failed_dump_error ⇒ Object
Returns the value of attribute failed_dump_error.
-
#failed_screenshot ⇒ Object
Returns the value of attribute failed_screenshot.
-
#not_run_statuses ⇒ Object
Returns the value of attribute not_run_statuses.
-
#pass_statuses ⇒ Object
Returns the value of attribute pass_statuses.
-
#report_short_folders ⇒ Object
Returns the value of attribute report_short_folders.
-
#tc_memory_amount_end ⇒ Object
Returns the value of attribute tc_memory_amount_end.
-
#tc_memory_amount_start ⇒ Object
Returns the value of attribute tc_memory_amount_start.
-
#tc_memory_amount_total ⇒ Object
Returns the value of attribute tc_memory_amount_total.
-
#tc_previous_video_filename ⇒ Object
Returns the value of attribute tc_previous_video_filename.
-
#tc_video_filename ⇒ Object
Returns the value of attribute tc_video_filename.
-
#tc_video_recorders ⇒ Object
Returns the value of attribute tc_video_recorders.
-
#tc_video_recording ⇒ Object
Returns the value of attribute tc_video_recording.
-
#test_case_behaviour_log ⇒ Object
Returns the value of attribute test_case_behaviour_log.
-
#test_case_chronological_view_data ⇒ Object
Returns the value of attribute test_case_chronological_view_data.
-
#test_case_crash_files ⇒ Object
Returns the value of attribute test_case_crash_files.
-
#test_case_data_received_at_end ⇒ Object
Returns the value of attribute test_case_data_received_at_end.
-
#test_case_data_received_at_start ⇒ Object
Returns the value of attribute test_case_data_received_at_start.
-
#test_case_data_sent_at_end ⇒ Object
Returns the value of attribute test_case_data_sent_at_end.
-
#test_case_data_sent_at_start ⇒ Object
Returns the value of attribute test_case_data_sent_at_start.
-
#test_case_dump_count_at_end ⇒ Object
Returns the value of attribute test_case_dump_count_at_end.
-
#test_case_dump_count_at_start ⇒ Object
Returns the value of attribute test_case_dump_count_at_start.
-
#test_case_end_time ⇒ Object
Returns the value of attribute test_case_end_time.
-
#test_case_ended ⇒ Object
Returns the value of attribute test_case_ended.
-
#test_case_execution_log ⇒ Object
Returns the value of attribute test_case_execution_log.
-
#test_case_folder ⇒ Object
Returns the value of attribute test_case_folder.
-
#test_case_group ⇒ Object
Returns the value of attribute test_case_group.
-
#test_case_index ⇒ Object
Returns the value of attribute test_case_index.
-
#test_case_logging_level ⇒ Object
Returns the value of attribute test_case_logging_level.
-
#test_case_name ⇒ Object
Returns the value of attribute test_case_name.
-
#test_case_name_full ⇒ Object
Returns the value of attribute test_case_name_full.
-
#test_case_reboots ⇒ Object
Returns the value of attribute test_case_reboots.
-
#test_case_run_time ⇒ Object
Returns the value of attribute test_case_run_time.
-
#test_case_start_time ⇒ Object
Returns the value of attribute test_case_start_time.
-
#test_case_status ⇒ Object
Returns the value of attribute test_case_status.
-
#test_case_total_data_received ⇒ Object
Returns the value of attribute test_case_total_data_received.
-
#test_case_total_data_sent ⇒ Object
Returns the value of attribute test_case_total_data_sent.
-
#test_case_total_dump_count ⇒ Object
Returns the value of attribute test_case_total_dump_count.
-
#test_case_user_data ⇒ Object
Returns the value of attribute test_case_user_data.
-
#test_case_user_data_columns ⇒ Object
Returns the value of attribute test_case_user_data_columns.
-
#test_cases_folder ⇒ Object
Returns the value of attribute test_cases_folder.
-
#trace_directory ⇒ Object
Returns the value of attribute trace_directory.
Instance Method Summary collapse
-
#capture_dump(take_screenshot = true, arguments = Hash.new) ⇒ Object
This method captures the failed xml dump and image.
-
#capture_trace_files ⇒ Object
This method captures the trace files.
-
#copy_video_capture ⇒ Object
This method makes a copy of the video recording of this test case.
-
#create_test_case_folder(status) ⇒ Object
This method creates a new TDriver test case folder when testing is ended.
-
#each_video_device ⇒ Object
This methods checks the available video devices.
-
#initialize ⇒ TestCaseRun
constructor
A new instance of TestCaseRun.
-
#rename_test_case_folder(status) ⇒ Object
This method renames a new TDriver test case folder when testing is ended.
-
#repalce_chars_to_html_format(value) ⇒ Object
This method sets the test case execution log.
-
#set_tc_memory_amount_end(value) ⇒ Object
This method sets the tdriver test case memory at end.
-
#set_tc_memory_amount_start(value) ⇒ Object
This method sets the tdriver test case memory at start.
-
#set_tc_memory_amount_total(value) ⇒ Object
This method sets the tdriver test case total memory.
-
#set_test_case_behaviour_log(value, test_case) ⇒ Object
This method sets the test case behaviour log.
-
#set_test_case_chronological_view_data(data) ⇒ Object
This method sets the users data to display in chronological table.
-
#set_test_case_crash_files(value) ⇒ Object
This method sets the test case crash files.
-
#set_test_case_end_time(value) ⇒ Object
This method sets the test case end time.
-
#set_test_case_ended(value) ⇒ Object
This method sets the tdriver test case has ended.
- #set_test_case_execution_log(value, format = false) ⇒ Object
-
#set_test_case_folder(value) ⇒ Object
This method sets the tdriver test case report folder.
-
#set_test_case_group(value) ⇒ Object
This method sets the test case group.
-
#set_test_case_index(value) ⇒ Object
This method sets the test case index.
-
#set_test_case_name(value) ⇒ Object
This method sets the tdriver test case name.
-
#set_test_case_name_full(value) ⇒ Object
This method sets the tdriver test case name.
-
#set_test_case_reboots(value) ⇒ Object
This method sets the test case reboots.
-
#set_test_case_run_time(value) ⇒ Object
This method sets the test case run time.
-
#set_test_case_start_time(value) ⇒ Object
This method sets the test case start time.
-
#set_test_case_status(value) ⇒ Object
This method sets the test case status.
-
#set_test_case_user_data(data, columns) ⇒ Object
This method sets the test case user data.
-
#set_test_cases_folder(value) ⇒ Object
This method sets the tdriver test cases report folder.
-
#start_video_recording(rec_name, previous_name) ⇒ Object
This methods sets video recording of the test case.
- #stop_video_recording ⇒ Object
- #target_video_alive ⇒ Object
-
#update_test_case_page(rewrite = false) ⇒ Object
This method updates the tdrivertest case details page.
- #video_recording? ⇒ Boolean
Methods included from TDriverReportWriter
#behaviour_log_summary, #copy_code_file_to_test_case_report, #create_behaviour_links, #create_templates_links, #format_behaviour_log, #format_duration, #format_execution_log, #format_user_log_table, #get_java_script, #get_rdoc_for_method, #reporter_link_to_code, #scan_rdoc_file_for_method, #tog_list_begin, #tog_list_end, #write_duration_graph, #write_environment_body, #write_exit_body, #write_navigation_menu, #write_page_end, #write_page_navigation_div, #write_page_start, #write_stack_file_to_html, #write_style_sheet, #write_summary_body, #write_tdriver_log_body, #write_test_case_body, #write_test_case_summary_body
Methods inherited from TDriverReportCrashFileCapture
#capture_crash_files, #check_if_crash_files_exist, #clean_crash_files_from_sut, #confirm_crash_notes, #delete_crash_file, #download_crash_file, #download_crash_files, #file_is_crash_file, #list_sut_crash_files, #read_crash_monitor_settings, #return_settings_value_array
Methods included from TDriverReportFileCapture
#capture_files, #check_if_files_exist, #clean_files_from_sut, #delete_file, #download_file, #download_files, #list_sut_files, #read_file_monitor_settings, #return_settings_value_array
Constructor Details
#initialize ⇒ TestCaseRun
Returns a new instance of TestCaseRun.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 74 def initialize() @test_case_folder=nil @test_cases_folder=nil @test_case_name=nil @test_case_ended=false @test_case_name_full=nil @test_case_index=nil @test_case_start_time=nil @test_case_end_time=nil @test_case_run_time=nil @test_case_status=nil @test_case_execution_log=nil @test_case_user_data=nil @test_case_user_data_columns=nil @test_case_chronological_view_data=nil @capture_screen_error=nil @failed_dump_error=nil @test_case_reboots=0 @test_case_crash_files=0 @connection_errors=0 @test_case_behaviour_log = Array.new @failed_screenshot=nil @test_case_group=nil @tc_video_recording=false @tc_video_filename=nil @tc_previous_video_filename=nil @tc_video_recorders=[] @tc_memory_amount_start='-' @tc_memory_amount_end='-' @tc_memory_amount_total='-' @test_case_total_dump_count=Hash.new @test_case_total_data_sent=Hash.new @test_case_total_data_received=Hash.new @test_case_dump_count_at_start=Hash.new @test_case_dump_count_at_end=Hash.new @test_case_data_sent_at_start=Hash.new @test_case_data_sent_at_end=Hash.new @test_case_data_received_at_start=Hash.new @test_case_data_received_at_end=Hash.new @pass_statuses= $parameters[ :report_passed_statuses, "passed" ].split('|') @fail_statuses= $parameters[ :report_failed_statuses, "failed" ].split('|') @not_run_statuses= $parameters[ :report_not_run_statuses, "not run" ].split('|') @test_case_logging_level = $parameters[ :logging_level, nil ] @trace_directory= $parameters[ :report_trace_folder, nil] @report_short_folders= $parameters[ :report_short_folders, 'false'] $tdriver_report_log_output = StringIO.new "" begin if $parameters[:behaviour_logging] == 'true' if @test_case_logging_level.to_i > 0 logger_instance = MobyUtil::Logger.instance.get_logger( 'TDriver' ) begin MobyUtil::Logger.instance.remove_outputter(logger_instance, 'io' ) rescue end o = Log4r::IOOutputter.new("io",$tdriver_report_log_output) MobyUtil::Logger.instance.set_outputter_pattern(o, $parameters[ :logging_outputter_pattern, '%d [%c] [%l] %M' ]) MobyUtil::Logger.instance.add_outputter(logger_instance, o) end end rescue end end |
Instance Attribute Details
#capture_screen_error ⇒ Object
Returns the value of attribute capture_screen_error.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def capture_screen_error @capture_screen_error end |
#connection_errors ⇒ Object
Returns the value of attribute connection_errors.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def connection_errors @connection_errors end |
#fail_statuses ⇒ Object
Returns the value of attribute fail_statuses.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def fail_statuses @fail_statuses end |
#failed_dump_error ⇒ Object
Returns the value of attribute failed_dump_error.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def failed_dump_error @failed_dump_error end |
#failed_screenshot ⇒ Object
Returns the value of attribute failed_screenshot.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def failed_screenshot @failed_screenshot end |
#not_run_statuses ⇒ Object
Returns the value of attribute not_run_statuses.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def not_run_statuses @not_run_statuses end |
#pass_statuses ⇒ Object
Returns the value of attribute pass_statuses.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def pass_statuses @pass_statuses end |
#report_short_folders ⇒ Object
Returns the value of attribute report_short_folders.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def report_short_folders @report_short_folders end |
#tc_memory_amount_end ⇒ Object
Returns the value of attribute tc_memory_amount_end.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def tc_memory_amount_end @tc_memory_amount_end end |
#tc_memory_amount_start ⇒ Object
Returns the value of attribute tc_memory_amount_start.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def tc_memory_amount_start @tc_memory_amount_start end |
#tc_memory_amount_total ⇒ Object
Returns the value of attribute tc_memory_amount_total.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def tc_memory_amount_total @tc_memory_amount_total end |
#tc_previous_video_filename ⇒ Object
Returns the value of attribute tc_previous_video_filename.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def tc_previous_video_filename @tc_previous_video_filename end |
#tc_video_filename ⇒ Object
Returns the value of attribute tc_video_filename.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def tc_video_filename @tc_video_filename end |
#tc_video_recorders ⇒ Object
Returns the value of attribute tc_video_recorders.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def tc_video_recorders @tc_video_recorders end |
#tc_video_recording ⇒ Object
Returns the value of attribute tc_video_recording.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def tc_video_recording @tc_video_recording end |
#test_case_behaviour_log ⇒ Object
Returns the value of attribute test_case_behaviour_log.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_behaviour_log @test_case_behaviour_log end |
#test_case_chronological_view_data ⇒ Object
Returns the value of attribute test_case_chronological_view_data.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_chronological_view_data @test_case_chronological_view_data end |
#test_case_crash_files ⇒ Object
Returns the value of attribute test_case_crash_files.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_crash_files @test_case_crash_files end |
#test_case_data_received_at_end ⇒ Object
Returns the value of attribute test_case_data_received_at_end.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_data_received_at_end @test_case_data_received_at_end end |
#test_case_data_received_at_start ⇒ Object
Returns the value of attribute test_case_data_received_at_start.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_data_received_at_start @test_case_data_received_at_start end |
#test_case_data_sent_at_end ⇒ Object
Returns the value of attribute test_case_data_sent_at_end.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_data_sent_at_end @test_case_data_sent_at_end end |
#test_case_data_sent_at_start ⇒ Object
Returns the value of attribute test_case_data_sent_at_start.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_data_sent_at_start @test_case_data_sent_at_start end |
#test_case_dump_count_at_end ⇒ Object
Returns the value of attribute test_case_dump_count_at_end.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_dump_count_at_end @test_case_dump_count_at_end end |
#test_case_dump_count_at_start ⇒ Object
Returns the value of attribute test_case_dump_count_at_start.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_dump_count_at_start @test_case_dump_count_at_start end |
#test_case_end_time ⇒ Object
Returns the value of attribute test_case_end_time.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_end_time @test_case_end_time end |
#test_case_ended ⇒ Object
Returns the value of attribute test_case_ended.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_ended @test_case_ended end |
#test_case_execution_log ⇒ Object
Returns the value of attribute test_case_execution_log.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_execution_log @test_case_execution_log end |
#test_case_folder ⇒ Object
Returns the value of attribute test_case_folder.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_folder @test_case_folder end |
#test_case_group ⇒ Object
Returns the value of attribute test_case_group.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_group @test_case_group end |
#test_case_index ⇒ Object
Returns the value of attribute test_case_index.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_index @test_case_index end |
#test_case_logging_level ⇒ Object
Returns the value of attribute test_case_logging_level.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_logging_level @test_case_logging_level end |
#test_case_name ⇒ Object
Returns the value of attribute test_case_name.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_name @test_case_name end |
#test_case_name_full ⇒ Object
Returns the value of attribute test_case_name_full.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_name_full @test_case_name_full end |
#test_case_reboots ⇒ Object
Returns the value of attribute test_case_reboots.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_reboots @test_case_reboots end |
#test_case_run_time ⇒ Object
Returns the value of attribute test_case_run_time.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_run_time @test_case_run_time end |
#test_case_start_time ⇒ Object
Returns the value of attribute test_case_start_time.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_start_time @test_case_start_time end |
#test_case_status ⇒ Object
Returns the value of attribute test_case_status.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_status @test_case_status end |
#test_case_total_data_received ⇒ Object
Returns the value of attribute test_case_total_data_received.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_total_data_received @test_case_total_data_received end |
#test_case_total_data_sent ⇒ Object
Returns the value of attribute test_case_total_data_sent.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_total_data_sent @test_case_total_data_sent end |
#test_case_total_dump_count ⇒ Object
Returns the value of attribute test_case_total_dump_count.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_total_dump_count @test_case_total_dump_count end |
#test_case_user_data ⇒ Object
Returns the value of attribute test_case_user_data.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_user_data @test_case_user_data end |
#test_case_user_data_columns ⇒ Object
Returns the value of attribute test_case_user_data_columns.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_case_user_data_columns @test_case_user_data_columns end |
#test_cases_folder ⇒ Object
Returns the value of attribute test_cases_folder.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def test_cases_folder @test_cases_folder end |
#trace_directory ⇒ Object
Returns the value of attribute trace_directory.
27 28 29 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 27 def trace_directory @trace_directory end |
Instance Method Details
#capture_dump(take_screenshot = true, arguments = Hash.new) ⇒ Object
This method captures the failed xml dump and image
params
nil
returns
nil
raises
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 571 def capture_dump(take_screenshot=true,arguments=Hash.new) MobyUtil::Logger.instance.enabled=false image_html=Array.new state_html=Array.new self.set_test_case_execution_log('<hr />') begin dump_folder=@test_case_folder+'/state_xml' if File::directory?(dump_folder)==false FileUtils.mkdir_p dump_folder end TDriver::SUTFactory.connected_suts.each do |sut_id, sut_attributes| t = Time.now time_stamp=t.strftime( "%Y%m%d%H%M%S" ) if take_screenshot==true begin sut_attributes[:sut].capture_screen( :Filename => dump_folder+'/'+time_stamp+'_'+sut_id.to_s+'_state.png', :Redraw => true ) if sut_attributes[:is_connected] if arguments[:file] base_name=File.basename(arguments[:file]) base_folder=File.dirname(arguments[:file]) sut_attributes[:sut].capture_screen( :Filename => "#{base_folder}/#{sut_id.to_s}_#{base_name}", :Redraw => true ) if sut_attributes[:is_connected] end image_html='<div class="img"><a href="state_xml/'<< time_stamp+'_'+sut_id.to_s+'_state.png'<< '" target="_blank"><img alt="" src="state_xml/'<< time_stamp+'_'+sut_id.to_s+'_state.png'<< '" width="10%" height="10%" /></a>' if arguments[:text] image_html << "<div class=\"desc\">#{arguments[:text]}</div>" end image_html << '</div>' self.set_test_case_execution_log(image_html.to_s) rescue Exception=>e @capture_screen_error="Unable to capture sceen image #{sut_id}: " + e. self.set_test_case_execution_log(@capture_screen_error.to_s) end end begin if sut_attributes[:is_connected] original_filter=sut_attributes[:sut].parameter[ :filter_type] original_find=sut_attributes[:sut].parameter[ :use_find_object] sut_attributes[:sut].parameter[ :filter_type] = 'none' sut_attributes[:sut].parameter[ :use_find_object] = 'false' sut_attributes[:sut].refresh failed_xml_state=sut_attributes[:sut].xml_data() File.open(dump_folder+'/'+time_stamp+'_'+sut_id.to_s+'_state.xml', 'w') { |file| file.write(failed_xml_state) } state_html='<a href="state_xml/'<< time_stamp+'_'+sut_id.to_s+'_state.xml'<< '">'+time_stamp+'_'+sut_id.to_s+'_state.xml'+'</a>' self.set_test_case_execution_log(state_html.to_s) end rescue Exception=>e @failed_dump_error="Unable to capture state xml #{sut_id}: " + e. self.set_test_case_execution_log(@failed_dump_error.to_s) ensure sut_attributes[:sut].parameter[ :filter_type]=original_filter sut_attributes[:sut].parameter[ :use_find_object]=original_find end end rescue Exception => e @capture_screen_error="Unable to capture state: " + e. self.set_test_case_execution_log(@capture_screen_error.to_s) ensure if $parameters[ :logging_level, 0 ].to_i > 0 MobyUtil::Logger.instance.enabled=true else MobyUtil::Logger.instance.enabled=false end self.set_test_case_execution_log('<hr />') end end |
#capture_trace_files ⇒ Object
This method captures the trace files
params
nil
returns
nil
raises
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 650 def capture_trace_files() if $parameters[ :report_trace_capture, false]=="true" begin trace_folder= $parameters[ :report_trace_folder, nil] if trace_folder!=nil if File::directory?(trace_folder)==true dump_folder=@test_case_folder+'/trace_files' if File::directory?(dump_folder)==false FileUtils.mkdir_p dump_folder end FileUtils.cp_r trace_folder, @test_case_folder+'/trace_files' end end rescue Exception => ex self.set_test_case_execution_log(ex.) self.set_test_case_execution_log(ex.backtrace) end end end |
#copy_video_capture ⇒ Object
This method makes a copy of the video recording of this test case
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 523 def copy_video_capture() stop_video_recording logging_enabled = MobyUtil::Logger.instance.enabled MobyUtil::Logger.instance.enabled=false begin video_folder=@test_case_folder+'/video' if File::directory?(video_folder)==false FileUtils.mkdir_p video_folder end each_video_device do | video_device, device_index | begin FileUtils.copy(tdriver_report_folder() + "/cam_" + device_index + "_" + @tc_video_filename, video_folder) rescue # Copy failed, do nothing end begin FileUtils.copy(tdriver_report_folder() + "/cam_" + device_index + "_" + @tc_previous_video_filename, video_folder) rescue # Copy failed, do nothing end end rescue Exception => e @test_case_execution_log=@test_case_execution_log.to_s + '<br />' + "Unable to store video file: " + e. end MobyUtil::Logger.instance.enabled=logging_enabled return nil end |
#create_test_case_folder(status) ⇒ Object
This method creates a new TDriver test case folder when testing is ended
params
nil
returns
nil
raises
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 676 def create_test_case_folder(status) begin #check if report directory exists if @report_short_folders == 'true' @test_case_folder=@test_cases_folder+'/'+status+'_'+@test_case_index.to_s else @test_case_folder=@test_cases_folder+'/'+status+'_'+@test_case_index.to_s+'_'+@test_case_name end if File::directory?(@test_case_folder)==false FileUtils.mkdir_p @test_case_folder end rescue Exception => e raise e end return nil end |
#each_video_device ⇒ Object
This methods checks the available video devices
params
returns
nil
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 338 def each_video_device if $parameters[:report_video, nil] != nil device_index = 0 $parameters[:report_video].split("|").each do | video_device | if !video_device.strip.empty? yield video_device.strip, device_index.to_s device_index += 1 end end end end |
#rename_test_case_folder(status) ⇒ Object
This method renames a new TDriver test case folder when testing is ended
params
nil
returns
nil
raises
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 701 def rename_test_case_folder(status) begin #check if report directory exists old_test_case_folder=@test_case_folder if @report_short_folders == 'true' new_test_case_folder=@test_case_folder.sub('result'+'_'+@test_case_index.to_s,status+'_'+@test_case_index.to_s) else 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) end if File::directory?(new_test_case_folder)==false FileUtils.mv old_test_case_folder, new_test_case_folder , :force => true # no error @test_case_folder=new_test_case_folder end rescue Exception => e raise e end return nil end |
#repalce_chars_to_html_format(value) ⇒ Object
This method sets the test case execution log
params
value: test case execution log entry
returns
nil
raises
288 289 290 291 292 293 294 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 288 def repalce_chars_to_html_format(value) formatted_line=value.to_s.gsub('<','<') formatted_line=formatted_line.gsub('>','>') formatted_line end |
#set_tc_memory_amount_end(value) ⇒ Object
This method sets the tdriver test case memory at end
params
value: memory
returns
nil
raises
467 468 469 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 467 def set_tc_memory_amount_end(value) @tc_memory_amount_end=value end |
#set_tc_memory_amount_start(value) ⇒ Object
This method sets the tdriver test case memory at start
params
value: memory
returns
nil
raises
457 458 459 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 457 def set_tc_memory_amount_start(value) @tc_memory_amount_start=value end |
#set_tc_memory_amount_total(value) ⇒ Object
This method sets the tdriver test case total memory
params
value: memory
returns
nil
raises
477 478 479 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 477 def set_tc_memory_amount_total(value) @tc_memory_amount_total=value end |
#set_test_case_behaviour_log(value, test_case) ⇒ Object
This method sets the test case behaviour log
params
value: test case execution log entry
returns
nil
raises
328 329 330 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 328 def set_test_case_behaviour_log(value,test_case) @test_case_behaviour_log << [value.to_s,test_case] end |
#set_test_case_chronological_view_data(data) ⇒ Object
This method sets the users data to display in chronological table
params
value: test case user data
returns
nil
raises
318 319 320 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 318 def set_test_case_chronological_view_data(data) @test_case_chronological_view_data=data end |
#set_test_case_crash_files(value) ⇒ Object
This method sets the test case crash files
params
value: amount
returns
nil
raises
163 164 165 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 163 def set_test_case_crash_files(value) @test_case_crash_files=@test_case_crash_files.to_i+value.to_i end |
#set_test_case_end_time(value) ⇒ Object
This method sets the test case end time
params
value: test case end time
returns
nil
raises
258 259 260 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 258 def set_test_case_end_time(value) @test_case_end_time=value end |
#set_test_case_ended(value) ⇒ Object
This method sets the tdriver test case has ended
params
value: test cases report folder
returns
nil
raises
183 184 185 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 183 def set_test_case_ended(value) @test_case_ended=value end |
#set_test_case_execution_log(value, format = false) ⇒ Object
296 297 298 299 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 296 def set_test_case_execution_log(value,format=false) value=repalce_chars_to_html_format(value) if format==true @test_case_execution_log=@test_case_execution_log.to_s + '<br />' + value.to_s.gsub(/\n/,'<br />') end |
#set_test_case_folder(value) ⇒ Object
This method sets the tdriver test case report folder
params
value: test case report folder
returns
nil
raises
193 194 195 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 193 def set_test_case_folder(value) @test_case_folder=value end |
#set_test_case_group(value) ⇒ Object
This method sets the test case group
params
value: test case report folder
returns
nil
raises
143 144 145 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 143 def set_test_case_group(value) @test_case_group=value end |
#set_test_case_index(value) ⇒ Object
This method sets the test case index
params
value: test case index
returns
nil
raises
238 239 240 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 238 def set_test_case_index(value) @test_case_index=value end |
#set_test_case_name(value) ⇒ Object
This method sets the tdriver test case name
params
value: test case name
returns
nil
raises
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 213 def set_test_case_name(value) @test_case_name_full=value #Clean the test case name for unwanted chars stripped=value.gsub(/[<\/?*>!)(}{\\\#{@%"'.,:;~-]/,'').squeeze(" ") if stripped==nil then stripped=value.squeeze(" ") end stripped1 = stripped.to_s.gsub(' ','_') if stripped1==nil stripped1=stripped end str = stripped1.slice(0, 100) if str == nil str=stripped1 end stripped1=str @test_case_name=stripped1.to_s end |
#set_test_case_name_full(value) ⇒ Object
This method sets the tdriver test case name
params
value: test case name
returns
nil
raises
203 204 205 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 203 def set_test_case_name_full(value) @test_case_name_full=value end |
#set_test_case_reboots(value) ⇒ Object
This method sets the test case reboots
params
value: amount
returns
nil
raises
153 154 155 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 153 def set_test_case_reboots(value) @test_case_reboots=@test_case_reboots.to_i+value.to_i end |
#set_test_case_run_time(value) ⇒ Object
This method sets the test case run time
params
value: test case run time
returns
nil
raises
268 269 270 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 268 def set_test_case_run_time(value) @test_case_run_time=value end |
#set_test_case_start_time(value) ⇒ Object
This method sets the test case start time
params
value: test case start time
returns
nil
raises
248 249 250 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 248 def set_test_case_start_time(value) @test_case_start_time=value end |
#set_test_case_status(value) ⇒ Object
This method sets the test case status
params
value: test case status
returns
nil
raises
278 279 280 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 278 def set_test_case_status(value) @test_case_status=value end |
#set_test_case_user_data(data, columns) ⇒ Object
This method sets the test case user data
params
value: test case user data
returns
nil
raises
307 308 309 310 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 307 def set_test_case_user_data(data,columns) @test_case_user_data=data @test_case_user_data_columns=columns end |
#set_test_cases_folder(value) ⇒ Object
This method sets the tdriver test cases report folder
params
value: test cases report folder
returns
nil
raises
173 174 175 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 173 def set_test_cases_folder(value) @test_cases_folder=value end |
#start_video_recording(rec_name, previous_name) ⇒ Object
This methods sets video recording of the test case
params
rec_name: String, name of video file to create previous_name: String, name of video file of previous test case
returns
nil
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 362 def start_video_recording( rec_name, previous_name ) @tc_video_filename = rec_name @tc_previous_video_filename = previous_name tc_video_width = 640 tc_video_height = 480 tc_video_fps = 30 tc_max_time = '99:00:00' begin tc_video_width = $parameters[ :report_video_width ].to_i rescue # parameter not loaded, do nothing end begin tc_video_height = $parameters[ :report_video_height ].to_i rescue # parameter not loaded, do nothing end begin tc_video_fps = $parameters[ :report_video_fps ].to_i rescue # parameter not loaded, do nothing end begin tc_max_time = $parameters[ :report_video_max_time ].to_i rescue # parameter not loaded, do nothing end @tc_video_recorders = [] begin each_video_device do | video_device, device_index | = { :width => tc_video_width, :height => tc_video_height, :fps => tc_video_fps } [ :device ] = video_device unless video_device == "true" # use default device if "true" video_recorder = MobyUtil::TDriverCam.new_cam( tdriver_report_folder() + "/cam_" + device_index + "_" + @tc_video_filename, ) video_recorder.start_recording @tc_video_recorders << video_recorder @tc_video_recording = true end rescue Exception => e # make sure to stop any started cams if startup fails stop_video_recording raise e end nil end |
#stop_video_recording ⇒ Object
440 441 442 443 444 445 446 447 448 449 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 440 def stop_video_recording() @tc_video_recorders.each do | video_recorder | video_recorder.stop_recording end @tc_video_recording = false end |
#target_video_alive ⇒ Object
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 418 def target_video_alive ret = "" each_video_device do | video_device, device_index | check_fps = $parameters[:report_activity_fps, '3'] check_frame_min = $parameters[:report_activity_frame_treshold, '8'] check_video_min = $parameters[:report_activity_video_treshold, '29'] ret_n = MobyUtil.video_alive? tdriver_report_folder() + "/cam_" + device_index + "_" + @tc_video_filename, check_fps.to_f, check_frame_min.to_f, check_video_min.to_f, false if !ret_n ret += ", " if !ret.empty? ret += tdriver_report_folder() + "/cam_" + device_index + "_" + @tc_video_filename end end return ret end |
#update_test_case_page(rewrite = false) ⇒ Object
This method updates the tdrivertest case details page
params
nil
returns
nil
raises
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 488 def update_test_case_page(rewrite=false) begin #Calculate run time @test_case_run_time=Time.now-@test_case_start_time #make sure that test case folder exists: if File::directory?(@test_case_folder)==false FileUtils.mkdir_p @test_case_folder end write_page_start(@test_case_folder+'/index.html',@test_case_name) write_test_case_body(@test_case_folder+'/index.html', @test_case_name_full, @test_case_start_time, @test_case_end_time, @test_case_run_time, @test_case_status, @test_case_index, @test_case_folder, @capture_screen_error, @failed_dump_error, @test_case_reboots, @test_case_total_dump_count, @test_case_total_data_sent, @test_case_total_data_received ) write_page_end(@test_case_folder+'/index.html') rescue Exception => e raise e end return nil end |
#video_recording? ⇒ Boolean
721 722 723 |
# File 'lib/tdriver/report/report_test_case_run.rb', line 721 def video_recording? @tc_video_recording end |