taf 0.3.0 → 0.3.1
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/lib/parser/json_parser.rb +0 -1
- data/lib/report/junit_report.rb +3 -3
- data/lib/report/report.rb +15 -16
- data/lib/utils/screenshot.rb +3 -3
- data/lib/utils/test_engine.rb +6 -3
- data/lib/utils/test_steps.rb +5 -7
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f83e07b3044b079bd0aac90bf52228be938e046613728c0594ef8b079b63c662
|
4
|
+
data.tar.gz: c2aa622d24653df88fcf322d301598cdbd84a5c2a7fcbef5c7d08bccee8ef916
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e8d911dbffacecb97274bd18fcbbf92eeb9290661293f428bc38bb5aacfb264e3fffb26869e578fdfaf3f825ccf954c0adf52d6a63920d405958e157e5ce8c3
|
7
|
+
data.tar.gz: dcd34611500f0451735321a0c27d4fcec4c259f255e228920c600ffc5f54af236d21f0392007d8237175cdf12942f06e4d3b3e0aa0a20a09e12550b939ef00bb
|
data/lib/parser/json_parser.rb
CHANGED
@@ -23,7 +23,6 @@ module JsonParser
|
|
23
23
|
# parseTestStepData
|
24
24
|
def self.parse_test_step_data(parse_json)
|
25
25
|
parsed_step = {
|
26
|
-
testStep: parse_json['currentStep'],
|
27
26
|
testdesc: parse_json['description'],
|
28
27
|
testFunction: parse_json['function'].downcase,
|
29
28
|
testvalue: parse_json['value0'],
|
data/lib/report/junit_report.rb
CHANGED
@@ -43,12 +43,12 @@ module JunitReport
|
|
43
43
|
@test_step_report_summary2.each do |test_step_report_summary2|
|
44
44
|
testsuites.testsuite(test_step_report_summary2) do |testsuite|
|
45
45
|
$testStep_xml[test_step_report_summary2['name']]
|
46
|
-
.each do |
|
46
|
+
.each do |test_step_idx, test_step_xml|
|
47
47
|
testsuite.testcase(test_step_xml) do |testcase|
|
48
48
|
failure = $failtestStep_xml
|
49
|
-
&.[](test_step_report_summary2['name'])&.[](
|
49
|
+
&.[](test_step_report_summary2['name'])&.[](test_step_idx)
|
50
50
|
skipped = $skiptestStep_xml
|
51
|
-
&.[](test_step_report_summary2['name'])&.[](
|
51
|
+
&.[](test_step_report_summary2['name'])&.[](test_step_idx)
|
52
52
|
testcase.failure(failure) if failure
|
53
53
|
testcase.skipped(skipped) if skipped
|
54
54
|
end
|
data/lib/report/report.rb
CHANGED
@@ -16,14 +16,14 @@ module Report
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# print the test Step info to the test results file
|
19
|
-
def self.print_test_step_header(test_file_name,
|
19
|
+
def self.print_test_step_header(test_file_name, test_step_idx, test_desc)
|
20
20
|
@test_start_time = current_time
|
21
|
-
MyLog.log.info "Test step: #{
|
21
|
+
MyLog.log.info "Test step: #{test_step_idx} : #{test_desc}"
|
22
22
|
|
23
23
|
step = {
|
24
|
-
'id' =>
|
25
|
-
'classname' =>
|
26
|
-
'name' =>
|
24
|
+
'id' => test_step_idx,
|
25
|
+
'classname' => "SuiteID: #{$testId} Test Step: #{test_step_idx} #{test_desc}",
|
26
|
+
'name' => test_desc,
|
27
27
|
'file' => test_file_name
|
28
28
|
}
|
29
29
|
# output to console to show test step
|
@@ -33,23 +33,23 @@ module Report
|
|
33
33
|
|
34
34
|
$testStep_xml ||= {}
|
35
35
|
$testStep_xml[test_file_name] ||= {}
|
36
|
-
$testStep_xml[test_file_name][
|
36
|
+
$testStep_xml[test_file_name][test_step_idx] = step
|
37
37
|
end
|
38
38
|
|
39
39
|
# print the Pass / Fail status of a test to the test results file
|
40
|
-
def self.test_pass_fail(pass_fail, test_file_name,
|
40
|
+
def self.test_pass_fail(pass_fail, test_file_name, test_step_idx)
|
41
41
|
if pass_fail == true
|
42
42
|
$previousTestFail = $currentTestFail
|
43
43
|
$currentTestFail = false
|
44
44
|
$testStepPasses += 1
|
45
|
-
MyLog.log.info "Test #{
|
45
|
+
MyLog.log.info "Test #{test_step_idx} has Passed ".green
|
46
46
|
elsif pass_fail == false
|
47
47
|
$previousTestFail = $currentTestFail
|
48
48
|
$currentTestFail = true
|
49
49
|
$testStepFailures += 1
|
50
|
-
MyLog.log.info "Test #{
|
50
|
+
MyLog.log.info "Test #{test_step_idx} has FAILED ".red
|
51
51
|
failstep = {
|
52
|
-
'message' =>
|
52
|
+
'message' => "SuiteID: #{$testId} Test Step: #{test_step_idx} Test has FAILED - Check logs",
|
53
53
|
'type' => 'FAILURE',
|
54
54
|
'file' => test_file_name
|
55
55
|
}
|
@@ -60,13 +60,13 @@ module Report
|
|
60
60
|
|
61
61
|
$failtestStep_xml ||= {}
|
62
62
|
$failtestStep_xml[test_file_name] ||= []
|
63
|
-
$failtestStep_xml[test_file_name][
|
63
|
+
$failtestStep_xml[test_file_name][test_step_idx] = failstep
|
64
64
|
else
|
65
65
|
$currentTestFail = false
|
66
66
|
$testStepNotrun += 1
|
67
|
-
MyLog.log.info "Test #{
|
67
|
+
MyLog.log.info "Test #{test_step_idx} no checks performed ".blue
|
68
68
|
skipstep = {
|
69
|
-
'message' =>
|
69
|
+
'message' => "SuiteID: #{$testId} Test Step: #{test_step_idx} No checks performed - Check logs",
|
70
70
|
'type' => 'SKIPPED',
|
71
71
|
'file' => test_file_name
|
72
72
|
}
|
@@ -77,7 +77,7 @@ module Report
|
|
77
77
|
|
78
78
|
$skiptestStep_xml ||= {}
|
79
79
|
$skiptestStep_xml[test_file_name] ||= []
|
80
|
-
$skiptestStep_xml[test_file_name][
|
80
|
+
$skiptestStep_xml[test_file_name][test_step_idx] = skipstep
|
81
81
|
end
|
82
82
|
test_end_time = current_time
|
83
83
|
|
@@ -90,8 +90,7 @@ module Report
|
|
90
90
|
# check if the test failure threshold has been reached for total failures
|
91
91
|
# or consecutive failures.
|
92
92
|
# If a certain number of consecutive tests fail then throw an exception
|
93
|
-
def self.check_failure_threshold(test_file_name
|
94
|
-
_step_attributes)
|
93
|
+
def self.check_failure_threshold(test_file_name)
|
95
94
|
consecutive_fail_threshold = 5
|
96
95
|
if $previousTestFail && $currentTestFail
|
97
96
|
@consecutive_test_fail += 1
|
data/lib/utils/screenshot.rb
CHANGED
@@ -10,18 +10,18 @@ module Screenshot
|
|
10
10
|
|
11
11
|
# create screenshot filename and save the screenshot if the test has failed or
|
12
12
|
# if explictly required
|
13
|
-
def self.save_screenshot(screen_shot,
|
13
|
+
def self.save_screenshot(screen_shot, test_step_idx)
|
14
14
|
if $currentTestFail || screen_shot
|
15
15
|
time = Time.now.strftime('%H%M')
|
16
16
|
sc_dir = CreateDirectories.construct_testspecdirs
|
17
17
|
|
18
18
|
sc_file_name = if $currentTestFail
|
19
19
|
"#{sc_dir}/Test_ID-#{$testId.delete(' ')}"\
|
20
|
-
"_Test_step-#{
|
20
|
+
"_Test_step-#{test_step_idx}_Failed"\
|
21
21
|
"_#{time}.png"
|
22
22
|
else
|
23
23
|
"#{sc_dir}/Test_ID-#{$testId.delete(' ')}"\
|
24
|
-
"_Test_step-#{
|
24
|
+
"_Test_step-#{test_step_idx}_#{time}.png"
|
25
25
|
end
|
26
26
|
|
27
27
|
# Screenshot capture for websites
|
data/lib/utils/test_engine.rb
CHANGED
@@ -37,14 +37,17 @@ module TestEngine
|
|
37
37
|
$test_case_end_time = Report.current_time
|
38
38
|
|
39
39
|
begin
|
40
|
-
tests['steps'].
|
40
|
+
tests['steps'].each_with_index do |test_step, test_step_idx|
|
41
|
+
test_step_idx += 1
|
42
|
+
|
41
43
|
parsed_steps = Parser.parse_test_step_data(test_step)
|
44
|
+
|
42
45
|
# process the test step data
|
43
|
-
TestSteps.process_test_steps(test_file_name,
|
46
|
+
TestSteps.process_test_steps(test_file_name, test_step_idx,
|
44
47
|
parsed_steps)
|
45
48
|
# see if screenshot required
|
46
49
|
Screenshot.save_screenshot(parsed_steps[:screenShotData],
|
47
|
-
|
50
|
+
test_step_idx)
|
48
51
|
end
|
49
52
|
rescue TafError => e
|
50
53
|
warn e
|
data/lib/utils/test_steps.rb
CHANGED
@@ -16,20 +16,18 @@ module TestSteps
|
|
16
16
|
|
17
17
|
# process the test step data by matching the test step functions and
|
18
18
|
# processing the associated data accordingly
|
19
|
-
def self.process_test_steps(test_file_name,
|
19
|
+
def self.process_test_steps(test_file_name, test_step_idx, step_attributes)
|
20
20
|
# print the test step information
|
21
|
-
Report.print_test_step_header(test_file_name,
|
22
|
-
step_attributes)
|
21
|
+
Report.print_test_step_header(test_file_name, test_step_idx,
|
22
|
+
step_attributes[:testdesc])
|
23
23
|
runtest = step_attributes[:skipTestCase]
|
24
24
|
step_function = step_attributes[:testFunction]
|
25
25
|
handler = handlers[step_function.to_s]
|
26
26
|
|
27
27
|
if handler.respond_to?(:perform)
|
28
28
|
func = handler.perform(step_attributes) if runtest == false
|
29
|
-
Report.test_pass_fail(func, test_file_name,
|
30
|
-
|
31
|
-
Report.check_failure_threshold(test_file_name, test_step_index,
|
32
|
-
step_attributes)
|
29
|
+
Report.test_pass_fail(func, test_file_name, test_step_idx)
|
30
|
+
Report.check_failure_threshold(test_file_name)
|
33
31
|
return true
|
34
32
|
else
|
35
33
|
MyLog.log.warn "\nUnable to match function: #{step_function}"
|
data/lib/version.rb
CHANGED