taf 0.3.5 → 0.3.6

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/functions/handlers/base_handler.rb +11 -13
  3. data/lib/functions/handlers/browser_back.rb +1 -1
  4. data/lib/functions/handlers/browser_forward.rb +1 -1
  5. data/lib/functions/handlers/browser_quit.rb +1 -1
  6. data/lib/functions/handlers/browser_refresh.rb +1 -1
  7. data/lib/functions/handlers/capture_alert.rb +1 -1
  8. data/lib/functions/handlers/check_box.rb +4 -7
  9. data/lib/functions/handlers/check_boxdata.rb +11 -20
  10. data/lib/functions/handlers/check_browser_title.rb +4 -6
  11. data/lib/functions/handlers/check_logs.rb +5 -8
  12. data/lib/functions/handlers/check_screendata.rb +4 -6
  13. data/lib/functions/handlers/check_url.rb +4 -6
  14. data/lib/functions/handlers/click_button.rb +5 -8
  15. data/lib/functions/handlers/execute_system_command.rb +4 -6
  16. data/lib/functions/handlers/handle_browser_window.rb +5 -7
  17. data/lib/functions/handlers/ipause.rb +4 -6
  18. data/lib/functions/handlers/list_all_dropdowns_values.rb +5 -8
  19. data/lib/functions/handlers/login.rb +10 -8
  20. data/lib/functions/handlers/open_url.rb +4 -6
  21. data/lib/functions/handlers/ping_test.rb +4 -6
  22. data/lib/functions/handlers/radio_button.rb +5 -10
  23. data/lib/functions/handlers/select_dropdown.rb +6 -10
  24. data/lib/functions/handlers/send_special_keys.rb +4 -6
  25. data/lib/functions/handlers/write_box_data.rb +7 -10
  26. data/lib/main.rb +13 -19
  27. data/lib/parser/json_parser.rb +15 -8
  28. data/lib/parser/parser.rb +1 -2
  29. data/lib/report/junit_report.rb +23 -15
  30. data/lib/report/report.rb +16 -15
  31. data/lib/report/report_summary.rb +18 -16
  32. data/lib/utils/browser.rb +8 -7
  33. data/lib/utils/cmd_line.rb +11 -3
  34. data/lib/utils/create_directories.rb +1 -10
  35. data/lib/utils/screenshot.rb +10 -22
  36. data/lib/utils/test_engine.rb +17 -18
  37. data/lib/utils/test_steps.rb +3 -2
  38. data/lib/version.rb +1 -1
  39. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e890ccd6ddebb08f0ce354fd689f01197d6f3118612d73cbabc413f885f9d15d
4
- data.tar.gz: ed95d60fa534d3e6a67c9640329b785df2d6ae599007782027ed0f2f089a9a65
3
+ metadata.gz: 689534e9c30efe0f07355bb190dc79fc71adc06152a5fda8d79c601e9b1de97d
4
+ data.tar.gz: 59998580a22f1c1bda658b136aa77a25da75c9b53e5854c9b7b82f8d513c8191
5
5
  SHA512:
6
- metadata.gz: 511758778621850bb660c4d1112cd90adf82ff095a97e817d3070ea29d139fee111e15cfa2ee0f992c92b246d6f8167d4017adb0568fddc701939595a4b6bf60
7
- data.tar.gz: fee2faa59db43f0a57cdf8a00c47a47cc4ab50130bb5343b2d7db92c6f5b26e199fef739542a63d0333aa783da2f6c19703acbd2db1f300aca2f4fddafacc127
6
+ metadata.gz: b0c9a37bee50a842f2b125dcc1ad091219c8b13a87364d71b23e937851faaa88195e2667542c02fbcc87380663d9ecb5dec1c9724179243f025d90251be462d7
7
+ data.tar.gz: 06ac73be34a9561fe388747ae48f69649d6961393d34e817fd0f34db7356ebb97d4e6436b56d3e4d8c24dbe1930b68778124fe09f3b06897a8f09af3e06ef4db
@@ -6,12 +6,19 @@ module TestSteps
6
6
  module Handlers
7
7
  # All Login functions function.
8
8
  class Base
9
+ def initialize(step_attributes)
10
+ @value = step_attributes[:testvalue]
11
+ @value2 = step_attributes[:testvalue2]
12
+ @locate = step_attributes[:locate]
13
+ @locate2 = step_attributes[:locate2]
14
+ end
15
+
9
16
  def self.register(name)
10
17
  TestSteps.handlers[name.to_s] = self
11
18
  end
12
19
 
13
20
  def self.perform(*args)
14
- new.perform(*args)
21
+ new(*args).perform
15
22
  end
16
23
 
17
24
  def open_url_process(url)
@@ -23,23 +30,14 @@ module TestSteps
23
30
  if Browser.b.title.eql?(b_title)
24
31
  Browser.b.text_field(id: user_elm).wait_until(&:exists?).set user
25
32
  Browser.b.text_field(id: pass_elm).wait_until(&:exists?).set pass
26
- login_button
33
+ button = 'Sign in' || 'Log in'
34
+ Browser.b.button(value: button).wait_until(&:exists?).click
27
35
  sleep 1
28
36
  else
29
37
  MyLog.log.warn("User: #{user} has failed to log in.")
30
38
  end
31
39
  end
32
40
 
33
- def login_button
34
- if Browser.b.button(value: 'Sign in').exist?
35
- Browser.b.button(value: 'Sign in').wait_until(&:exists?).click
36
- elsif Browser.b.button(value: 'Log in').exist?
37
- Browser.b.button(value: 'Log in').wait_until(&:exists?).click
38
- else
39
- MyLog.log.warn("User: #{user} has failed to log in.")
40
- end
41
- end
42
-
43
41
  def login_check(b_title_sucess, user)
44
42
  if Browser.b.title.eql?(b_title_sucess)
45
43
  MyLog.log.info("User: #{user} has logged in successful.")
@@ -51,7 +49,7 @@ module TestSteps
51
49
  end
52
50
 
53
51
  def mem_word_check(user, b_title_sucess)
54
- if Browser.b.title.eql?('Memorable word Portal')
52
+ if Browser.b.title.eql?('Memorable word')
55
53
  portal_mem_word(user, b_title_sucess)
56
54
  elsif Browser.b.title.eql?(b_title_sucess)
57
55
  MyLog.log.info("User: #{user} has logged in successful.")
@@ -8,7 +8,7 @@ module TestSteps
8
8
  class BrowserBack < Base
9
9
  register :browser_back
10
10
 
11
- def perform(_step_attributes)
11
+ def perform
12
12
  Browser.b.back
13
13
  MyLog.log.info('Browser navigated back')
14
14
  true
@@ -8,7 +8,7 @@ module TestSteps
8
8
  class BrowserForward < Base
9
9
  register :browser_forward
10
10
 
11
- def perform(_step_attributes)
11
+ def perform
12
12
  Browser.b.forward
13
13
  MyLog.log.info('Browser navigated forward')
14
14
  true
@@ -8,7 +8,7 @@ module TestSteps
8
8
  class BrowserQuit < Base
9
9
  register :browser_quit
10
10
 
11
- def perform(_step_attributes)
11
+ def perform
12
12
  Browser.b.quit
13
13
  MyLog.log.info('Browser has closed successfully')
14
14
  true
@@ -8,7 +8,7 @@ module TestSteps
8
8
  class BrowserRefresh < Base
9
9
  register :browser_refresh
10
10
 
11
- def perform(_step_attributes)
11
+ def perform
12
12
  Browser.b.refresh
13
13
  MyLog.log.info('The Browser has been refreshed')
14
14
  true
@@ -8,7 +8,7 @@ module TestSteps
8
8
  class CaptureAlert < Base
9
9
  register :capture_alert
10
10
 
11
- def perform(_step_attributes)
11
+ def perform
12
12
  Browser.b.div(class: 'alert').exist?
13
13
  alertmsg = Browser.b.div(class: 'alert').text
14
14
  MyLog.log.info("Alert shown: #{alertmsg}")
@@ -8,15 +8,12 @@ module TestSteps
8
8
  class CheckBox < Base
9
9
  register :check_box
10
10
 
11
- def perform(step_attributes)
12
- checkbox = step_attributes[:testvalue]
13
- locate = step_attributes[:locate]
14
-
15
- Browser.b.checkbox("#{locate}": checkbox).wait_until(&:exists?).click
16
- MyLog.log.info("Check box: #{checkbox} has been selected")
11
+ def perform
12
+ Browser.b.checkbox("#{@locate}": @value).wait_until(&:exists?).click
13
+ MyLog.log.info("Check box: #{@value} has been selected")
17
14
  true
18
15
  rescue StandardError
19
- MyLog.log.warn("Check box: #{checkbox} does not exist")
16
+ MyLog.log.warn("Check box: #{@value} does not exist")
20
17
  false
21
18
  end
22
19
  end
@@ -8,35 +8,26 @@ module TestSteps
8
8
  class CheckBoxdata < Base
9
9
  register :check_box_data
10
10
 
11
- def perform(step_attributes)
12
- box = step_attributes[:testvalue]
13
- value = step_attributes[:testvalue2]
14
- locate = step_attributes[:locate]
11
+ def perform
12
+ elms = %i[textarea text_field iframe]
15
13
 
16
- found_box = [
17
- Browser.b.textarea("#{locate}": box).exist?,
18
- Browser.b.text_field("#{locate}": box).exist?
19
- ]
14
+ found_box = elms.map do |elm|
15
+ Browser.b.send(elm, "#{@locate}": @value).exists?
16
+ end.compact
20
17
 
21
18
  raise 'Multiple matches' if found_box.select { |i| i }.empty?
22
19
 
23
20
  index = found_box.index(true)
24
21
  return unless index
25
22
 
26
- if index.zero?
27
- Browser.b.textarea("#{locate}": box).wait_until(&:exists?)
28
- (Browser.b.textarea("#{locate}": box).value == value)
29
- elsif index == 1
30
- Browser.b.text_field("#{locate}": box).wait_until(&:exists?)
31
- (Browser.b.text_field("#{locate}": box).value == value)
32
- end
33
- MyLog.log.info("Textbox: #{box} has the correct value: #{value}")
23
+ ele = Browser.b.send(elms[index], "#{@locate}": @value)
24
+
25
+ ele.wait_until(&:exists?)
26
+ (ele.value == @value2)
27
+ MyLog.log.info("Textbox: #{@value} has correct value: #{value2}")
34
28
  true
35
29
  rescue StandardError
36
- MyLog.log.warn("Textbox: #{box} has the incorrect value: #{value}")
37
- false
38
- rescue StandardError
39
- MyLog.log.warn("Textbox: #{box} does not exist")
30
+ MyLog.log.warn("Textbox: #{@value} does not exist")
40
31
  false
41
32
  end
42
33
  end
@@ -8,14 +8,12 @@ module TestSteps
8
8
  class CheckTitle < Base
9
9
  register :check_browser_title
10
10
 
11
- def perform(step_attributes)
12
- b_title = step_attributes[:testvalue]
13
-
14
- Browser.b.wait_until { Browser.b.title.eql? b_title }
15
- MyLog.log.info("Browser title: #{b_title}")
11
+ def perform
12
+ Browser.b.wait_until { Browser.b.title.eql? @value }
13
+ MyLog.log.info("Browser title: #{@value}")
16
14
  true
17
15
  rescue StandardError
18
- MyLog.log.warn("Title not found: #{b_title}")
16
+ MyLog.log.warn("Title not found: #{@value}")
19
17
  false
20
18
  end
21
19
  end
@@ -8,16 +8,13 @@ module TestSteps
8
8
  class CheckLogs < Base
9
9
  register :check_log_file
10
10
 
11
- def perform(step_attributes)
12
- text = step_attributes[:testvalue]
13
- file = step_attributes[:testvalue2]
14
-
15
- blog_result = system 'egrep -i ' + text + ' ' + file + ' > ' + output
16
- if blog_result == true
17
- MyLog.log.info("Data has matched: #{text} in LogFile: #{file}")
11
+ def perform
12
+ result = system 'egrep -i ' + @value + ' ' + @value2 + ' > ' + output
13
+ if result == true
14
+ MyLog.log.info("Data has matched: #{@value} in LogFile: #{@value2}")
18
15
  return true
19
16
  else
20
- MyLog.log.warn("Problem finding: #{text} in LogFile: #{file}")
17
+ MyLog.log.warn("Problem finding: #{@value} in LogFile: #{@value2}")
21
18
  return false
22
19
  end
23
20
  end
@@ -8,14 +8,12 @@ module TestSteps
8
8
  class CheckScreendata < Base
9
9
  register :check_screen_data
10
10
 
11
- def perform(step_attributes)
12
- check_text = step_attributes[:testvalue]
13
-
14
- Browser.b.wait_until { Browser.b.element.text.include? check_text }
15
- MyLog.log.info("Text found: #{check_text}")
11
+ def perform
12
+ Browser.b.wait_until { Browser.b.element.text.include? @value }
13
+ MyLog.log.info("Text found: #{@value}")
16
14
  true
17
15
  rescue StandardError
18
- MyLog.log.warn("Text not found: #{check_text}")
16
+ MyLog.log.warn("Text not found: #{@value}")
19
17
  false
20
18
  end
21
19
  end
@@ -8,14 +8,12 @@ module TestSteps
8
8
  class CheckUrl < Base
9
9
  register :check_url
10
10
 
11
- def perform(step_attributes)
12
- url = step_attributes[:testvalue]
13
-
14
- if Browser.b.url == url
15
- MyLog.log.info("URL: #{url} is correct")
11
+ def perform
12
+ if Browser.b.url == @value
13
+ MyLog.log.info("URL: #{@value} is correct")
16
14
  true
17
15
  else
18
- MyLog.log.warn("URL: #{url} is incorrect")
16
+ MyLog.log.warn("URL: #{@value} is incorrect")
19
17
  false
20
18
  end
21
19
  end
@@ -8,14 +8,11 @@ module TestSteps
8
8
  class ClickButton < Base
9
9
  register :click_button
10
10
 
11
- def perform(step_attributes)
12
- button = step_attributes[:testvalue]
13
- locate = step_attributes[:locate]
14
-
11
+ def perform
15
12
  elms = %i[button span a div link image h1 h2 h3 h4]
16
13
 
17
14
  found_button = elms.map do |elm|
18
- Browser.b.send(elm, "#{locate}": button).exists?
15
+ Browser.b.send(elm, "#{@locate}": @value).exists?
19
16
  end.compact
20
17
 
21
18
  raise 'Multiple matches' if found_button.select { |i| i }.empty?
@@ -23,12 +20,12 @@ module TestSteps
23
20
  index = found_button.index(true)
24
21
  return unless index
25
22
 
26
- Browser.b.send(elms[index], "#{locate}": button)
23
+ Browser.b.send(elms[index], "#{@locate}": @value)
27
24
  .wait_until(&:exists?).click
28
- MyLog.log.info("Button: #{button} has been selected")
25
+ MyLog.log.info("Button: #{@value} has been selected")
29
26
  true
30
27
  rescue StandardError
31
- MyLog.log.warn("Button: #{button} does not exist")
28
+ MyLog.log.warn("Button: #{@value} does not exist")
32
29
  false
33
30
  end
34
31
  end
@@ -8,15 +8,13 @@ module TestSteps
8
8
  class ExecuteSystemCommand < Base
9
9
  register :execute_system_command
10
10
 
11
- def perform(step_attributes)
12
- syst_cmd = step_attributes[:testvalue]
13
-
14
- b_result = system syst_cmd
11
+ def perform
12
+ b_result = system @value
15
13
  if b_result == true
16
- MyLog.log.info("Cmd has been executed sucessfully #{syst_cmd}")
14
+ MyLog.log.info("Cmd has been executed sucessfully #{@value}")
17
15
  return true
18
16
  else
19
- MyLog.log.warn("Theres a problem executing command #{syst_cmd}")
17
+ MyLog.log.warn("Theres a problem executing command #{@value}")
20
18
  return false
21
19
  end
22
20
  end
@@ -8,16 +8,14 @@ module TestSteps
8
8
  class HandleBrowserWindow < Base
9
9
  register :handle_browser_window
10
10
 
11
- def perform(step_attributes)
12
- text_check = step_attributes[:testvalue]
13
-
14
- Browser.b.window(title: text_check.to_s).use
11
+ def perform
12
+ Browser.b.window(title: @value.to_s).use
15
13
  sleep 3
16
- Browser.b.title.eql?(text_check.to_s)
17
- MyLog.log.info("Window title: #{text_check} is correct")
14
+ Browser.b.title.eql?(@value.to_s)
15
+ MyLog.log.info("Window title: #{@value} is correct")
18
16
  true
19
17
  rescue StandardError
20
- MyLog.log.warn("Window not found: #{text_check}")
18
+ MyLog.log.warn("Window not found: #{@value}")
21
19
  false
22
20
  end
23
21
  end
@@ -8,14 +8,12 @@ module TestSteps
8
8
  class Ipause < Base
9
9
  register :ipause
10
10
 
11
- def perform(step_attributes)
12
- wait_time = step_attributes[:testvalue]
13
-
14
- sleep(wait_time.to_i)
15
- MyLog.log.info('Wait completed for seconds: ' + wait_time.to_s)
11
+ def perform
12
+ sleep(@value.to_i)
13
+ MyLog.log.info('Wait completed for seconds: ' + @value.to_s)
16
14
  true
17
15
  rescue StandardError
18
- MyLog.log.warn('Wait failed for seconds: ' + wait_time.to_s)
16
+ MyLog.log.warn('Wait failed for seconds: ' + @value.to_s)
19
17
  false
20
18
  end
21
19
  end
@@ -8,17 +8,14 @@ module TestSteps
8
8
  class ListAllDropdownValues < Base
9
9
  register :list_all_dropdown_values
10
10
 
11
- def perform(step_attributes)
12
- dropdown = step_attributes[:testvalue]
13
- locate = step_attributes[:locate]
14
-
15
- Browser.b.element("#{locate}": dropdown).wait_until(&:exists?)
16
- Browser.b.select_list("#{locate}": dropdown).options.each do |i|
17
- MyLog.log.info("List of dropdown for #{dropdown} are: #{i.text}")
11
+ def perform
12
+ Browser.b.element("#{@locate}": @value).wait_until(&:exists?)
13
+ Browser.b.select_list("#{@locate}": @value).options.each do |i|
14
+ MyLog.log.info("List of dropdown for #{@value} are: #{i.text}")
18
15
  return true
19
16
  end
20
17
  rescue StandardError
21
- MyLog.log.warn("List dropdown: #{dropdown} does not exist")
18
+ MyLog.log.warn("List dropdown: #{@value} does not exist")
22
19
  false
23
20
  end
24
21
  end
@@ -8,20 +8,22 @@ module TestSteps
8
8
  class Login < Base
9
9
  register :login
10
10
 
11
- def perform(step_attributes)
12
- login_type = step_attributes[:testvalue]
13
- user = step_attributes[:testvalue2]
11
+ def perform
12
+ user = @value2
14
13
  user = ENV[user.to_s] if ENV[user.to_s]
15
14
 
16
- lc_login_type = login_type.downcase
17
- case lc_login_type
15
+ login_user(user)
16
+ rescue StandardError
17
+ MyLog.log.error "unable to find login: #{@value}"
18
+ raise LoginTypeFailed
19
+ end
20
+
21
+ def login_user(user)
22
+ case @value.downcase
18
23
  when 'portal_login'
19
24
  portal_login(user)
20
25
  when 'sso_login'
21
26
  sso_login(user)
22
- else
23
- MyLog.log.error "unable to find login: #{lc_login_type}"
24
- raise LoginTypeFailed
25
27
  end
26
28
  end
27
29
 
@@ -8,15 +8,13 @@ module TestSteps
8
8
  class OpenUrl < Base
9
9
  register :open_url
10
10
 
11
- def perform(step_attributes)
12
- url = step_attributes[:testvalue]
13
-
11
+ def perform
14
12
  Browser.open_browser
15
13
 
16
- url = if ENV[url]
17
- ENV[url.to_s]
14
+ url = if ENV[@value]
15
+ ENV[@value.to_s]
18
16
  else
19
- step_attributes[:testvalue]
17
+ @value
20
18
  end
21
19
  Browser.b.goto(url)
22
20
  OpenUrl.check_current_url(url)
@@ -9,18 +9,16 @@ module TestSteps
9
9
  register :ping_test
10
10
 
11
11
  # TODO: retry every 'x' until timeout reached.
12
- def perform(step_attributes)
13
- url = step_attributes[:testvalue]
14
-
15
- check = Net::Ping::HTTP.new(url)
12
+ def perform
13
+ check = Net::Ping::HTTP.new(@value)
16
14
 
17
15
  check.ping?
18
16
  sleep 5
19
17
  if check.ping?
20
- MyLog.log.info("pinged: #{url}")
18
+ MyLog.log.info("pinged: #{@value}")
21
19
  return true
22
20
  else
23
- MyLog.log.warn("Failed to ping: #{url}")
21
+ MyLog.log.warn("Failed to ping: #{@value}")
24
22
  return false
25
23
  end
26
24
  end
@@ -8,18 +8,13 @@ module TestSteps
8
8
  class RadioButton < Base
9
9
  register :radio_button
10
10
 
11
- def perform(step_attributes)
12
- radio = step_attributes[:testvalue]
13
- value2 = step_attributes[:testvalue2]
14
- locate = step_attributes[:locate]
15
- locate2 = step_attributes[:locate2]
16
-
17
- Browser.b.radio("#{locate}": radio).wait_until(&:exists?)
18
- Browser.b.radio("#{locate}": radio, "#{locate2}": value2.to_s).set
19
- MyLog.log.info("Radio button: #{radio} has been selected")
11
+ def perform
12
+ Browser.b.radio("#{@locate}": @value).wait_until(&:exists?)
13
+ Browser.b.radio("#{@locate}": @value, "#{@locate2}": @value2.to_s).set
14
+ MyLog.log.info("Radio button: #{@value2} has been selected")
20
15
  true
21
16
  rescue StandardError
22
- MyLog.log.warn("Radio button: #{radio} does not exist")
17
+ MyLog.log.warn("Radio button: #{@value2} does not exist")
23
18
  false
24
19
  end
25
20
  end
@@ -8,19 +8,15 @@ module TestSteps
8
8
  class SelectDropdown < Base
9
9
  register :select_dropdown
10
10
 
11
- def perform(step_attributes)
12
- dropdown = step_attributes[:testvalue]
13
- value2 = step_attributes[:testvalue2]
14
- locate = step_attributes[:locate]
15
- locate2 = step_attributes[:locate2]
11
+ def perform
12
+ ele = Browser.b.select_list("#{@locate}": @value)
16
13
 
17
- Browser.b.select_list("#{locate}": dropdown).wait_until(&:exists?)
18
- Browser.b.select_list("#{locate}": dropdown).option("#{locate2}":
19
- value2.to_s).select
20
- MyLog.log.info("Dropdown item: #{value2} has been selected")
14
+ ele.wait_until(&:exists?)
15
+ ele.option("#{@locate2}": @value2.to_s).select
16
+ MyLog.log.info("Dropdown item: #{@value2} has been selected")
21
17
  true
22
18
  rescue StandardError
23
- MyLog.log.warn("Dropdown item: #{value2} has NOT been selected")
19
+ MyLog.log.warn("Dropdown item: #{@value2} has NOT been selected")
24
20
  false
25
21
  end
26
22
  end
@@ -8,15 +8,13 @@ module TestSteps
8
8
  class SendSpecialKeys < Base
9
9
  register :send_special_keys
10
10
 
11
- def perform(step_attributes)
12
- special_key = step_attributes[:testvalue]
13
-
14
- Browser.b.send_keys :"#{special_key}"
11
+ def perform
12
+ Browser.b.send_keys :"#{@value}"
15
13
  sleep 1
16
- MyLog.log.info("Browser Sent key: :#{special_key} successfully")
14
+ MyLog.log.info("Browser Sent key: :#{@value} successfully")
17
15
  true
18
16
  rescue StandardError
19
- MyLog.log.warn("Browser Failed to Send key: :#{special_key}")
17
+ MyLog.log.warn("Browser Failed to Send key: :#{@value}")
20
18
  false
21
19
  end
22
20
  end
@@ -8,16 +8,13 @@ module TestSteps
8
8
  class WriteBoxdata < Base
9
9
  register :write_box_data
10
10
 
11
- def perform(step_attributes)
12
- box = step_attributes[:testvalue]
13
- value = step_attributes[:testvalue2]
14
- locate = step_attributes[:locate]
15
- txt = ENV[value.to_s] || step_attributes[:testvalue2]
16
-
11
+ def perform
12
+ txt = @value2
13
+ txt = ENV[txt.to_s] if ENV[txt.to_s]
17
14
  elms = %i[textarea text_field iframe]
18
15
 
19
16
  found_box = elms.map do |elm|
20
- Browser.b.send(elm, "#{locate}": box).exists?
17
+ Browser.b.send(elm, "#{@locate}": @value).exists?
21
18
  end.compact
22
19
 
23
20
  raise 'Multiple matches' if found_box.select { |i| i }.empty?
@@ -25,12 +22,12 @@ module TestSteps
25
22
  index = found_box.index(true)
26
23
  return unless index
27
24
 
28
- Browser.b.send(elms[index], "#{locate}": box)
25
+ Browser.b.send(elms[index], "#{@locate}": @value)
29
26
  .wait_until(&:exists?).send_keys txt
30
- MyLog.log.info("Textbox: #{box} has correct value: #{txt}")
27
+ MyLog.log.info("Textbox: #{@value} has correct value: #{txt}")
31
28
  true
32
29
  rescue StandardError
33
- MyLog.log.warn("Textbox: #{box} does not exist")
30
+ MyLog.log.warn("Textbox: #{@value} does not exist")
34
31
  false
35
32
  end
36
33
  end
@@ -10,30 +10,24 @@
10
10
  module Main
11
11
  require_relative './taf_config.rb'
12
12
 
13
- begin
14
- # variables to manage the failure reporting
15
- $testStepPasses = 0
16
- $testStepFailures = 0
17
- $testStepNotrun = 0
18
- $totalTestPasses = 0
19
- $totalTestFailures = 0
20
- $totalTestNotrun = 0
21
- $previousTestFail = false
22
- $currentTestFail = false
23
- # parses the cmd line imput into the taf
24
- CMDLine.cmdline_input
25
- end
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
26
18
 
27
19
  # process the test files to execute the tests
28
- TestEngine.process_testfiles
20
+ total_passes, total_failures, total_skipped = TestEngine.process_testfiles
29
21
 
30
- # get the overall test end time
31
- $test_end_time = Report.current_time
22
+ # get the overall test suite end time
23
+ ts_end_time = Report.current_time
32
24
 
33
25
  # output the overall test summary
34
- ReportSummary.print_overall_test_summary
35
- JunitReport.test_summary_junit
26
+ ReportSummary.overall_test_summary(ts_start_time, ts_end_time, total_passes,
27
+ total_failures, total_skipped)
28
+ JunitReport.test_summary_junit(ts_start_time, ts_end_time, total_passes,
29
+ total_failures, total_skipped)
36
30
 
37
31
  # Exit status code.
38
- Process.exit($totalTestFailures.zero? ? 0 : 1)
32
+ Process.exit(total_failures.zero? ? 0 : 1)
39
33
  end
@@ -12,14 +12,22 @@ module JsonParser
12
12
 
13
13
  def self.parse_test_header_data(parse_json)
14
14
  # get the number of test steps in the file
15
- $numberOfTestSteps = parse_json['steps'].count
15
+ number_test_steps = parse_json['steps'].count
16
16
  # get the remaining test data
17
- $testId = parse_json['testId']
18
- $projectId = parse_json['projectId']
19
- $testDes = parse_json['testDescription']
20
- MyLog.log.info "Number of test steps: #{$numberOfTestSteps}"
21
- MyLog.log.info "Test Description: #{$testDes}"
22
- MyLog.log.info "TestID: #{$testId} \n"
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
23
31
  end
24
32
 
25
33
  # parseTestStepData
@@ -31,7 +39,6 @@ module JsonParser
31
39
  locate: parse_json['value1'] || 'id',
32
40
  testvalue2: parse_json['value2'],
33
41
  locate2: parse_json['value3'] || 'id',
34
- screenShotData: parse_json['screenshot'] == 'yes',
35
42
  skipTestCase: parse_json['skipTestCase'] == 'yes'
36
43
  }
37
44
 
@@ -11,7 +11,7 @@ module Parser
11
11
  require_relative '../taf_config.rb'
12
12
 
13
13
  def self.test_files
14
- @test_files ||= Dir.glob("#{$testcasesFolder}/*.json").reject do |file|
14
+ @test_files ||= Dir.glob("#{CMDLine.tests_folder}/*.json").reject do |file|
15
15
  File.basename(file).start_with?('~$')
16
16
  end.sort
17
17
  end
@@ -22,7 +22,6 @@ module Parser
22
22
  file_type = File.extname(test_file_name)
23
23
  if file_type.casecmp('.json').zero?
24
24
  MyLog.log.info "Processing test file: #{test_file_name}"
25
- MyLog.log.info "Browser Type: #{$browserType}"
26
25
  json = File.read(test_file_name)
27
26
  parse_json = JSON.parse(json)
28
27
 
@@ -12,31 +12,35 @@ module JunitReport
12
12
  # holds printable test report summary for all the executed tests
13
13
  @test_step_report_summary2 = []
14
14
  # construct the test suite header for junit
15
- def self.test_step_summary_xml(test_file_name, test_file_name_index)
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
16
19
  @test_step_report_summary2[test_file_name_index] = {
17
20
  'classname' => test_file_name,
18
21
  'name' => test_file_name,
19
- 'assertions' => $numberOfTestSteps,
20
- 'failures' => $testStepFailures,
21
- 'tests' => $testStepPasses,
22
- 'skipped' => $testStepNotrun,
22
+ 'assertions' => number_test_steps,
23
+ 'failures' => metrics.stepFailures,
24
+ 'tests' => metrics.stepPasses,
25
+ 'skipped' => metrics.stepSkipped,
23
26
  'time' => TimeDifference.between(
24
- $test_case_end_time, $test_case_start_time
27
+ tc_end, tc_start
25
28
  ).in_seconds
26
29
  }
27
30
  end
28
31
 
29
- def self.test_summary_junit
32
+ def self.test_summary_junit(ts_start_time, ts_end_time, total_passes,
33
+ total_failures, total_skipped)
30
34
  # output to XML file format for Junit for CI.
31
35
  builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
32
36
  testsuite_attrs = {
33
- 'classname' => $testcasesFolder.to_s,
34
- 'name' => $testcasesFolder.to_s,
35
- 'tests' => $totalTests.to_s,
36
- 'failures' => $totalTestFailures.to_s,
37
- 'timestamp' => $test_start_time.to_s,
38
- 'skipped' => $totalTestNotrun.to_s,
39
- 'time' => TimeDifference.between($test_end_time, $test_start_time)
37
+ 'classname' => CMDLine.tests_folder.to_s,
38
+ 'name' => CMDLine.tests_folder.to_s,
39
+ 'tests' => total_passes.to_s,
40
+ 'failures' => total_failures.to_s,
41
+ 'timestamp' => ts_start_time.to_s,
42
+ 'skipped' => total_skipped.to_s,
43
+ 'time' => TimeDifference.between(ts_end_time, ts_start_time)
40
44
  .in_seconds
41
45
  }
42
46
  xml.testsuites(testsuite_attrs) do |testsuites|
@@ -58,7 +62,11 @@ module JunitReport
58
62
  end
59
63
  end
60
64
 
61
- ts_summary_file_xml = File.open($TestSuiteSummaryXML, 'w')
65
+ # the test suite summary is a XML report generated will be called
66
+ # 'report_uuid.xml'
67
+ ts_xml_file = "#{$project_iddir}/report_#{SecureRandom.uuid}.xml"
68
+
69
+ ts_summary_file_xml = File.open(ts_xml_file, 'w')
62
70
  ts_summary_file_xml.write builder.to_xml
63
71
  ts_summary_file_xml.close
64
72
  end
@@ -22,8 +22,8 @@ module Report
22
22
 
23
23
  step = {
24
24
  'id' => test_step_idx,
25
- 'classname' => "SuiteID: #{$testId} Test Step: #{test_step_idx} "\
26
- "#{test_desc}",
25
+ 'classname' => "SuiteID: #{JsonParser.test_id}" \
26
+ " Test Step: #{test_step_idx} #{test_desc}",
27
27
  'name' => test_desc,
28
28
  'file' => test_file_name
29
29
  }
@@ -38,20 +38,20 @@ module Report
38
38
  end
39
39
 
40
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)
41
+ def self.test_pass_fail(pass_fail, test_file_name, test_step_idx, metrics)
42
42
  if pass_fail == true
43
- $previousTestFail = $currentTestFail
44
43
  $currentTestFail = false
45
- $testStepPasses += 1
44
+ metrics.stepPasses += 1
46
45
  MyLog.log.info "Test #{test_step_idx} has Passed ".green
47
46
  elsif pass_fail == false
48
- $previousTestFail = $currentTestFail
49
47
  $currentTestFail = true
50
- $testStepFailures += 1
48
+ metrics.stepFailures += 1
51
49
  MyLog.log.info "Test #{test_step_idx} has FAILED ".red
50
+ sc_file_name = Screenshot.save_screenshot(test_step_idx)
52
51
  failstep = {
53
- 'message' => "SuiteID: #{$testId} Test Step: #{test_step_idx} Test has"\
54
- ' FAILED - Check logs',
52
+ 'message' => "SuiteID: #{JsonParser.test_id}" \
53
+ " Test Step: #{test_step_idx} Test has" \
54
+ " FAILED - Check logs, see Screenshot: #{sc_file_name}",
55
55
  'type' => 'FAILURE',
56
56
  'file' => test_file_name
57
57
  }
@@ -65,10 +65,11 @@ module Report
65
65
  $failtestStep_xml[test_file_name][test_step_idx] = failstep
66
66
  else
67
67
  $currentTestFail = false
68
- $testStepNotrun += 1
68
+ metrics.stepSkipped += 1
69
69
  MyLog.log.info "Test #{test_step_idx} no checks performed ".blue
70
70
  skipstep = {
71
- 'message' => "SuiteID: #{$testId} Test Step: #{test_step_idx} No"\
71
+ 'message' => "SuiteID: #{JsonParser.test_id}" \
72
+ " Test Step: #{test_step_idx} No" \
72
73
  ' checks performed - Check logs',
73
74
  'type' => 'SKIPPED',
74
75
  'file' => test_file_name
@@ -87,7 +88,7 @@ module Report
87
88
  test_duration = TimeDifference.between(
88
89
  test_end_time, @test_start_time
89
90
  ).humanize || 0
90
- MyLog.log.info "Test step duration: #{test_duration}"
91
+ MyLog.log.info "Test step duration: #{test_duration} \n"
91
92
  end
92
93
 
93
94
  # check if the test failure threshold has been reached for total failures
@@ -95,7 +96,7 @@ module Report
95
96
  # If a certain number of consecutive tests fail then throw an exception
96
97
  def self.check_failure_threshold(test_file_name)
97
98
  consecutive_fail_threshold = 5
98
- if $previousTestFail && $currentTestFail
99
+ if $currentTestFail
99
100
  @consecutive_test_fail += 1
100
101
  else
101
102
  @consecutive_test_fail = 0
@@ -105,11 +106,11 @@ module Report
105
106
 
106
107
  # write info to stdout
107
108
  MyLog.log.warn "Terminating the current test file: #{test_file_name} as" \
108
- " the test failure threshold (#{$testStepFailures}) has been" \
109
+ " the test failure threshold (#{@consecutive_test_fail}) has been" \
109
110
  ' reached.'
110
111
  MyLog.log.warn '...continuing with the next test file (if there is one)'
111
112
 
112
113
  raise FailureThresholdExceeded,
113
- "#{$testStepFailures} Test Steps Failed."
114
+ "test failure threshold (#{@consecutive_test_fail}) has been reached"
114
115
  end
115
116
  end
@@ -12,23 +12,24 @@ module ReportSummary
12
12
  # holds printable test report summary for all the executed tests
13
13
  @test_step_report_summary = []
14
14
  # output the test results summary for the current test case
15
- def self.test_step_summary(test_file_name, test_file_name_index)
15
+ def self.test_step_summary(test_file_name, test_file_name_index, metrics)
16
16
  @test_step_report_summary[test_file_name_index] = <<~TEXT
17
17
  Test file executed: #{test_file_name}
18
- Browser type used: #{$browserType}
19
- Browser version: #{Browser.browser_version}
20
- There are: #{$testStepPasses} Passes
21
- There are: #{$testStepFailures} Failures
22
- There are: #{$testStepNotrun} Skipped Tests \n
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
23
  TEXT
24
24
  end
25
25
 
26
26
  # output the overall test results summary
27
- def self.print_overall_test_summary
27
+ def self.overall_test_summary(ts_start_time, ts_end_time, total_passes,
28
+ total_failures, total_skipped)
28
29
  # output to the console
29
30
 
30
31
  MyLog.log.info 'Finished processing all test files ' \
31
- "from the following test folder: #{$testcasesFolder}"
32
+ "from the following test folder: #{CMDLine.tests_folder}"
32
33
  MyLog.log.info "Overall Test Summary: \n"
33
34
  @test_step_report_summary.each do |test_step_report_summary|
34
35
  test_step_report_summary.each_line do |line|
@@ -37,16 +38,17 @@ module ReportSummary
37
38
  end
38
39
 
39
40
  duration = TimeDifference.between(
40
- $test_end_time, $test_start_time
41
+ ts_end_time, ts_start_time
41
42
  ).humanize || 0
42
43
 
43
- MyLog.log.info "Total Tests started at: #{$test_start_time}"
44
- MyLog.log.info "Total Tests finished at: #{$test_end_time}"
44
+ MyLog.log.info "Total Tests started at: #{ts_start_time}"
45
+ MyLog.log.info "Total Tests finished at: #{ts_end_time}"
45
46
  MyLog.log.info "Total Tests duration: #{duration}"
46
- MyLog.log.info "Total Tests Passed: #{$totalTestPasses}".green
47
- MyLog.log.info "Total Tests Failed: #{$totalTestFailures}".red
48
- MyLog.log.info "Total Tests Skipped: #{$totalTestNotrun}".blue
49
- $totalTests = [$totalTestPasses, $totalTestFailures, $totalTestNotrun].sum
50
- MyLog.log.info "Total Tests: #{$totalTests}\n"
47
+ MyLog.log.info "Total Tests Passed: #{total_passes}".green
48
+ MyLog.log.info "Total Tests Failed: #{total_failures}".red
49
+ MyLog.log.info "Total Tests Skipped: #{total_skipped}".blue
50
+ total_tests = [total_passes, total_failures,
51
+ total_skipped].sum
52
+ MyLog.log.info "Total Tests: #{total_tests}\n"
51
53
  end
52
54
  end
@@ -11,7 +11,7 @@ module Browser
11
11
  require_relative '../taf_config.rb'
12
12
  # open_browser function
13
13
  def self.open_browser
14
- lc_browser_type = $browserType.downcase
14
+ lc_browser_type = CMDLine.browser_type.downcase
15
15
  case lc_browser_type
16
16
  when 'chrome'
17
17
  chrome
@@ -38,7 +38,6 @@ module Browser
38
38
  @browser = Watir::Browser.new :chrome, switches: %w[
39
39
  --acceptInsecureCerts-true --start-maximized --window-size=1920,1080
40
40
  ]
41
- browser_version
42
41
  end
43
42
 
44
43
  # chrome headless browser details
@@ -47,7 +46,6 @@ module Browser
47
46
  --start-maximized --disable-gpu --headless --acceptInsecureCerts-true
48
47
  --no-sandbox --window-size=1920,1080
49
48
  ]
50
- browser_version
51
49
  end
52
50
 
53
51
  # firefox browser details
@@ -57,7 +55,6 @@ module Browser
57
55
  driver = Selenium::WebDriver.for(:firefox, desired_capabilities: caps)
58
56
  @browser = Watir::Browser.new(driver)
59
57
  browser_full_screen
60
- browser_version
61
58
  end
62
59
 
63
60
  # firefox headless browser details
@@ -71,8 +68,6 @@ module Browser
71
68
  # makes the browser full screen.
72
69
  @browser.driver.manage.window.resize_to(1920, 1200)
73
70
  @browser.driver.manage.window.move_to(0, 0)
74
- browser_version
75
- # browser
76
71
  end
77
72
 
78
73
  # makes the browser full screen.
@@ -90,7 +85,13 @@ module Browser
90
85
 
91
86
  # Check browser version
92
87
  def self.browser_version
93
- @browser.driver.capabilities[:version]
88
+ browser_name = CMDLine.browser_type.downcase
89
+ case browser_name
90
+ when 'chrome', 'chrome-headless'
91
+ @browser.driver.capabilities[:version]
92
+ when 'firefox', 'firefox-headless'
93
+ @browser.execute_script('return navigator.userAgent;').split('/')[-1]
94
+ end
94
95
  rescue StandardError
95
96
  'No Browser version'
96
97
  end
@@ -36,9 +36,9 @@ module CMDLine
36
36
  ' chrome-headless, firefox, firefox-headless'
37
37
  ) do |b|
38
38
  options[:browser] = b
39
- $browserType = options[:browser]
39
+ @browser_type = options[:browser]
40
40
  unless ['chrome', 'chrome-headless', 'firefox', 'firefox-headless']
41
- .include?($browserType)
41
+ .include?(@browser_type)
42
42
  MyLog.log.warn 'A valid Browser has not been supplied as a' \
43
43
  ' command-line parameter as expected'
44
44
  Process.exit
@@ -47,7 +47,7 @@ module CMDLine
47
47
 
48
48
  parser.on('-t', '--tests testfolder', 'i.e. tests/') do |t|
49
49
  options[:testfolder] = t
50
- $testcasesFolder = options[:testfolder]
50
+ @tests_folder = options[:testfolder]
51
51
  if Parser.test_files.size.positive?
52
52
  MyLog.log.info "There are: #{Parser.test_files.size}" \
53
53
  ' test files to process'
@@ -60,4 +60,12 @@ module CMDLine
60
60
  end
61
61
  end.parse!
62
62
  end
63
+
64
+ def self.browser_type
65
+ @browser_type
66
+ end
67
+
68
+ def self.tests_folder
69
+ @tests_folder
70
+ end
63
71
  end
@@ -17,25 +17,16 @@ module CreateDirectories
17
17
  #
18
18
  # ------->directory named after the test run ID UUID
19
19
 
20
- def self.time_now
21
- Time.new.strftime('%d-%b-%Y_%H_%M')
22
- end
23
-
24
20
  def self.construct_projectdirs
25
21
  # create top-level directory if it doesn't already exist:
26
22
  # Results/Project_id
27
- project_id = $projectId.delete(' ')
23
+ project_id = JsonParser.project_id.delete(' ')
28
24
  $project_iddir = File.join('Results', project_id)
29
25
 
30
26
  FileUtils.mkdir_p($project_iddir)
31
27
 
32
28
  # Generate UUID
33
29
  $run_uuid = SecureRandom.uuid
34
-
35
- # the test suite summary is a XML report generated will be called
36
- # 'suite_summary.xml'
37
- $TestSuiteSummaryXML = "Results/#{project_id}/#{time_now}" \
38
- '_test_result.xml'
39
30
  end
40
31
 
41
32
  def self.construct_testspecdirs
@@ -10,30 +10,18 @@
10
10
  module Screenshot
11
11
  require_relative '../taf_config.rb'
12
12
 
13
- # create screenshot filename and save the screenshot if the test has failed or
14
- # if explictly required
15
- def self.save_screenshot(screen_shot, test_step_idx)
16
- if $currentTestFail || screen_shot
17
- time = Time.now.strftime('%H%M')
18
- sc_dir = CreateDirectories.construct_testspecdirs
13
+ # create screenshot filename and save the screenshot if the test has failed.
14
+ def self.save_screenshot(test_step_idx)
15
+ time = Time.now.strftime('%H%M')
16
+ sc_dir = CreateDirectories.construct_testspecdirs
19
17
 
20
- sc_file_name = if $currentTestFail
21
- "#{sc_dir}/Test_ID-#{$testId.delete(' ')}"\
22
- "_Test_step-#{test_step_idx}_Failed"\
23
- "_#{time}.png"
24
- else
25
- "#{sc_dir}/Test_ID-#{$testId.delete(' ')}"\
26
- "_Test_step-#{test_step_idx}_#{time}.png"
27
- end
18
+ sc_file_name = "#{sc_dir}/Test_ID-#{JsonParser.test_id.delete(' ')}"\
19
+ "_Test_step-#{test_step_idx}_Failed_#{time}.png"
28
20
 
29
- # Screenshot capture for websites
30
- Browser.b.screenshot.save sc_file_name
31
- MyLog.log.info("Screenshot saved to: #{sc_file_name} \n")
32
- else
33
- MyLog.log.debug "No screenshot requested \n"
34
- end
35
-
36
- # if any issues with saving the screenshot then log a warning
21
+ # Screenshot capture for websites
22
+ Browser.b.screenshot.save sc_file_name
23
+ MyLog.log.info("Screenshot saved to: #{sc_file_name} \n")
24
+ sc_file_name
37
25
  rescue StandardError => e
38
26
  # construct the error message from custom text and the actual system
39
27
  # error message (converted to a string).
@@ -12,11 +12,15 @@ module TestEngine
12
12
 
13
13
  # process the test files to execute the tests
14
14
  def self.process_testfiles
15
- # get the overall test start time
16
- $test_start_time = Report.current_time
15
+ total_passes = 0
16
+ total_failures = 0
17
+ total_skipped = 0
17
18
 
18
19
  # loop through all the available test files to execute the tests
19
20
  Parser.test_files.each_with_index do |test_file_name, test_file_index|
21
+ metrics = Struct.new(:stepPasses, :stepFailures, :stepSkipped)
22
+ .new(0, 0, 0)
23
+
20
24
  begin
21
25
  # read in the test data
22
26
  tests = Parser.read_test_data(test_file_name)
@@ -32,9 +36,7 @@ module TestEngine
32
36
  CreateDirectories.construct_projectdirs
33
37
 
34
38
  # get the test case start time
35
- $test_case_start_time = Report.current_time
36
- # initialise the test end time
37
- $test_case_end_time = Report.current_time
39
+ tc_start = Report.current_time
38
40
 
39
41
  begin
40
42
  tests['steps'].each_with_index do |test_step, test_step_idx|
@@ -44,10 +46,7 @@ module TestEngine
44
46
 
45
47
  # process the test step data
46
48
  TestSteps.process_test_steps(test_file_name, test_step_idx,
47
- parsed_steps)
48
- # see if screenshot required
49
- Screenshot.save_screenshot(parsed_steps[:screenShotData],
50
- test_step_idx)
49
+ parsed_steps, metrics)
51
50
  end
52
51
  rescue TafError => e
53
52
  warn e
@@ -55,24 +54,24 @@ module TestEngine
55
54
  end
56
55
 
57
56
  # get the test case end time
58
- $test_case_end_time = Report.current_time
57
+ tc_end = Report.current_time
59
58
 
60
59
  # output the test results summary for the current test case,
61
60
  # pass in the test file number to save the summary against it's testfile
62
- ReportSummary.test_step_summary(test_file_name, test_file_index)
63
- JunitReport.test_step_summary_xml(test_file_name, test_file_index)
61
+ ReportSummary.test_step_summary(test_file_name, test_file_index, metrics)
62
+ JunitReport.test_step_summary_xml(test_file_name, test_file_index,
63
+ tc_start, tc_end, metrics)
64
64
 
65
65
  # close the browser if created
66
66
  Browser.b.quit
67
67
 
68
68
  # record total passes and failures and reset the failure counters for
69
69
  # the test steps
70
- $totalTestPasses += $testStepPasses
71
- $totalTestFailures += $testStepFailures
72
- $totalTestNotrun += $testStepNotrun
73
- $testStepPasses = 0
74
- $testStepFailures = 0
75
- $testStepNotrun = 0
70
+ total_passes += metrics.stepPasses
71
+ total_failures += metrics.stepFailures
72
+ total_skipped += metrics.stepSkipped
76
73
  end
74
+
75
+ [total_passes, total_failures, total_skipped]
77
76
  end
78
77
  end
@@ -16,7 +16,8 @@ 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, test_step_idx, step_attributes)
19
+ def self.process_test_steps(test_file_name, test_step_idx, step_attributes,
20
+ metrics)
20
21
  # print the test step information
21
22
  Report.print_test_step_header(test_file_name, test_step_idx,
22
23
  step_attributes[:testdesc])
@@ -26,7 +27,7 @@ module TestSteps
26
27
 
27
28
  if handler.respond_to?(:perform)
28
29
  func = handler.perform(step_attributes) if runtest == false
29
- Report.test_pass_fail(func, test_file_name, test_step_idx)
30
+ Report.test_pass_fail(func, test_file_name, test_step_idx, metrics)
30
31
  Report.check_failure_threshold(test_file_name)
31
32
  return true
32
33
  else
@@ -3,7 +3,7 @@
3
3
  module Taf
4
4
  # This module holds the TAF version information.
5
5
  module Version
6
- STRING = '0.3.5'
6
+ STRING = '0.3.6'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, running on ' \
9
9
  '%<ruby_engine>s %<ruby_version>s %<ruby_platform>s)'
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.5
4
+ version: 0.3.6
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-16 00:00:00.000000000 Z
11
+ date: 2019-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler