taf 0.3.7 → 0.3.8
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.
- checksums.yaml +4 -4
- data/bin/taf +23 -2
- data/lib/taf.rb +48 -0
- data/lib/taf/browser.rb +103 -0
- data/lib/taf/cmd_line.rb +74 -0
- data/lib/taf/create_directories.rb +53 -0
- data/lib/taf/json_parser.rb +48 -0
- data/lib/taf/junit_report.rb +73 -0
- data/lib/taf/my_log.rb +21 -0
- data/lib/taf/parser.rb +37 -0
- data/lib/taf/report.rb +110 -0
- data/lib/taf/report_summary.rb +56 -0
- data/lib/taf/screenshot.rb +30 -0
- data/lib/taf/test_engine.rb +82 -0
- data/lib/taf/test_steps.rb +38 -0
- data/lib/taf/test_steps/handlers/base.rb +90 -0
- data/lib/taf/test_steps/handlers/base/browser_back.rb +21 -0
- data/lib/taf/test_steps/handlers/base/browser_forward.rb +21 -0
- data/lib/taf/test_steps/handlers/base/browser_open.rb +21 -0
- data/lib/taf/test_steps/handlers/base/browser_quit.rb +21 -0
- data/lib/taf/test_steps/handlers/base/browser_refresh.rb +21 -0
- data/lib/taf/test_steps/handlers/base/capture_alert.rb +22 -0
- data/lib/taf/test_steps/handlers/base/check_box.rb +22 -0
- data/lib/taf/test_steps/handlers/base/check_boxdata.rb +35 -0
- data/lib/taf/test_steps/handlers/base/check_browser_title.rb +21 -0
- data/lib/taf/test_steps/handlers/base/check_logs.rb +25 -0
- data/lib/taf/test_steps/handlers/base/check_screendata.rb +23 -0
- data/lib/taf/test_steps/handlers/base/check_url.rb +22 -0
- data/lib/taf/test_steps/handlers/base/click_button.rb +33 -0
- data/lib/taf/test_steps/handlers/base/execute_system_command.rb +23 -0
- data/lib/taf/test_steps/handlers/base/handle_browser_window.rb +23 -0
- data/lib/taf/test_steps/handlers/base/ipause.rb +21 -0
- data/lib/taf/test_steps/handlers/base/list_all_dropdowns_values.rb +23 -0
- data/lib/taf/test_steps/handlers/base/login.rb +59 -0
- data/lib/taf/test_steps/handlers/base/open_url.rb +22 -0
- data/lib/taf/test_steps/handlers/base/ping_test.rb +27 -0
- data/lib/taf/test_steps/handlers/base/radio_button.rb +24 -0
- data/lib/taf/test_steps/handlers/base/select_dropdown.rb +24 -0
- data/lib/taf/test_steps/handlers/base/send_special_keys.rb +22 -0
- data/lib/taf/test_steps/handlers/base/write_box_data.rb +35 -0
- data/lib/taf/version.rb +5 -0
- metadata +41 -43
- data/lib/functions/handlers.rb +0 -6
- data/lib/functions/handlers/base_handler.rb +0 -91
- data/lib/functions/handlers/browser_back.rb +0 -21
- data/lib/functions/handlers/browser_forward.rb +0 -21
- data/lib/functions/handlers/browser_quit.rb +0 -21
- data/lib/functions/handlers/browser_refresh.rb +0 -21
- data/lib/functions/handlers/capture_alert.rb +0 -22
- data/lib/functions/handlers/check_box.rb +0 -21
- data/lib/functions/handlers/check_boxdata.rb +0 -35
- data/lib/functions/handlers/check_browser_title.rb +0 -21
- data/lib/functions/handlers/check_logs.rb +0 -23
- data/lib/functions/handlers/check_screendata.rb +0 -21
- data/lib/functions/handlers/check_url.rb +0 -22
- data/lib/functions/handlers/click_button.rb +0 -33
- data/lib/functions/handlers/execute_system_command.rb +0 -23
- data/lib/functions/handlers/handle_browser_window.rb +0 -23
- data/lib/functions/handlers/ipause.rb +0 -21
- data/lib/functions/handlers/list_all_dropdowns_values.rb +0 -23
- data/lib/functions/handlers/login.rb +0 -59
- data/lib/functions/handlers/open_url.rb +0 -35
- data/lib/functions/handlers/ping_test.rb +0 -27
- data/lib/functions/handlers/radio_button.rb +0 -22
- data/lib/functions/handlers/select_dropdown.rb +0 -24
- data/lib/functions/handlers/send_special_keys.rb +0 -22
- data/lib/functions/handlers/write_box_data.rb +0 -35
- data/lib/main.rb +0 -31
- data/lib/parser/json_parser.rb +0 -50
- data/lib/parser/parser.rb +0 -49
- data/lib/report/junit_report.rb +0 -74
- data/lib/report/report.rb +0 -116
- data/lib/report/report_summary.rb +0 -53
- data/lib/taf_config.rb +0 -46
- data/lib/utils/browser.rb +0 -98
- data/lib/utils/cmd_line.rb +0 -71
- data/lib/utils/create_directories.rb +0 -50
- data/lib/utils/exceptions.rb +0 -7
- data/lib/utils/logger.rb +0 -21
- data/lib/utils/screenshot.rb +0 -30
- data/lib/utils/test_engine.rb +0 -77
- data/lib/utils/test_steps.rb +0 -38
- data/lib/version.rb +0 -21
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base_handler'
|
4
|
-
|
5
|
-
module TestSteps
|
6
|
-
module Handlers
|
7
|
-
# Select Dropdown function.
|
8
|
-
class SelectDropdown < Base
|
9
|
-
register :select_dropdown
|
10
|
-
|
11
|
-
def perform
|
12
|
-
ele = Browser.b.select_list("#{@locate}": @value)
|
13
|
-
|
14
|
-
ele.wait_until(&:exists?)
|
15
|
-
ele.option("#{@locate2}": @value2.to_s).select
|
16
|
-
MyLog.log.info("Dropdown item: #{@value2} has been selected")
|
17
|
-
true
|
18
|
-
rescue StandardError
|
19
|
-
MyLog.log.warn("Dropdown item: #{@value2} has NOT been selected")
|
20
|
-
false
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base_handler'
|
4
|
-
|
5
|
-
module TestSteps
|
6
|
-
module Handlers
|
7
|
-
# Send a Special Key function.
|
8
|
-
class SendSpecialKeys < Base
|
9
|
-
register :send_special_keys
|
10
|
-
|
11
|
-
def perform
|
12
|
-
Browser.b.send_keys :"#{@value}"
|
13
|
-
sleep 1
|
14
|
-
MyLog.log.info("Browser Sent key: :#{@value} successfully")
|
15
|
-
true
|
16
|
-
rescue StandardError
|
17
|
-
MyLog.log.warn("Browser Failed to Send key: :#{@value}")
|
18
|
-
false
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base_handler'
|
4
|
-
|
5
|
-
module TestSteps
|
6
|
-
module Handlers
|
7
|
-
# Write box data function.
|
8
|
-
class WriteBoxdata < Base
|
9
|
-
register :write_box_data
|
10
|
-
|
11
|
-
def perform
|
12
|
-
txt = @value2
|
13
|
-
txt = ENV[txt.to_s] if ENV[txt.to_s]
|
14
|
-
elms = %i[textarea text_field iframe]
|
15
|
-
|
16
|
-
found_box = elms.map do |elm|
|
17
|
-
Browser.b.send(elm, "#{@locate}": @value).exists?
|
18
|
-
end.compact
|
19
|
-
|
20
|
-
raise 'Multiple matches' if found_box.select { |i| i }.empty?
|
21
|
-
|
22
|
-
index = found_box.index(true)
|
23
|
-
return unless index
|
24
|
-
|
25
|
-
Browser.b.send(elms[index], "#{@locate}": @value)
|
26
|
-
.wait_until(&:exists?).send_keys txt
|
27
|
-
MyLog.log.info("Textbox: #{@value} has correct value: #{txt}")
|
28
|
-
true
|
29
|
-
rescue StandardError
|
30
|
-
MyLog.log.warn("Textbox: #{@value} does not exist")
|
31
|
-
false
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
data/lib/main.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Created on 20 Sept 2017
|
4
|
-
# @author: Andy Perrett
|
5
|
-
#
|
6
|
-
# Versions:
|
7
|
-
# 1.0 - Baseline
|
8
|
-
#
|
9
|
-
# main.rb - Framework Driver Script
|
10
|
-
module Main
|
11
|
-
require_relative './taf_config.rb'
|
12
|
-
|
13
|
-
# parses the cmd line imput into the taf
|
14
|
-
CMDLine.cmdline_input
|
15
|
-
|
16
|
-
# get the overall test suite end time
|
17
|
-
ts_start_time = Report.current_time
|
18
|
-
|
19
|
-
# process the test files to execute the tests
|
20
|
-
total_passes, total_failures, total_skipped = TestEngine.process_testfiles
|
21
|
-
total_metrics = [total_passes, total_failures, total_skipped]
|
22
|
-
# get the overall test suite end time
|
23
|
-
ts_end_time = Report.current_time
|
24
|
-
|
25
|
-
# output the overall test summary
|
26
|
-
ReportSummary.overall_test_summary(ts_start_time, ts_end_time, total_metrics)
|
27
|
-
JunitReport.test_summary_junit(ts_start_time, ts_end_time, total_metrics)
|
28
|
-
|
29
|
-
# Exit status code.
|
30
|
-
Process.exit(total_failures.zero? ? 0 : 1)
|
31
|
-
end
|
data/lib/parser/json_parser.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Created on 02 Aug 2018
|
4
|
-
# @author: Andy Perrett
|
5
|
-
#
|
6
|
-
# Versions:
|
7
|
-
# 1.0 - Baseline
|
8
|
-
#
|
9
|
-
# json_parser.rb - json parser functions
|
10
|
-
module JsonParser
|
11
|
-
require_relative '../taf_config.rb'
|
12
|
-
|
13
|
-
def self.parse_test_header_data(parse_json)
|
14
|
-
# get the number of test steps in the file
|
15
|
-
number_test_steps = parse_json['steps'].count
|
16
|
-
# get the remaining test data
|
17
|
-
@test_id = parse_json['testId']
|
18
|
-
@project_id = parse_json['projectId']
|
19
|
-
test_des = parse_json['testDescription']
|
20
|
-
MyLog.log.info "Number of test steps: #{number_test_steps}"
|
21
|
-
MyLog.log.info "Test Description: #{test_des}"
|
22
|
-
MyLog.log.info "TestID: #{@test_id} \n"
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.test_id
|
26
|
-
@test_id
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.project_id
|
30
|
-
@project_id
|
31
|
-
end
|
32
|
-
|
33
|
-
# parseTestStepData
|
34
|
-
def self.parse_test_step_data(parse_json)
|
35
|
-
parsed_step = {
|
36
|
-
testdesc: parse_json['description'],
|
37
|
-
testFunction: parse_json['function'].downcase,
|
38
|
-
testvalue: parse_json['value0'],
|
39
|
-
locate: parse_json['value1'] || 'id',
|
40
|
-
testvalue2: parse_json['value2'],
|
41
|
-
locate2: parse_json['value3'] || 'id',
|
42
|
-
skipTestCase: parse_json['skipTestCase'] == 'yes'
|
43
|
-
}
|
44
|
-
|
45
|
-
parsed_step
|
46
|
-
# if an error reading the test step data then re-raise the exception
|
47
|
-
rescue StandardError => e
|
48
|
-
raise e
|
49
|
-
end
|
50
|
-
end
|
data/lib/parser/parser.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Created on 02 Aug 2018
|
4
|
-
# @author: Andy Perrett
|
5
|
-
#
|
6
|
-
# Versions:
|
7
|
-
# 1.0 - Baseline
|
8
|
-
#
|
9
|
-
# parser.rb - basic parser functions
|
10
|
-
module Parser
|
11
|
-
require_relative '../taf_config.rb'
|
12
|
-
|
13
|
-
def self.test_files
|
14
|
-
@test_files ||= Dir.glob("#{CMDLine.tests_folder}/*.json").reject do |file|
|
15
|
-
File.basename(file).start_with?('~$')
|
16
|
-
end.sort
|
17
|
-
end
|
18
|
-
|
19
|
-
# readTestData
|
20
|
-
def self.read_test_data(test_file_name)
|
21
|
-
# get the file type
|
22
|
-
file_type = File.extname(test_file_name)
|
23
|
-
if file_type.casecmp('.json').zero?
|
24
|
-
MyLog.log.info "Processing test file: #{test_file_name}"
|
25
|
-
json = File.read(test_file_name)
|
26
|
-
parse_json = JSON.parse(json)
|
27
|
-
|
28
|
-
JsonParser.parse_test_header_data(parse_json)
|
29
|
-
return parse_json
|
30
|
-
else
|
31
|
-
# if unable to read the test file list then construct a custom error
|
32
|
-
# message and raise an exception.
|
33
|
-
MyLog.log.info 'Not a valid JSON File Type' if test_file_name != 'JSON'
|
34
|
-
error_to_display = "Test File Name: '#{test_file_name}' " \
|
35
|
-
'type not recognised (must be .xslx or .json)'
|
36
|
-
raise IOError, error_to_display
|
37
|
-
end
|
38
|
-
|
39
|
-
# if an error occurred reading the test file list then
|
40
|
-
# re-raise the exception.
|
41
|
-
rescue StandardError => e
|
42
|
-
raise IOError, e
|
43
|
-
end
|
44
|
-
|
45
|
-
# parseTestStepData
|
46
|
-
def self.parse_test_step_data(parse_json)
|
47
|
-
JsonParser.parse_test_step_data(parse_json)
|
48
|
-
end
|
49
|
-
end
|
data/lib/report/junit_report.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Created on 20 Sept 2017
|
4
|
-
# @author: Andy Perrett
|
5
|
-
#
|
6
|
-
# Versions:
|
7
|
-
# 1.0 - Baseline
|
8
|
-
#
|
9
|
-
# junit_report.rb - methods for writing to the summary xml junit report.
|
10
|
-
module JunitReport
|
11
|
-
require_relative '../taf_config.rb'
|
12
|
-
# holds printable test report summary for all the executed tests
|
13
|
-
@test_step_report_summary2 = []
|
14
|
-
# construct the test suite header for junit
|
15
|
-
def self.test_step_summary_xml(test_file_name, test_file_name_index,
|
16
|
-
tc_start, tc_end, metrics)
|
17
|
-
number_test_steps = [metrics.stepFailures, metrics.stepPasses,
|
18
|
-
metrics.stepSkipped].sum
|
19
|
-
@test_step_report_summary2[test_file_name_index] = {
|
20
|
-
'classname' => test_file_name,
|
21
|
-
'name' => test_file_name,
|
22
|
-
'assertions' => number_test_steps,
|
23
|
-
'failures' => metrics.stepFailures,
|
24
|
-
'tests' => metrics.stepPasses,
|
25
|
-
'skipped' => metrics.stepSkipped,
|
26
|
-
'time' => TimeDifference.between(
|
27
|
-
tc_end, tc_start
|
28
|
-
).in_seconds
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.test_summary_junit(ts_start_time, ts_end_time, total_metrics)
|
33
|
-
# output to XML file format for Junit for CI.
|
34
|
-
builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
|
35
|
-
testsuite_attrs = {
|
36
|
-
'classname' => CMDLine.tests_folder.to_s,
|
37
|
-
'name' => CMDLine.tests_folder.to_s,
|
38
|
-
'tests' => total_metrics[0].to_s,
|
39
|
-
'failures' => total_metrics[1].to_s,
|
40
|
-
'timestamp' => ts_start_time.to_s,
|
41
|
-
'skipped' => total_metrics[2].to_s,
|
42
|
-
'time' => TimeDifference.between(ts_end_time, ts_start_time)
|
43
|
-
.in_seconds
|
44
|
-
}
|
45
|
-
xml.testsuites(testsuite_attrs) do |testsuites|
|
46
|
-
@test_step_report_summary2.each do |test_step_report_summary2|
|
47
|
-
testsuites.testsuite(test_step_report_summary2) do |testsuite|
|
48
|
-
$testStep_xml[test_step_report_summary2['name']]
|
49
|
-
.each do |test_step_idx, test_step_xml|
|
50
|
-
testsuite.testcase(test_step_xml) do |testcase|
|
51
|
-
failure = $failtestStep_xml
|
52
|
-
&.[](test_step_report_summary2['name'])&.[](test_step_idx)
|
53
|
-
skipped = $skiptestStep_xml
|
54
|
-
&.[](test_step_report_summary2['name'])&.[](test_step_idx)
|
55
|
-
testcase.failure(failure) if failure
|
56
|
-
testcase.skipped(skipped) if skipped
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
# the test suite summary is a XML report generated will be called
|
65
|
-
# 'report_uuid.xml'
|
66
|
-
project_id = JsonParser.project_id.delete(' ')
|
67
|
-
xml_dir = File.join('Results', project_id)
|
68
|
-
ts_xml_file = "#{xml_dir}/report_#{SecureRandom.uuid}.xml"
|
69
|
-
|
70
|
-
ts_summary_file_xml = File.open(ts_xml_file, 'w')
|
71
|
-
ts_summary_file_xml.write builder.to_xml
|
72
|
-
ts_summary_file_xml.close
|
73
|
-
end
|
74
|
-
end
|
data/lib/report/report.rb
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Created on 20 Sept 2017
|
4
|
-
# @author: Andy Perrett
|
5
|
-
#
|
6
|
-
# Versions:
|
7
|
-
# 1.0 - Baseline
|
8
|
-
#
|
9
|
-
# report.rb - methods for outputting console.
|
10
|
-
module Report
|
11
|
-
require_relative '../taf_config.rb'
|
12
|
-
|
13
|
-
# get the current time in the format Day - Month - Date - Time (HH:MM:SS)
|
14
|
-
def self.current_time
|
15
|
-
Time.new.strftime('%a %b %d %H:%M:%S %Z')
|
16
|
-
end
|
17
|
-
|
18
|
-
# print the test Step info to the test results file
|
19
|
-
def self.print_test_step_header(test_file_name, test_step_idx, test_desc)
|
20
|
-
@test_start_time = current_time
|
21
|
-
MyLog.log.info "Test step: #{test_step_idx} : #{test_desc}"
|
22
|
-
|
23
|
-
step = {
|
24
|
-
'id' => test_step_idx,
|
25
|
-
'classname' => "SuiteID: #{JsonParser.test_id}" \
|
26
|
-
" Test Step: #{test_step_idx} #{test_desc}",
|
27
|
-
'name' => test_desc,
|
28
|
-
'file' => test_file_name
|
29
|
-
}
|
30
|
-
# output to console to show test step
|
31
|
-
# puts step
|
32
|
-
|
33
|
-
return unless test_file_name
|
34
|
-
|
35
|
-
$testStep_xml ||= {}
|
36
|
-
$testStep_xml[test_file_name] ||= {}
|
37
|
-
$testStep_xml[test_file_name][test_step_idx] = step
|
38
|
-
end
|
39
|
-
|
40
|
-
# print the Pass / Fail status of a test to the test results file
|
41
|
-
def self.test_pass_fail(pass_fail, test_file_name, test_step_idx, metrics)
|
42
|
-
if pass_fail == true
|
43
|
-
@current_test_fail = false
|
44
|
-
metrics.stepPasses += 1
|
45
|
-
MyLog.log.info "Test #{test_step_idx} has Passed ".green
|
46
|
-
elsif pass_fail == false
|
47
|
-
@current_test_fail = true
|
48
|
-
metrics.stepFailures += 1
|
49
|
-
MyLog.log.info "Test #{test_step_idx} has FAILED ".red
|
50
|
-
sc_file_name = Screenshot.save_screenshot(test_step_idx)
|
51
|
-
failstep = {
|
52
|
-
'message' => "SuiteID: #{JsonParser.test_id}" \
|
53
|
-
" Test Step: #{test_step_idx} Test has" \
|
54
|
-
" FAILED - Check logs, see Screenshot: #{sc_file_name}",
|
55
|
-
'type' => 'FAILURE',
|
56
|
-
'file' => test_file_name
|
57
|
-
}
|
58
|
-
# output to console to show test step failure
|
59
|
-
# puts failstep
|
60
|
-
|
61
|
-
return unless test_file_name
|
62
|
-
|
63
|
-
$failtestStep_xml ||= {}
|
64
|
-
$failtestStep_xml[test_file_name] ||= []
|
65
|
-
$failtestStep_xml[test_file_name][test_step_idx] = failstep
|
66
|
-
else
|
67
|
-
@current_test_fail = false
|
68
|
-
metrics.stepSkipped += 1
|
69
|
-
MyLog.log.info "Test #{test_step_idx} no checks performed ".blue
|
70
|
-
skipstep = {
|
71
|
-
'message' => "SuiteID: #{JsonParser.test_id}" \
|
72
|
-
" Test Step: #{test_step_idx} No" \
|
73
|
-
' checks performed - Check logs',
|
74
|
-
'type' => 'SKIPPED',
|
75
|
-
'file' => test_file_name
|
76
|
-
}
|
77
|
-
# output to console to show test step failure
|
78
|
-
# puts skipstep
|
79
|
-
|
80
|
-
return unless test_file_name
|
81
|
-
|
82
|
-
$skiptestStep_xml ||= {}
|
83
|
-
$skiptestStep_xml[test_file_name] ||= []
|
84
|
-
$skiptestStep_xml[test_file_name][test_step_idx] = skipstep
|
85
|
-
end
|
86
|
-
test_end_time = current_time
|
87
|
-
|
88
|
-
test_duration = TimeDifference.between(
|
89
|
-
test_end_time, @test_start_time
|
90
|
-
).humanize || 0
|
91
|
-
MyLog.log.info "Test step duration: #{test_duration} \n"
|
92
|
-
end
|
93
|
-
|
94
|
-
# check if the test failure threshold has been reached for total failures
|
95
|
-
# or consecutive failures.
|
96
|
-
# If a certain number of consecutive tests fail then throw an exception
|
97
|
-
def self.check_failure_threshold(test_file_name)
|
98
|
-
consecutive_fail_threshold = 5
|
99
|
-
if @current_test_fail
|
100
|
-
@consecutive_test_fail += 1
|
101
|
-
else
|
102
|
-
@consecutive_test_fail = 0
|
103
|
-
end
|
104
|
-
|
105
|
-
return if @consecutive_test_fail < consecutive_fail_threshold
|
106
|
-
|
107
|
-
# write info to stdout
|
108
|
-
MyLog.log.warn "Terminating the current test file: #{test_file_name} as" \
|
109
|
-
" the test failure threshold (#{@consecutive_test_fail}) has been" \
|
110
|
-
' reached.'
|
111
|
-
MyLog.log.warn '...continuing with the next test file (if there is one)'
|
112
|
-
|
113
|
-
raise FailureThresholdExceeded,
|
114
|
-
"test failure threshold (#{@consecutive_test_fail}) has been reached"
|
115
|
-
end
|
116
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Created on 20 Sept 2017
|
4
|
-
# @author: Andy Perrett
|
5
|
-
#
|
6
|
-
# Versions:
|
7
|
-
# 1.0 - Baseline
|
8
|
-
#
|
9
|
-
# report_summary.rb - methods for writing to the test summary report file
|
10
|
-
module ReportSummary
|
11
|
-
require_relative '../taf_config.rb'
|
12
|
-
# holds printable test report summary for all the executed tests
|
13
|
-
@test_step_report_summary = []
|
14
|
-
# output the test results summary for the current test case
|
15
|
-
def self.test_step_summary(test_file_name, test_file_name_index, metrics)
|
16
|
-
@test_step_report_summary[test_file_name_index] = <<~TEXT
|
17
|
-
Test file executed: #{test_file_name}
|
18
|
-
Browser Type: #{CMDLine.browser_type}
|
19
|
-
Browser Version: #{Browser.browser_version}
|
20
|
-
There are: #{metrics.stepPasses} Passes
|
21
|
-
There are: #{metrics.stepFailures} Failures
|
22
|
-
There are: #{metrics.stepSkipped} Skipped Tests \n
|
23
|
-
TEXT
|
24
|
-
end
|
25
|
-
|
26
|
-
# output the overall test results summary
|
27
|
-
def self.overall_test_summary(ts_start_time, ts_end_time, total_metrics)
|
28
|
-
# output to the console
|
29
|
-
|
30
|
-
MyLog.log.info 'Finished processing all test files ' \
|
31
|
-
"from the following test folder: #{CMDLine.tests_folder}"
|
32
|
-
MyLog.log.info "Overall Test Summary: \n"
|
33
|
-
@test_step_report_summary.each do |test_step_report_summary|
|
34
|
-
test_step_report_summary.each_line do |line|
|
35
|
-
MyLog.log.info(line.strip)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
duration = TimeDifference.between(
|
40
|
-
ts_end_time, ts_start_time
|
41
|
-
).humanize || 0
|
42
|
-
|
43
|
-
MyLog.log.info "Total Tests started at: #{ts_start_time}"
|
44
|
-
MyLog.log.info "Total Tests finished at: #{ts_end_time}"
|
45
|
-
MyLog.log.info "Total Tests duration: #{duration}"
|
46
|
-
MyLog.log.info "Total Tests Passed: #{total_metrics[0]}".green
|
47
|
-
MyLog.log.info "Total Tests Failed: #{total_metrics[1]}".red
|
48
|
-
MyLog.log.info "Total Tests Skipped: #{total_metrics[2]}".blue
|
49
|
-
total_tests = [total_metrics[0], total_metrics[1],
|
50
|
-
total_metrics[2]].sum
|
51
|
-
MyLog.log.info "Total Tests: #{total_tests}\n"
|
52
|
-
end
|
53
|
-
end
|