taf 0.3.8 → 0.3.9
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 +3 -4
- data/lib/taf/report.rb +27 -54
- data/lib/taf/report_summary.rb +2 -5
- data/lib/taf/tap_report.rb +80 -0
- data/lib/taf/test_engine.rb +1 -11
- data/lib/taf/test_steps/failure_step.rb +8 -0
- data/lib/taf/test_steps/handlers/base/check_boxdata.rb +9 -4
- data/lib/taf/test_steps/handlers/base/click_button.rb +9 -4
- data/lib/taf/test_steps/handlers/base/write_box_data.rb +11 -6
- data/lib/taf/test_steps/handlers/base.rb +1 -2
- data/lib/taf/test_steps/skip_step.rb +8 -0
- data/lib/taf/test_steps/step.rb +18 -0
- data/lib/taf/test_steps/success_step.rb +8 -0
- data/lib/taf/test_steps.rb +8 -2
- data/lib/taf/version.rb +1 -1
- data/lib/taf.rb +5 -2
- metadata +7 -17
- data/lib/taf/junit_report.rb +0 -73
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb63f2071b93028017fb466d80db1c21bef8f468788f6b3df344b3f9ba00b8ef
|
4
|
+
data.tar.gz: 8760a5584efe3a280b80f87886ce3e13511747f1226cf6501070529242b945d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96ca2091cfe212d6364c9b2da8ed5a3cdcd1f054a2ae4d600815fa49925c2a024a63fe8f4d596bb9c5dfc2d9da336b26d5b6c605c37903351c273019e939f3be
|
7
|
+
data.tar.gz: 061a360b6a1a4fb0ebfbcc197b1eba9b1ce019891643709f115907a11a447e96797e2e47a65524830d66197f44a1669136977c97f9f6125a55321a994a75951a
|
data/bin/taf
CHANGED
@@ -16,11 +16,10 @@ total_metrics = [total_passes, total_failures, total_skipped]
|
|
16
16
|
# get the overall test suite end time
|
17
17
|
ts_end_time = Taf::Report.current_time
|
18
18
|
|
19
|
+
total_time = TimeDifference.between(ts_end_time, ts_start_time).humanize || 0
|
19
20
|
# output the overall test summary
|
20
|
-
Taf::ReportSummary.overall_test_summary(
|
21
|
-
|
22
|
-
Taf::JUnitReport.test_summary_junit(ts_start_time, ts_end_time,
|
23
|
-
total_metrics)
|
21
|
+
Taf::ReportSummary.overall_test_summary(total_time, total_metrics)
|
22
|
+
Taf::TapReport.output
|
24
23
|
|
25
24
|
# Exit status code.
|
26
25
|
Process.exit(total_failures.zero? ? 0 : 1)
|
data/lib/taf/report.rb
CHANGED
@@ -11,78 +11,50 @@ module Taf
|
|
11
11
|
module Report
|
12
12
|
# get the current time in the format Day - Month - Date - Time (HH:MM:SS)
|
13
13
|
def self.current_time
|
14
|
-
|
14
|
+
require 'time'
|
15
|
+
# Time.new.strftime('%a %b %d %H:%M:%S %Z')
|
16
|
+
Time.new.xmlschema
|
15
17
|
end
|
16
18
|
|
17
19
|
# print the test Step info to the test results file
|
18
|
-
def self.print_test_step_header(
|
20
|
+
def self.print_test_step_header(test_step_idx, test_desc)
|
19
21
|
@test_start_time = current_time
|
20
22
|
Taf::MyLog.log.info "Test step: #{test_step_idx} : #{test_desc}"
|
21
|
-
|
22
|
-
step = { 'id' => test_step_idx,
|
23
|
-
'classname' => "SuiteID: #{Taf::JSONParser.test_id}" \
|
24
|
-
" Test Step: #{test_step_idx} #{test_desc}",
|
25
|
-
'name' => test_desc,
|
26
|
-
'file' => test_file_name }
|
27
|
-
|
28
|
-
# output to console to show test step
|
29
|
-
# puts step
|
30
|
-
|
31
|
-
return unless test_file_name
|
32
|
-
|
33
|
-
$testStep_xml ||= {}
|
34
|
-
$testStep_xml[test_file_name] ||= {}
|
35
|
-
$testStep_xml[test_file_name][test_step_idx] = step
|
36
23
|
end
|
37
24
|
|
38
25
|
# print the Pass / Fail status of a test to the test results file
|
39
|
-
def self.test_pass_fail(
|
40
|
-
|
26
|
+
def self.test_pass_fail(
|
27
|
+
pass_fail,
|
28
|
+
test_file_name,
|
29
|
+
test_step_idx,
|
30
|
+
test_step_description,
|
31
|
+
metrics
|
32
|
+
)
|
33
|
+
if pass_fail
|
34
|
+
Taf::MyLog.log.info "Test #{test_step_idx} has Passed ".green
|
41
35
|
@current_test_fail = false
|
42
36
|
metrics.stepPasses += 1
|
43
|
-
Taf::
|
37
|
+
Taf::TapReport.success(
|
38
|
+
test_file_name, test_step_idx, test_step_description
|
39
|
+
)
|
44
40
|
elsif pass_fail == false
|
41
|
+
Taf::MyLog.log.warn "Test #{test_step_idx} has FAILED ".red
|
42
|
+
Taf::Screenshot.save_screenshot(test_step_idx)
|
45
43
|
@current_test_fail = true
|
46
44
|
metrics.stepFailures += 1
|
47
|
-
Taf::
|
48
|
-
|
49
|
-
|
50
|
-
'message' => "SuiteID: #{Taf::JSONParser.test_id}" \
|
51
|
-
" Test Step: #{test_step_idx} Test has" \
|
52
|
-
" FAILED - Check logs, see Screenshot: #{sc_file_name}",
|
53
|
-
'type' => 'FAILURE',
|
54
|
-
'file' => test_file_name
|
55
|
-
}
|
56
|
-
# output to console to show test step failure
|
57
|
-
# puts failstep
|
58
|
-
|
59
|
-
return unless test_file_name
|
60
|
-
|
61
|
-
$failtestStep_xml ||= {}
|
62
|
-
$failtestStep_xml[test_file_name] ||= []
|
63
|
-
$failtestStep_xml[test_file_name][test_step_idx] = failstep
|
45
|
+
Taf::TapReport.failure(
|
46
|
+
test_file_name, test_step_idx, test_step_description
|
47
|
+
)
|
64
48
|
else
|
49
|
+
Taf::MyLog.log.info "Test #{test_step_idx} no checks performed ".blue
|
65
50
|
@current_test_fail = false
|
66
51
|
metrics.stepSkipped += 1
|
67
|
-
Taf::
|
68
|
-
|
69
|
-
|
70
|
-
" Test Step: #{test_step_idx} No" \
|
71
|
-
' checks performed - Check logs',
|
72
|
-
'type' => 'SKIPPED',
|
73
|
-
'file' => test_file_name
|
74
|
-
}
|
75
|
-
# output to console to show test step failure
|
76
|
-
# puts skipstep
|
77
|
-
|
78
|
-
return unless test_file_name
|
79
|
-
|
80
|
-
$skiptestStep_xml ||= {}
|
81
|
-
$skiptestStep_xml[test_file_name] ||= []
|
82
|
-
$skiptestStep_xml[test_file_name][test_step_idx] = skipstep
|
52
|
+
Taf::TapReport.skip(
|
53
|
+
test_file_name, test_step_idx, test_step_description
|
54
|
+
)
|
83
55
|
end
|
84
|
-
test_end_time = current_time
|
85
56
|
|
57
|
+
test_end_time = current_time
|
86
58
|
test_duration = TimeDifference.between(
|
87
59
|
test_end_time, @test_start_time
|
88
60
|
).humanize || 0
|
@@ -92,6 +64,7 @@ module Taf
|
|
92
64
|
# check if the test failure threshold has been reached for total failures
|
93
65
|
# or consecutive failures.
|
94
66
|
# If a certain number of consecutive tests fail then throw an exception
|
67
|
+
|
95
68
|
def self.check_failure_threshold(test_file_name)
|
96
69
|
consecutive_fail_threshold = 3
|
97
70
|
if @current_test_fail
|
data/lib/taf/report_summary.rb
CHANGED
@@ -39,13 +39,10 @@ module Taf
|
|
39
39
|
end
|
40
40
|
|
41
41
|
# output the overall test results summary
|
42
|
-
def self.overall_test_summary(
|
42
|
+
def self.overall_test_summary(total_time, total_metrics)
|
43
43
|
print_test_summary
|
44
|
-
t_time = TimeDifference.between(ts_end_time, ts_start_time).humanize || 0
|
45
44
|
|
46
|
-
Taf::MyLog.log.info "
|
47
|
-
Taf::MyLog.log.info "Total Tests finished at: #{ts_end_time}"
|
48
|
-
Taf::MyLog.log.info "Total Tests duration: #{t_time}"
|
45
|
+
Taf::MyLog.log.info "Toatal Duration: #{total_time}"
|
49
46
|
Taf::MyLog.log.info "Total Tests Passed: #{total_metrics[0]}".green
|
50
47
|
Taf::MyLog.log.info "Total Tests Failed: #{total_metrics[1]}".red
|
51
48
|
Taf::MyLog.log.info "Total Tests Skipped: #{total_metrics[2]}".blue
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Created on 13 June 2019
|
4
|
+
# @author: Andy Perrett
|
5
|
+
#
|
6
|
+
# Versions:
|
7
|
+
# 1.0 - Baseline
|
8
|
+
#
|
9
|
+
|
10
|
+
module Taf
|
11
|
+
# tap_report.rb - methods for outputting to a tap report file.
|
12
|
+
class TapReport
|
13
|
+
include Singleton
|
14
|
+
|
15
|
+
def self.success(filename, index, description)
|
16
|
+
step = Taf::TestSteps::SuccessStep.new(index: index,
|
17
|
+
description: description)
|
18
|
+
add_step filename, step
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.failure(filename, index, description)
|
22
|
+
step = Taf::TestSteps::FailureStep.new(index: index,
|
23
|
+
description: description)
|
24
|
+
add_step filename, step
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.skip(filename, index, description)
|
28
|
+
step = Taf::TestSteps::SkipStep.new(index: index,
|
29
|
+
description: description)
|
30
|
+
add_step filename, step
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.add_step(filename, step)
|
34
|
+
instance.tests[filename] ||= []
|
35
|
+
instance.tests[filename] << step
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.output
|
39
|
+
project_id = Taf::JSONParser.project_id.delete(' ')
|
40
|
+
ts_dir = File.join('Results', project_id)
|
41
|
+
file = File.open("#{ts_dir}/report_#{SecureRandom.uuid}.tap", 'w')
|
42
|
+
total_steps = 0
|
43
|
+
successes = 0
|
44
|
+
failures = 0
|
45
|
+
instance.tests.each do |filename, steps|
|
46
|
+
file.write("# #{filename}\n")
|
47
|
+
steps.each do |step|
|
48
|
+
total_steps += 1
|
49
|
+
if step.is_a?(Taf::TestSteps::SkipStep)
|
50
|
+
outstr = "ok #{total_steps} #{step.description} # SKIP"
|
51
|
+
else
|
52
|
+
if step.is_a?(Taf::TestSteps::SuccessStep)
|
53
|
+
outstr = 'ok'
|
54
|
+
successes += 1
|
55
|
+
elsif step.is_a?(Taf::TestSteps::FailureStep)
|
56
|
+
outstr = 'not ok'
|
57
|
+
failures += 1
|
58
|
+
else
|
59
|
+
outstr = '# test error'
|
60
|
+
end
|
61
|
+
outstr += " #{total_steps} #{step.description} - Step #{step.index}"
|
62
|
+
end
|
63
|
+
|
64
|
+
file.write(outstr + "\n")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
file.write("1..#{total_steps}\n")
|
68
|
+
file.write("# tests #{total_steps}\n")
|
69
|
+
file.write("# pass #{successes}\n")
|
70
|
+
file.write("# fail #{failures}\n")
|
71
|
+
file.close
|
72
|
+
end
|
73
|
+
|
74
|
+
def initialize
|
75
|
+
@tests = {}
|
76
|
+
end
|
77
|
+
|
78
|
+
attr_accessor :tests
|
79
|
+
end
|
80
|
+
end
|
data/lib/taf/test_engine.rb
CHANGED
@@ -35,9 +35,6 @@ module Taf
|
|
35
35
|
# create project folders - these only need creating once per test suite
|
36
36
|
Taf::CreateDirectories.construct_projectdirs
|
37
37
|
|
38
|
-
# get the test case start time
|
39
|
-
tc_start = Taf::Report.current_time
|
40
|
-
|
41
38
|
Taf::Browser.open_browser
|
42
39
|
|
43
40
|
begin
|
@@ -55,16 +52,9 @@ module Taf
|
|
55
52
|
Taf::MyLog.log.warn e
|
56
53
|
end
|
57
54
|
|
58
|
-
#
|
59
|
-
tc_end = Taf::Report.current_time
|
60
|
-
|
61
|
-
# output the test results summary for the current test case,
|
62
|
-
# pass in the test file number to save the summary against it's
|
63
|
-
# testfile
|
55
|
+
# output the test results summary to console
|
64
56
|
Taf::ReportSummary.test_step_summary(test_file_name, test_file_idx,
|
65
57
|
metrics)
|
66
|
-
Taf::JUnitReport.test_step_summary_xml(test_file_name, test_file_idx,
|
67
|
-
tc_start, tc_end, metrics)
|
68
58
|
|
69
59
|
# close the browser if created
|
70
60
|
Taf::Browser.b.quit
|
@@ -7,10 +7,10 @@ module Taf
|
|
7
7
|
class CheckBoxdata < Base
|
8
8
|
register :check_box_data
|
9
9
|
|
10
|
-
def
|
11
|
-
elms = %i[textarea text_field iframe]
|
10
|
+
def check
|
11
|
+
@elms = %i[textarea text_field iframe]
|
12
12
|
|
13
|
-
found_box = elms.map do |elm|
|
13
|
+
found_box = @elms.map do |elm|
|
14
14
|
Taf::Browser.b.send(elm, "#{@locate}": @value).exists?
|
15
15
|
end.compact
|
16
16
|
|
@@ -19,7 +19,12 @@ module Taf
|
|
19
19
|
index = found_box.index(true)
|
20
20
|
return unless index
|
21
21
|
|
22
|
-
|
22
|
+
index
|
23
|
+
end
|
24
|
+
|
25
|
+
def perform
|
26
|
+
index = check
|
27
|
+
ele = Taf::Browser.b.send(@elms[index], "#{@locate}": @value)
|
23
28
|
|
24
29
|
ele.wait_until(&:exists?)
|
25
30
|
(ele.value == @value2)
|
@@ -7,10 +7,10 @@ module Taf
|
|
7
7
|
class ClickButton < Base
|
8
8
|
register :click_button
|
9
9
|
|
10
|
-
def
|
11
|
-
elms = %i[button span a div link image h1 h2 h3 h4]
|
10
|
+
def check
|
11
|
+
@elms = %i[button span a div link image h1 h2 h3 h4]
|
12
12
|
|
13
|
-
found_button = elms.map do |elm|
|
13
|
+
found_button = @elms.map do |elm|
|
14
14
|
Taf::Browser.b.send(elm, "#{@locate}": @value).exists?
|
15
15
|
end.compact
|
16
16
|
|
@@ -19,7 +19,12 @@ module Taf
|
|
19
19
|
index = found_button.index(true)
|
20
20
|
return unless index
|
21
21
|
|
22
|
-
|
22
|
+
index
|
23
|
+
end
|
24
|
+
|
25
|
+
def perform
|
26
|
+
index = check
|
27
|
+
Taf::Browser.b.send(@elms[index], "#{@locate}": @value)
|
23
28
|
.wait_until(&:exists?).click
|
24
29
|
Taf::MyLog.log.info("Button: #{@value} has been selected")
|
25
30
|
true
|
@@ -7,12 +7,10 @@ module Taf
|
|
7
7
|
class WriteBoxdata < Base
|
8
8
|
register :write_box_data
|
9
9
|
|
10
|
-
def
|
11
|
-
|
12
|
-
txt = ENV[txt.to_s] if ENV[txt.to_s]
|
13
|
-
elms = %i[textarea text_field iframe]
|
10
|
+
def check
|
11
|
+
@elms = %i[textarea text_field iframe]
|
14
12
|
|
15
|
-
found_box = elms.map do |elm|
|
13
|
+
found_box = @elms.map do |elm|
|
16
14
|
Taf::Browser.b.send(elm, "#{@locate}": @value).exists?
|
17
15
|
end.compact
|
18
16
|
|
@@ -21,7 +19,14 @@ module Taf
|
|
21
19
|
index = found_box.index(true)
|
22
20
|
return unless index
|
23
21
|
|
24
|
-
|
22
|
+
index
|
23
|
+
end
|
24
|
+
|
25
|
+
def perform
|
26
|
+
txt = @value2
|
27
|
+
txt = ENV[txt.to_s] if ENV[txt.to_s]
|
28
|
+
index = check
|
29
|
+
Taf::Browser.b.send(@elms[index], "#{@locate}": @value)
|
25
30
|
.wait_until(&:exists?).send_keys txt
|
26
31
|
Taf::MyLog.log.info("Textbox: #{@value} has correct value: #{txt}")
|
27
32
|
true
|
@@ -25,8 +25,7 @@ module Taf
|
|
25
25
|
if Taf::Browser.b.title.eql?(b_title)
|
26
26
|
Taf::Browser.b.text_field(id: user_elm).wait_until(&:exists?)
|
27
27
|
.set user
|
28
|
-
Taf::Browser.b.text_field(id: pass_elm).
|
29
|
-
.set pass
|
28
|
+
Taf::Browser.b.text_field(id: pass_elm).set pass
|
30
29
|
button = 'Sign in' || 'Log in'
|
31
30
|
Taf::Browser.b.button(value: button).wait_until(&:exists?).click
|
32
31
|
sleep 1
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Taf
|
4
|
+
module TestSteps
|
5
|
+
# steps.rb - methods for collecting steps info for tap report file.
|
6
|
+
class Step
|
7
|
+
attr_reader :index, :description
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
index:,
|
11
|
+
description:
|
12
|
+
)
|
13
|
+
@index = index
|
14
|
+
@description = description
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/taf/test_steps.rb
CHANGED
@@ -18,7 +18,7 @@ module Taf
|
|
18
18
|
def self.process_test_steps(test_file_name, test_step_idx, step_attributes,
|
19
19
|
metrics)
|
20
20
|
# print the test step information
|
21
|
-
Taf::Report.print_test_step_header(
|
21
|
+
Taf::Report.print_test_step_header(test_step_idx,
|
22
22
|
step_attributes[:testdesc])
|
23
23
|
runtest = step_attributes[:skipTestCase]
|
24
24
|
step_function = step_attributes[:testFunction]
|
@@ -26,7 +26,13 @@ module Taf
|
|
26
26
|
|
27
27
|
if handler.respond_to?(:perform)
|
28
28
|
func = handler.perform(step_attributes) if runtest == false
|
29
|
-
Taf::Report.test_pass_fail(
|
29
|
+
Taf::Report.test_pass_fail(
|
30
|
+
func,
|
31
|
+
test_file_name,
|
32
|
+
test_step_idx,
|
33
|
+
step_attributes[:testdesc],
|
34
|
+
metrics
|
35
|
+
)
|
30
36
|
Taf::Report.check_failure_threshold(test_file_name)
|
31
37
|
return true
|
32
38
|
else
|
data/lib/taf/version.rb
CHANGED
data/lib/taf.rb
CHANGED
@@ -14,7 +14,6 @@ module Taf
|
|
14
14
|
require 'fileutils'
|
15
15
|
require 'logger'
|
16
16
|
require 'net/ping'
|
17
|
-
require 'nokogiri'
|
18
17
|
require 'time_difference'
|
19
18
|
require 'colored'
|
20
19
|
require 'optparse'
|
@@ -26,7 +25,7 @@ module Taf
|
|
26
25
|
require 'taf/cmd_line'
|
27
26
|
require 'taf/create_directories'
|
28
27
|
require 'taf/json_parser'
|
29
|
-
require 'taf/
|
28
|
+
require 'taf/tap_report'
|
30
29
|
require 'taf/my_log'
|
31
30
|
require 'taf/parser'
|
32
31
|
require 'taf/report'
|
@@ -34,6 +33,10 @@ module Taf
|
|
34
33
|
require 'taf/screenshot'
|
35
34
|
require 'taf/test_engine'
|
36
35
|
require 'taf/test_steps'
|
36
|
+
require 'taf/test_steps/step'
|
37
|
+
require 'taf/test_steps/success_step'
|
38
|
+
require 'taf/test_steps/failure_step'
|
39
|
+
require 'taf/test_steps/skip_step'
|
37
40
|
require 'taf/test_steps/handlers/base'
|
38
41
|
require 'taf/version'
|
39
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Perrett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '2.0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: nokogiri
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '1.8'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '1.8'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: rubygems-update
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,14 +164,15 @@ files:
|
|
178
164
|
- lib/taf/cmd_line.rb
|
179
165
|
- lib/taf/create_directories.rb
|
180
166
|
- lib/taf/json_parser.rb
|
181
|
-
- lib/taf/junit_report.rb
|
182
167
|
- lib/taf/my_log.rb
|
183
168
|
- lib/taf/parser.rb
|
184
169
|
- lib/taf/report.rb
|
185
170
|
- lib/taf/report_summary.rb
|
186
171
|
- lib/taf/screenshot.rb
|
172
|
+
- lib/taf/tap_report.rb
|
187
173
|
- lib/taf/test_engine.rb
|
188
174
|
- lib/taf/test_steps.rb
|
175
|
+
- lib/taf/test_steps/failure_step.rb
|
189
176
|
- lib/taf/test_steps/handlers/base.rb
|
190
177
|
- lib/taf/test_steps/handlers/base/browser_back.rb
|
191
178
|
- lib/taf/test_steps/handlers/base/browser_forward.rb
|
@@ -211,6 +198,9 @@ files:
|
|
211
198
|
- lib/taf/test_steps/handlers/base/select_dropdown.rb
|
212
199
|
- lib/taf/test_steps/handlers/base/send_special_keys.rb
|
213
200
|
- lib/taf/test_steps/handlers/base/write_box_data.rb
|
201
|
+
- lib/taf/test_steps/skip_step.rb
|
202
|
+
- lib/taf/test_steps/step.rb
|
203
|
+
- lib/taf/test_steps/success_step.rb
|
214
204
|
- lib/taf/version.rb
|
215
205
|
homepage: https://github.com/Aperrett/TAF
|
216
206
|
licenses:
|
data/lib/taf/junit_report.rb
DELETED
@@ -1,73 +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
|
-
module Taf
|
10
|
-
# junit_report.rb - methods for writing to the summary xml junit report.
|
11
|
-
module JUnitReport
|
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(tc_end, tc_start).in_seconds
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.test_summary_junit(ts_start_time, ts_end_time, total_metrics)
|
31
|
-
# output to XML file format for Junit for CI.
|
32
|
-
builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
|
33
|
-
testsuite_attrs = {
|
34
|
-
'classname' => Taf::CMDLine.tests_folder.to_s,
|
35
|
-
'name' => Taf::CMDLine.tests_folder.to_s,
|
36
|
-
'tests' => total_metrics[0].to_s,
|
37
|
-
'failures' => total_metrics[1].to_s,
|
38
|
-
'timestamp' => ts_start_time.to_s,
|
39
|
-
'skipped' => total_metrics[2].to_s,
|
40
|
-
'time' => TimeDifference.between(ts_end_time, ts_start_time)
|
41
|
-
.in_seconds
|
42
|
-
}
|
43
|
-
xml.testsuites(testsuite_attrs) do |testsuites|
|
44
|
-
@test_step_report_summary2.each do |test_step_report_summary2|
|
45
|
-
testsuites.testsuite(test_step_report_summary2) do |testsuite|
|
46
|
-
$testStep_xml[test_step_report_summary2['name']]
|
47
|
-
.each do |test_step_idx, test_step_xml|
|
48
|
-
testsuite.testcase(test_step_xml) do |testcase|
|
49
|
-
failure = $failtestStep_xml
|
50
|
-
&.[](test_step_report_summary2['name'])&.[](test_step_idx)
|
51
|
-
skipped = $skiptestStep_xml
|
52
|
-
&.[](test_step_report_summary2['name'])&.[](test_step_idx)
|
53
|
-
testcase.failure(failure) if failure
|
54
|
-
testcase.skipped(skipped) if skipped
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# the test suite summary is a XML report generated will be called
|
63
|
-
# 'report_uuid.xml'
|
64
|
-
project_id = Taf::JSONParser.project_id.delete(' ')
|
65
|
-
xml_dir = File.join('Results', project_id)
|
66
|
-
ts_xml_file = "#{xml_dir}/report_#{SecureRandom.uuid}.xml"
|
67
|
-
|
68
|
-
ts_summary_file_xml = File.open(ts_xml_file, 'w')
|
69
|
-
ts_summary_file_xml.write builder.to_xml
|
70
|
-
ts_summary_file_xml.close
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|