taf 0.2.7 → 0.2.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/lib/taf_config.rb +1 -0
- data/lib/utils/browser.rb +0 -29
- data/lib/utils/screenshot.rb +40 -0
- data/lib/utils/test_engine.rb +4 -2
- data/lib/utils/test_steps.rb +4 -2
- data/lib/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94881157aa5b02823bfc4f494545d70074193616c9b00144545abdc0a85245d6
|
4
|
+
data.tar.gz: bba87713f355f46b5306ec041b61fcfc6db8b46a93881a3286631d606c83fe41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b84b075a41ac5c29522adfdb9acaa743fbf51de798659547c5674c6fd4b8dfedbb16f1ebcf0f0f2a1644ee5c9a9aaa73862e2bf5517549777a4d87f6b7d06e71
|
7
|
+
data.tar.gz: 2d6d5d56f6e561e2b326a35c1c6a0d454939129ba3615e035cf52153c1a2663cd1d57e0fcea1cf5760eb16eddac85135f7926a7aac16ce31440f22539c1e27b5
|
data/lib/taf_config.rb
CHANGED
@@ -30,6 +30,7 @@ require_relative './utils/browser'
|
|
30
30
|
require_relative './utils/create_directories'
|
31
31
|
require_relative './utils/logger'
|
32
32
|
require_relative './utils/test_engine'
|
33
|
+
require_relative './utils/screenshot'
|
33
34
|
require_relative './utils/exceptions'
|
34
35
|
require_relative './report/junit_report'
|
35
36
|
require_relative './report/report_summary'
|
data/lib/utils/browser.rb
CHANGED
@@ -110,33 +110,4 @@ module Browser
|
|
110
110
|
rescue StandardError
|
111
111
|
'No Browser version'
|
112
112
|
end
|
113
|
-
|
114
|
-
# create screenshot filename and save the screenshot if the test has failed or
|
115
|
-
# if explictly required
|
116
|
-
def self.check_save_screenshot(screen_shot)
|
117
|
-
if $currentTestFail || screen_shot
|
118
|
-
time = Time.now.strftime('%H%M')
|
119
|
-
sc_dir = CreateDirectories.construct_testspecdirs
|
120
|
-
|
121
|
-
sc_file_name = if $currentTestFail
|
122
|
-
"#{sc_dir}/Test_ID-#{$testId.delete(' ')}"\
|
123
|
-
"_Test_step-#{$test_step}_Failed_#{time}.png"
|
124
|
-
else
|
125
|
-
"#{sc_dir}/Test_ID-#{$testId.delete(' ')}"\
|
126
|
-
"_Test_step-#{$test_step}_#{time}.png"
|
127
|
-
end
|
128
|
-
|
129
|
-
# Screenshot capture for websites
|
130
|
-
Browser.b.screenshot.save sc_file_name
|
131
|
-
MyLog.log.info("Screenshot saved to: #{sc_file_name} \n")
|
132
|
-
else
|
133
|
-
MyLog.log.debug "No screenshot requested \n"
|
134
|
-
end
|
135
|
-
|
136
|
-
# if any issues with saving the screenshot then log a warning
|
137
|
-
rescue StandardError => error
|
138
|
-
# construct the error message from custom text and the actual system
|
139
|
-
# error message (converted to a string).
|
140
|
-
MyLog.log.warn("Error saving the screenshot: #{sc_file_name} #{error}")
|
141
|
-
end
|
142
113
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Created on 02 Aug 2018
|
2
|
+
# @author: Andy Perrett
|
3
|
+
#
|
4
|
+
# Versions:
|
5
|
+
# 1.0 - Baseline
|
6
|
+
#
|
7
|
+
# browser_setup.rb - a browser functions
|
8
|
+
module Screenshot
|
9
|
+
require_relative '../taf_config.rb'
|
10
|
+
|
11
|
+
# create screenshot filename and save the screenshot if the test has failed or
|
12
|
+
# if explictly required
|
13
|
+
def self.save_screenshot(screen_shot, parsed_steps)
|
14
|
+
if $currentTestFail || screen_shot
|
15
|
+
time = Time.now.strftime('%H%M')
|
16
|
+
sc_dir = CreateDirectories.construct_testspecdirs
|
17
|
+
|
18
|
+
sc_file_name = if $currentTestFail
|
19
|
+
"#{sc_dir}/Test_ID-#{$testId.delete(' ')}"\
|
20
|
+
"_Test_step-#{parsed_steps[:testStep]}_Failed"\
|
21
|
+
"_#{time}.png"
|
22
|
+
else
|
23
|
+
"#{sc_dir}/Test_ID-#{$testId.delete(' ')}"\
|
24
|
+
"_Test_step-#{parsed_steps[:testStep]}_#{time}.png"
|
25
|
+
end
|
26
|
+
|
27
|
+
# Screenshot capture for websites
|
28
|
+
Browser.b.screenshot.save sc_file_name
|
29
|
+
MyLog.log.info("Screenshot saved to: #{sc_file_name} \n")
|
30
|
+
else
|
31
|
+
MyLog.log.debug "No screenshot requested \n"
|
32
|
+
end
|
33
|
+
|
34
|
+
# if any issues with saving the screenshot then log a warning
|
35
|
+
rescue StandardError => error
|
36
|
+
# construct the error message from custom text and the actual system
|
37
|
+
# error message (converted to a string).
|
38
|
+
MyLog.log.warn("Error saving the screenshot: #{sc_file_name} #{error}")
|
39
|
+
end
|
40
|
+
end
|
data/lib/utils/test_engine.rb
CHANGED
@@ -40,9 +40,11 @@ module TestEngine
|
|
40
40
|
tests['steps'].each do |test_step|
|
41
41
|
parsed_steps = Parser.parse_test_step_data(test_step)
|
42
42
|
# process the test step data
|
43
|
-
TestSteps.process_test_steps(test_file_name, parsed_steps[:testStep],
|
43
|
+
TestSteps.process_test_steps(test_file_name, parsed_steps[:testStep],
|
44
|
+
parsed_steps)
|
44
45
|
# see if screenshot required
|
45
|
-
|
46
|
+
Screenshot.save_screenshot(parsed_steps[:screenShotData],
|
47
|
+
parsed_steps)
|
46
48
|
end
|
47
49
|
rescue TafError => error
|
48
50
|
warn error
|
data/lib/utils/test_steps.rb
CHANGED
@@ -18,14 +18,16 @@ module TestSteps
|
|
18
18
|
# processing the associated data accordingly
|
19
19
|
def self.process_test_steps(test_file_name, test_step_index, step_attributes)
|
20
20
|
# print the test step information
|
21
|
-
Report.print_test_step_header(test_file_name, test_step_index,
|
21
|
+
Report.print_test_step_header(test_file_name, test_step_index,
|
22
|
+
step_attributes)
|
22
23
|
runtest = step_attributes[:skipTestCase]
|
23
24
|
step_function = step_attributes[:testFunction]
|
24
25
|
handler = handlers[step_function.to_s]
|
25
26
|
|
26
27
|
if handler.respond_to?(:perform)
|
27
28
|
func = handler.perform(step_attributes) if runtest == false
|
28
|
-
Report.test_pass_fail(func, test_file_name, test_step_index,
|
29
|
+
Report.test_pass_fail(func, test_file_name, test_step_index,
|
30
|
+
step_attributes)
|
29
31
|
Report.check_failure_threshold(test_file_name, test_step_index)
|
30
32
|
return true
|
31
33
|
else
|
data/lib/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.8
|
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-05-
|
11
|
+
date: 2019-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- lib/utils/create_directories.rb
|
210
210
|
- lib/utils/exceptions.rb
|
211
211
|
- lib/utils/logger.rb
|
212
|
+
- lib/utils/screenshot.rb
|
212
213
|
- lib/utils/test_engine.rb
|
213
214
|
- lib/utils/test_steps.rb
|
214
215
|
- lib/version.rb
|