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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3ff58b175551a2af8c4be802f8f78e01938507f4b2dd05e651a0428a846d006
4
- data.tar.gz: 92d745cf353c25157b3cc667a961b3cb98bfdbb851944d68bf79be032aa13281
3
+ metadata.gz: f83e07b3044b079bd0aac90bf52228be938e046613728c0594ef8b079b63c662
4
+ data.tar.gz: c2aa622d24653df88fcf322d301598cdbd84a5c2a7fcbef5c7d08bccee8ef916
5
5
  SHA512:
6
- metadata.gz: 9c27fad29983e3c9fbdaa059b572b843e557b4d744f5d0fbb5c7b129a507bcdba7c7c2c6d3e3d12317eb0b6789a0a92ba093a11a859d9299815bbee385079a6f
7
- data.tar.gz: cb893b463b1c38e20b4d18d08261345f8f774a67a946f707e66917f17642e8bc1340d4cbe4aa939e05fc5f56409b427dd31a98f26de02d73b64fefab10ff37dd
6
+ metadata.gz: 8e8d911dbffacecb97274bd18fcbbf92eeb9290661293f428bc38bb5aacfb264e3fffb26869e578fdfaf3f825ccf954c0adf52d6a63920d405958e157e5ce8c3
7
+ data.tar.gz: dcd34611500f0451735321a0c27d4fcec4c259f255e228920c600ffc5f54af236d21f0392007d8237175cdf12942f06e4d3b3e0aa0a20a09e12550b939ef00bb
@@ -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'],
@@ -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 |test_step_index, test_step_xml|
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'])&.[](test_step_index)
49
+ &.[](test_step_report_summary2['name'])&.[](test_step_idx)
50
50
  skipped = $skiptestStep_xml
51
- &.[](test_step_report_summary2['name'])&.[](test_step_index)
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
@@ -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, test_step_index, step_attributes)
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: #{step_attributes[:testStep]} : #{step_attributes[:testdesc]}"
21
+ MyLog.log.info "Test step: #{test_step_idx} : #{test_desc}"
22
22
 
23
23
  step = {
24
- 'id' => step_attributes[:testStep],
25
- 'classname' => 'SuiteID: ' + $testId.to_s + ' Test Step: ' + step_attributes[:testStep].to_s + ' ' + step_attributes[:testdesc].to_s,
26
- 'name' => step_attributes[:testdesc],
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][test_step_index] = step
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, test_step_index, step_attributes)
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 #{step_attributes[:testStep]} has Passed ".green
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 #{step_attributes[:testStep]} has FAILED ".red
50
+ MyLog.log.info "Test #{test_step_idx} has FAILED ".red
51
51
  failstep = {
52
- 'message' => 'SuiteID: ' + $testId.to_s + ' Test Step: ' + step_attributes[:testStep].to_s + ' Test has FAILED - Check logs',
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][test_step_index] = failstep
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 #{step_attributes[:testStep]} no checks performed ".blue
67
+ MyLog.log.info "Test #{test_step_idx} no checks performed ".blue
68
68
  skipstep = {
69
- 'message' => 'SuiteID: ' + $testId.to_s + ' Test Step: ' + step_attributes[:testStep].to_s + ' No checks performed - Check logs',
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][test_step_index] = skipstep
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, _test_step_index,
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
@@ -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, parsed_steps)
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-#{parsed_steps[:testStep]}_Failed"\
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-#{parsed_steps[:testStep]}_#{time}.png"
24
+ "_Test_step-#{test_step_idx}_#{time}.png"
25
25
  end
26
26
 
27
27
  # Screenshot capture for websites
@@ -37,14 +37,17 @@ module TestEngine
37
37
  $test_case_end_time = Report.current_time
38
38
 
39
39
  begin
40
- tests['steps'].each do |test_step|
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, parsed_steps[:testStep],
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
- parsed_steps)
50
+ test_step_idx)
48
51
  end
49
52
  rescue TafError => e
50
53
  warn e
@@ -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, test_step_index, step_attributes)
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, test_step_index,
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, test_step_index,
30
- step_attributes)
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}"
@@ -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.0'
6
+ STRING = '0.3.1'
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Perrett