Class: ReportCombine

Inherits:
Object show all
Defined in:
lib/tdriver/report/report_combine.rb

Direct Known Subclasses

TDriverReportCreator::TestRun

Instance Method Summary collapse

Instance Method Details

#combine_results(reports) ⇒ Object

This method combines previous test results with the current test execution

params

status: last run test case

returns

nil

raises



79
80
81
82
83
84
# File 'lib/tdriver/report/report_combine.rb', line 79

def combine_results(reports)
  report_locations_arr=reports.split(',')
  report_locations_arr.each do |report_location|
    extract_results_from_directory(report_location)
  end
end

#copy_results_from_directory(report_dir) ⇒ Object

This method combines previous test results with the current test execution

params

status: last run test case

returns

nil

raises



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
# File 'lib/tdriver/report/report_combine.rb', line 32

def copy_results_from_directory(report_dir)
  current_working_dir=Dir.getwd
  if File::directory?(report_dir)==true
     #FileUtils.cp_r report_dir, @report_folder
     FileUtils.cp_r report_dir+'/cases', @report_folder
     FileUtils.copy(report_dir+'/failed_cases.xml',@report_folder+'/failed_cases.xml') if File.exist?(report_dir+'/failed_cases.xml')
     FileUtils.copy(report_dir+'/passed_cases.xml',@report_folder+'/passed_cases.xml') if File.exist?(report_dir+'/passed_cases.xml')
     FileUtils.copy(report_dir+'/all_cases.xml',@report_folder+'/all_cases.xml') if File.exist?(report_dir+'/all_cases.xml')
     FileUtils.copy(report_dir+'/not_run_cases.xml',@report_folder+'/not_run_all_cases.xml') if File.exist?(report_dir+'/not_run_cases.xml')
  end
  Dir.chdir(report_dir+'/cases')
  executed_tests=Dir['*/']

  @total_passed=read_result_storage('passed').count
  @total_failed=read_result_storage('failed').count
  @total_not_run=read_result_storage('not_run').count
  @total_run=read_result_storage('all').count
  
  $test_case_run_index+=executed_tests.count.to_i
  
  report_arr=report_dir.split( /[\/|\\]+/)      
  #include folder in to the current run
  @attached_test_reports << report_arr.last

  Dir.chdir(current_working_dir)
end

#extract_results_from_directory(report_dir) ⇒ Object

This copies and reads the previous results data

params

status: last run test case

returns

nil

raises



66
67
68
69
70
# File 'lib/tdriver/report/report_combine.rb', line 66

def extract_results_from_directory(report_dir)      
  if File::directory?(report_dir)==true
    copy_results_from_directory(report_dir)
  end
end