Module: TestEngine
- Defined in:
- lib/utils/test_engine.rb
Overview
Created on 20 Sept 2017 @author: Andy Perrett
Versions: 1.0 - Baseline
test_engine.rb - controls the iteration through the test suite and specs
Class Method Summary collapse
-
.process_testfiles ⇒ Object
process the test files to execute the tests.
Class Method Details
.process_testfiles ⇒ Object
process the test files to execute the tests
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/utils/test_engine.rb', line 14 def self.process_testfiles # get the overall test start time $test_start_time = Report.current_time # loop through all the available test files to execute the tests Parser.test_files.each_with_index do |test_file_name, test_file_index| begin # read in the test data tests = Parser.read_test_data(test_file_name) # if unable to read the test data, show the error and move onto the # next file (if there is one) rescue StandardError => e MyLog.log.warn 'Terminating the current test spec: ' \ "#{test_file_name} #{e}" MyLog.log.info '...continuing with the next test file (if there is one)' end # create project folders - these only need creating once per test suite CreateDirectories.construct_projectdirs # get the test case start time $test_case_start_time = Report.current_time # initialise the test end time $test_case_end_time = Report.current_time begin tests['steps'].each_with_index do |test_step, test_step_idx| test_step_idx += 1 parsed_steps = Parser.parse_test_step_data(test_step) # process the test step data TestSteps.process_test_steps(test_file_name, test_step_idx, parsed_steps) # see if screenshot required Screenshot.save_screenshot(parsed_steps[:screenShotData], test_step_idx) end rescue TafError => e warn e MyLog.log.warn e end # get the test case end time $test_case_end_time = Report.current_time # output the test results summary for the current test case, # pass in the test file number to save the summary against it's testfile ReportSummary.test_step_summary(test_file_name, test_file_index) JunitReport.test_step_summary_xml(test_file_name, test_file_index) # close the browser if created Browser.b.quit # record total passes and failures and reset the failure counters for # the test steps $totalTestPasses += $testStepPasses $totalTestFailures += $testStepFailures $totalTestNotrun += $testStepNotrun $testStepPasses = 0 $testStepFailures = 0 $testStepNotrun = 0 end end |